Introduction

As my customer is having his database in webpanel, I'll need to do backup. So I decide to use this bot to do the automated backup for me. I know SQL Agent can do this for me but as this customer is using shared hosting, that option is not permited to me.

What I'm trying to do here?

I need to create a file called backup.txt which contain set of command that I can use to manipulate the web site. Once the backup.txt is completed, I'll need to use schedule task to run the bot automatically.

Step 1: Create the backup.txt file

  1. In order to do this, I will just run connect.exe
  2. In the command segment, I'll just type "go url" which is going to bring me to the Control panel. For this example, "go cp.nexoft.asia"
  3. After awhile, the system will load up the website site and we need to know what is the control that we can use. Type "list"
  4. From here, you will get the list of button and textbox that you can play around with. In order to play with this, I'll just type "enterspace" and double click on "...txtUserName". The system will automatically populate the textbox with full id. After that, I'll will just continue type in my userid. The full syntax will be "enter ctl02ctl01ctl00_txtUsername userid". If you are doing correctly, you will be able to see "userid" prompt into the website
  5. We just continue for the rest like password and etc. Once we are done, I'll need to click "login". This is where I type the command "click ctl02ctl01ctl00_btnLogin"
  6. I'll wait for the website the load completely and it will bring me to another page. I need to validate if the system is going to bring me the right place. So the first I'll need to do is to type "url". The system will prompt me with current location of the web page. With this, i'll put into my backup.txt "validateurl url".
  7. With this, I'll hope it can help you to get some steps on how I do manipulation on the website while constructing the backup.txt. Below would be the sample of a real working version of my script but I have remove confidential information.

backup.txt
go cp.nexoft.asia
enter ctl02_ctl01_ctl00_txtUsername userid
enter ctl02_ctl01_ctl00_txtPassword password
click ctl02_ctl01_ctl00_btnLogin
validateurl http://cp.nexoft.asia/default.aspx
go http://cp.nexoft.asia/Default.aspx?pid=SpaceMsSql2008&mid=100&ctl=backup&ItemID=2425&SpaceID=202
click ctl02_ctl00_ctl00_rbCopy
validateurl http://cp.nexoft.asia/Default.aspx?pid=SpaceMsSql2008&mid=100&ctl=backup&ItemID=2425&SpaceID=202
enter ctl02_ctl00_ctl00_fileLookup_txtFile path
enter ctl02_ctl00_ctl00_txtBackupName backup_file_name
click ctl02_ctl00_ctl00_btnBackup
validateurl http://cp.nexoft.asia/Default.aspx?pid=SpaceMsSql2008&mid=100&ctl=edit_item&ItemID=2425&SpaceID=202
download download_path save_path
launch restore_script.bat
exit

Step 2: Run it from command prompt (or schedule task)

In order to see the whole thing work automatically, just type this command connect.exe "load backup.txt". With this, you will be able to see everything is running automatically by itself.

Last edited Feb 11, 2011 at 3:48 PM by entrapnet, version 1

Comments

No comments yet.