Jump to content

Recommended Posts

Posted

All,

I have a script that is launched from a service. The script interacts with the desktop to launch and manage a GUI.

I was able to achieve that by running the service as Local system Account(Allowing the service to Interact with desktop)

This technique works only if some user is logged on to that box. In the event that nobody is logged on, the script doesn't behave as expected.

Can somebody throw some light on how to handle such a scenario ? I am using Windows 2000 server.

Thanks

Posted

My script(launched by a service) launches a batch file which may or may not throw a dialog. If it does throw a dialog, my script sends an appropriate key stroke in response to the dialog. I was hoping it did that even when no one was logged into the system.

Yes my script does use WinWaitActive() method.

Thanks

Posted

Thanks lod3N for your suggestion. It helped.

However, when nobody is logged on to the machine where I am testing my script, my scripts efforts to send events like Enter key or mouse click are failing. Following is the snippet of code I have used. The code generates the file but neither Send("{ENTER}") nor the MouseClick() call are working.

Any help would be appreciated. Point to be considered is I am launching the script on a machine where nobody is logged in.

if WinExists("xyz") Then

$file = FileOpen("C:\Tmp\winlist.txt", 1)

FileWrite($file, "Title=xyz" & @LF & "Handle=" & WinGetHandle("xyz") & @CRLF)

$text = WinGetText("xyz","")

FileWrite($file, "Error=" & $text)

FileClose($file)

Send("{ENTER}")

;ControlSend("xyz",$text,2,"{ENTER}")

;$pos = ControlGetText("xyz",$text,2)

;$pos = ControlGetPos("xyz",$text,"OK")

MouseClick("primary",505,424,1)

EndIf

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
×
×
  • Create New...