Jump to content
Sign in to follow this  
darkwalk

script not running properly if computer "locked" but not logged in

Recommended Posts

darkwalk

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
darkwalk

Thanks, Zedna.

I browsed the FAQ before posting, but I guess I missed it. Will look closer next time.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.