abhi Posted April 12, 2007 Share Posted April 12, 2007 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 Link to comment Share on other sites More sharing options...
lod3n Posted April 12, 2007 Share Posted April 12, 2007 Are you using Win"Active" commands, etc? Because no window can be Active when no one is logged on. What does your script actually do? [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
evilertoaster Posted April 12, 2007 Share Posted April 12, 2007 http://www.autoitscript.com/forum/index.php?showtopic=37289faq #4 Link to comment Share on other sites More sharing options...
abhi Posted April 12, 2007 Author Share Posted April 12, 2007 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 Link to comment Share on other sites More sharing options...
lod3n Posted April 12, 2007 Share Posted April 12, 2007 (edited) You can use WinExists instead.Edit: I mean WinWait and WinExists:WinWait("Title") While WinExists("Title") sleep(100) wend Edited April 12, 2007 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
abhi Posted April 13, 2007 Author Share Posted April 13, 2007 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 Link to comment Share on other sites More sharing options...
lod3n Posted April 13, 2007 Share Posted April 13, 2007 What about ControlSetText, ControlClick, and ControlCommand? [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
abhi Posted April 13, 2007 Author Share Posted April 13, 2007 ControlClick worked. Thanks 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