Jump to content

Simple Windows script fails in batch mode


jfme
 Share

Recommended Posts

my compiled au3 runs fine from a batch command window.

it runs fine when I run it as a scheduled task under my current open window credentials.

it hangs (the compiled exe and the executable, cipher.exe show as processes running and the batch job shows as running) when submitted as an AT under windows xp 64 pro. It never finishes. It seems like it needs a gui interface, but can't get one in batch mode.

Code:

Opt("WinWaitDelay",100)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Local $pid = Run('cipher /x:c:\a\tmp.txt c:\temp\cert.pfx')

_WinWaitActivate("EFS certificate and key backup.","")

Send("{ENTER}")

_WinWaitActivate("C:\WINDOWS\system32\cipher.exe","")

Send("{SHIFTDOWN}a{SHIFTUP}ra{SPACE}{SHIFTDOWN}x{SHIFTUP}y{ENTER}{SHIFTDOWN}{SHIFTUP}{SHIFTDOWN}a{SHIFTUP}ra{SPACE}{SHIFTDOWN}x{SHIFTUP}y{ENTER}")

Question:

1) What must I do to ensure that a compiled au3 (either 64 or 32 bit) that executes with gui window interaction runs and finishes under the batch job with user credentials of "system"?

Thank you!

Link to comment
Share on other sites

Well,

After some research and review, I solved the problem.

I changed the first Send to ControlSend.

I changed winwaitactive to winwait with a 4 second wait.

Runs as batch so no window will ever take focus/be active and winwaitactive will wait for ever...

I left the second Send alone as it was sending to a dos/batch/cmd window, not a normal msgbox window or any other "gui" type window. See help on Send and ControlSend.

Then I compiled as 64 bit with console mode as I am running in xp 64 (2003 server).

Trial and error for this above.

Excellent. It all runs like it should.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...