You cannot use SendKeys with the service or when the screen is locked or screensaver is active, just because there is no user desktop available at that time and so you don't have a target window at that time to send your keystrokes to. One solution is to force the user desktop by automatically logging in to the system and unlocking the screen. Get Logo.exe utility from the 24x7 Tips and Script archive. You can use to unlock the desktop. Another solution, which I strongly recommend as the best choice, is to avoid using SendKeys and other graphics-related things for critical business processing all together. SendKeys should be used only as a last resort for automating "bad" graphical applications that don't support any business automation (or better find a replacement for such bad application). In this particular case you should be able to automate the processing using more reliable methods. For example, why not to use FTP commands in 24x7 to do the FTP instead of controlling the command line FTP with sent key? If for whatever reason you prefer the command line FTP you can still run it automated using an simple FTP script saved as file. The start command would be then like below FTP -n -smyscript.ftp The constants of myscript.ftp file is below OPEN servername USR myname PWD my password CD ...some path GET .... some file etc... Similarly you can use command line parameters with pgp and other utilities to avoid interactive processing. This way you can run the whole thing in any mode as an interactive job, standalone scheduler, service, and so on... : Hello, : My jobs aren't running correctly- : I think this is a problem with how to run the scripts or the environment, etc : I have a few scripts below is one of them, When I run them in test or normal : they run fine : window pops up, follows the commands, closes window : However it never does all of this in schedule : I am logged into a server via RDP : 24x7 is runnning normal (not as a NT service) not sure which is best : My job is set to run at 6:00 in the morn- (they put the file there at 5:00) : and I have woken up and checked that the file is there : I receive the email stating the job finished : When I look at the RDP session when I get in in the morn : There is the open command window open : (Its path matched that of the path statement in the run command) : The file has not been downloaded, and therefore no copy : Why is this happening? : Do I need to run 24x7 as an NT service? : Why aren't my jobs actually running? : any ideas, suggestions : thanxs : Anthony : dim (return, number) : // launch cmd window : Run( "cmd", "R:\Vendors\GoldmanSacs", Return ) : Wait( 2 ) : //log in : SendKeys( "ftp XXX.com{ENTER}" ) : Wait( 4 ) : SendKeys( "LOGIN{ENTER}" ) : Wait( 4 ) : SendKeys( "PSWD{ENTER}" ) : Wait( 4 ) : //get files : SendKeys( "cd outgoing{ENTER}" ) : Wait( 4 ) : SendKeys( "get posn{shift}Custody.txt.pgp{ENTER}" ) : Wait( 10 ) : // close ftp session : SendKeys( "bye{ENTER}" ) : Wait( 2 ) : // decrypt file : SendKeys( "c{shift};{ENTER}" ) : Wait( 1 ) : SendKeys( "cd ../../vpgp{ENTER}" ) : Wait( 1 ) : SendKeys( "gs{shift}-security.exe {shift}(DECRYPTION) c{shift};\vpgp\ : R{shift};\Vendors\GoldmanSacs\posn{shift}Custody.txt.pgp : R{shift};\Vendors\GoldmanSacs\posn{shift}Custody{shift}(NS).txt NAME : COMMNET {shift}'PASSPHRASE{shift}'{ENTER}" ) : wait ( 5 ) : //Copy file : FileCopy( "R:\Vendors\GoldmanSacs\posnCustodyNS.txt", : "R:\Vendors\GoldmanSacs\posnCustodySDS.txt" ) : Wait( 5 ) : SendKeys( "exit{enter}")
|