darkwalk Posted October 11, 2009 Share Posted October 11, 2009 Hi: I've been having this strange problem I have not been able to diagnose. The following script runs fine if I run it manually within a command prompt while logged in. However, if I it was allowed to run from the windows scheduler while the PC is locked, it does not work properly. Acrobat is executed, but "+^o" is either not sent, or acrobat does not respond with the "make pdf from webpage" dialog box. I tried popping up a message box, but it does not appear. I believe the script is paused after I log in. Any help is appreciated. Thanks! Local $urls[2] $urls[0] = "google.com" $urls[1] = "yahoo.com" Local $urlNames[12] $urlNames[0] = "goog" $urlNames[1] = "yahoo" $path = "c:\mrtgTmp\" Local $fullPath = "asdf" Local $temp Opt("WinTitleMatchMode", 2) ShellExecute("c:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe") if( NOT WinWait("Adobe Acrobat Pro", 20 ) ) then ;Acrobat is open, so this executes correctly MsgBox(0,"box","Acrobat did not open") Exit endif sleep( 10000 ) For $i = 0 to 1 ;Not sure if this is entered WinWait("Adobe Acrobat Pro") for $j = 0 To 3 WinActivate( "Adobe Acrobat Pro" ) Send("+^o") ;I'm not sure if this is executed if( WinWait("Create PDF from Web Page","", 2 ) ) then ;this is never true ExitLoop endif if( $j == 3 ) then ;Message box never open MsgBox(0,"box","did not open create from url box") Send("^q") Exit endif Next For $j = 0 To 3 ;rest of these are never executed. WinActivate( "Create PDF from Web Page" ) ControlSetText("Create PDF from Web Page", "", "[CLASS:Edit; INSTANCE:1]", $urls[$i]) $temp = ControlGetText("Create PDF from Web Page", "", "[CLASS:Edit; INSTANCE:1]") if $temp == $urls[$i] then ExitLoop endif if( $j == 3 ) then Send("^q") Exit endif sleep( 1000 ) Next Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 11, 2009 Share Posted October 11, 2009 Use ControlSend() to send the input to appropriate window. Send() goes to the active window. Remember that when the console is locked no window can be "[ACTIVE]", but ControlSend() can still send inputs to an inactive window, so it should work. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
darkwalk Posted October 12, 2009 Author Share Posted October 12, 2009 Thanks! it worked! Link to comment Share on other sites More sharing options...
Zedna Posted October 12, 2009 Share Posted October 12, 2009 As PsaltyDS said.Here is general description:FAQ #21Why my script doesn't work on locked station?#571221 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
darkwalk Posted October 12, 2009 Author Share Posted October 12, 2009 Thanks, Zedna. I browsed the FAQ before posting, but I guess I missed it. Will look closer next time. 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