tehjoch Posted December 1, 2011 Share Posted December 1, 2011 Hi, I've created a script to run through some gui steps of winscp in order to retrieve backups. Because of some firewall restrictions it has to be done like this. so: Server A (including the script) connects to server B it seems it doesn't run when there's nobody connected to server A it also appears as if the script isn't paused but just locks up. It does run flawless when you connect to the server or when you execute it from your own pc. This is however not an option :-( kind regards Jochem Link to comment Share on other sites More sharing options...
tehjoch Posted December 1, 2011 Author Share Posted December 1, 2011 excuse me for my simple-minded programming, it's been a year or 3 This is the code... can I add something to force execution? For $i=10 to 90 Step 10 ;backupping all clusters using winSCP ;open connection WinActivate("WinSCP") sleep(200) send("3.210.123.") send($i) send("{TAB}user{TAB}password{ENTER}") sleep(500) send("{space}") sleep(3000) ;clicking left pane for "local", executing commands MouseClick("left", 400, 450) sleep(1000) send("{CTRLDOWN}o{CTRLUP}") sleep(500) send("C:Backup clusters"& $i &"{ENTER}") sleep(500) ;clicking right pane for "remote", executing commands MouseClick("left", 800, 500) sleep(1000) send("{CTRLDOWN}o{CTRLUP}") sleep(500) send("/home/bu/{ENTER}") sleep(500) ;synchronize send("{CTRLDOWN}s{CTRLUP}") WinWaitActive("Synchronize") sleep(500) send("{ENTER}") sleep(500) $file = FileOpen ("bulogs.txt",1) $date = @year & @mon & @mday & "_" & @hour & ":" & @min $backupfail = false If WinExists("Synchronization") Then FileWrite($file, $date & " - Starting Backup sync for cluster " & $i & @CRLF) Else FileWrite($file, $date & " - Backup sync for cluster " & $i & " failed: no backup files found" & @CRLF) $backupfail = true EndIf FileClose($file) ;sleep(500) send("{ENTER}") ;30 seconds to complete sleep(30000) $file = FileOpen ("bulogs.txt",1) $date = @year & @mon & @mday & "_" & @hour & ":" & @min If WinExists("Synchronization") or $backupfail Then FileWrite($file, $date & " - Backup sync for cluster " & $i & " failed: no remote backup file found" & @CRLF) send("{esc}") Else FileWrite($file, $date & " - Finished Backup sync for cluster " & $i & " succesfully" & @CRLF) EndIf FileClose($file) sleep(500) ;deleting backups stored on the cluster send("{CTRLDOWN}a{CTRLUP}") sleep(500) send("{DEL}") sleep(500) send("{ENTER}") sleep(1500) ;starting new connection send("{CTRLDOWN}n{CTRLUP}") Next ;closing winscp send("{esc}") send("{altdown}{F4}{altup}") sleep(500) send("{space}") Exit Link to comment Share on other sites More sharing options...
BrewManNH Posted December 1, 2011 Share Posted December 1, 2011 Check out the FAQ entry on why this doesn't work correctly. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
tehjoch Posted December 1, 2011 Author Share Posted December 1, 2011 Thanks for that, Have had gone through a different set of autoit FAQ... I'll see what I can do Link to comment Share on other sites More sharing options...
tehjoch Posted December 1, 2011 Author Share Posted December 1, 2011 (edited) Could you perhaps assist me in analysing the first window?http://www.freebits.nl/view.php?filename=532controlclick.jpgHow do I controlsend in this field?I triedControlsend("WinSCP","",1706432,"testtext") but no go? Edit: ok never mind the control click just changes, gonna see further on how to retrieve the ID first Edited December 1, 2011 by tehjoch Link to comment Share on other sites More sharing options...
BrewManNH Posted December 1, 2011 Share Posted December 1, 2011 Use the Advanced Class information instead of the ControlID number to send to. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now