Jump to content

Automating a non-existent GUI


 Share

Recommended Posts

Initially, I was running AutoIt via remote desktop connection on a Windows 2000 server that literally has no monitor. Then, my laptop died. I am now trying to execute my automation program by using Terminal Services Client on my PDA. I have found, however, that the AutoIt script literally pauses the instant I am no longer connected. Because my script takes days to execute, there is no way for me to maintain a stable connection to give AutoIt a GUI to work with.

My first idea for troubleshooting this is to get rid of all instances of WinWaitActive in my script, instead adding a bit of redundancy to WinActivate, e.g.

WinActivate( "File Import", "" )
Sleep(1000)
WinActivate( "File Import", "" )

I am unable to test this idea at this time, and have no idea if the reason the script pauses is that it is waiting for the window to activate yet never receives that information. Will AutoIt arbitrarily execute the commands above, or will it wait until it detects the features of the GUI, which un fortunately do not exist. I am even in the correct ballpark with my diagnosis?

Thanks for this.

Link to comment
Share on other sites

Just as a note... whether or not the monitor is plugged in the computer is still working. If you have your script completely workable and installed on that computer then you should be able to run it.

What it sounds like is happening is that script is on your computer and you are trying to run it and it is supposed to execute remote commands on that machine. So if you exit out of your computer the script is no longer able to run.

Where is the script located. On you computer or on the remote machine?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Just as a note... whether or not the monitor is plugged in the computer is still working. If you have your script completely workable and installed on that computer then you should be able to run it.

What it sounds like is happening is that script is on your computer and you are trying to run it and it is supposed to execute remote commands on that machine. So if you exit out of your computer the script is no longer able to run.

Where is the script located. On you computer or on the remote machine?

JS

<{POST_SNAPBACK}>

AutoIt is installed on my dedicated server, which is running Windows 2000 SP4. It's (obviously) not installed on my PocketPC, which is what I am using at this time to terminal server into the Win2k machine and start my compiled AutoIt program. So long as there is an active remote desktop session going, AutoIt will recognize when one stage is finished and move to the next. Unfortunatey, wireless as it is these days, I can't keep a connection for more than 6 hours (my max so far). The instant I am disconnected from remote desktop AutoIt just pauses - a TomeRaider 3 compilation, for example, is one of the stages of my automation script. If it is running when I am disconected, it will continue until it is finished, and then it will just sit there all night or day long until I log in agan. The instant I log back in AutoIt resumes, recognizes TomeRaider is finished, and continues on its merry way. Wash, rinse, repeat.

The only thing I can think of is that for whatever reason it has no GUI to work with unless there is a) a monitor or :idiot: a terminal services or remote desktop connection.

Does this make sense? Yes, the computer keeps working, but perhaps Windows recognizes there is no one requesting a graphical interface and therefore does not create one? I can't think of anything else.

Link to comment
Share on other sites

AutoIt is installed on my dedicated server, which is running Windows 2000 SP4.  It's (obviously) not installed on my PocketPC, which is what I am using at this time to terminal server into the Win2k machine and start my compiled AutoIt program.  So long as there is an active remote desktop session going, AutoIt will recognize when one stage is finished and move to the next. Unfortunatey, wireless as it is these days, I can't keep a connection for more than 6 hours (my max so far).  The instant I am disconnected from remote desktop AutoIt just pauses - a TomeRaider 3 compilation, for example, is one of the stages of my automation script.  If it is running when I am disconected, it will continue until it is finished, and then it will just sit there all night or day long until I log in agan.  The instant I log back in AutoIt resumes, recognizes TomeRaider is finished, and continues on its merry way.  Wash, rinse, repeat.

The only thing I can think of is that for whatever reason it has no GUI to work with unless there is a) a monitor or :D a terminal services or remote desktop connection.

Does this make sense?  Yes, the computer keeps working, but perhaps Windows recognizes there is no one requesting a graphical interface and therefore does not create one?  I can't think of anything else.

<{POST_SNAPBACK}>

Wow, interesting situation. Yes I understand not having AutoIt on your PocketPC ;). I dont have any way of testing your situation. :idiot:

I will try and run an AutoIt script with a my monitor unplugged, see what happens... I'll let you know tomorrow as that wont happen for a little while. :lol:

I dont know what else to say until I run that little test tomorrow. It also may be different in a server environment, though I dont see why it would.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Alterego, I'm not sure that the script will be able to run. Because when you connect to a Server via Terminal Services (Remote Desktop) the only GUI (Desktop) this is created is on the client. The Server itself is, or can be, still sitting at the Logon Screen (the Press Ctrl + Alt + Del to Login screen).

One possible idea is to load VNC onto the Server, and connect to the Server using VNC. Then, you use the Server remotly, but it's like you are sitting at the server. If the VNC connection is broken, the Server is still on whatever screen you left it.

Just my idea.

Hope that helps,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Alterego, I'm not sure that the script will be able to run.  Because when you connect to a Server via Terminal Services (Remote Desktop) the only GUI (Desktop) this is created is on the client.  The Server itself is, or can be, still sitting at the Logon Screen (the Press Ctrl + Alt + Del to Login screen).

One possible idea is to load VNC onto the Server, and connect to the Server using VNC.  Then, you use the Server remotly, but it's like you are sitting at the server.  If the VNC connection is broken, the Server is still on whatever screen you left it.

Just my idea.

Hope that helps,

Ian

<{POST_SNAPBACK}>

Slick. I didnt know that about Terminal Services. I would definitely recommend VNC.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I would recommend setting your script up as a service and making the service "Interact with the desktop" since the problem is that if the system is locked (logging out of remote desktop does that), then the autoit program cannot "see" the window of the program you wish to automate. There is a free service creation program here: http://www.pirmasoft.com/runassvc.php

I believe that will absolutely solve the problem, and you wouldn't need VNC at all.

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

I would recommend setting your script up as a service and making the service "Interact with the desktop" since the problem is that if the system is locked (logging out of remote desktop does that), then the autoit program cannot "see" the window of the program you wish to automate. There is a free service creation program here: http://www.pirmasoft.com/runassvc.php

I believe that will absolutely solve the problem, and you wouldn't need VNC at all.

<{POST_SNAPBACK}>

These are some killer suggestions. I am trying to do this from my PocketPC right now - assuming I can reach all the necessary buttons on this teensy screen i'll let you guys know how this goes. :idiot:
Link to comment
Share on other sites

this-is-me, it works to a point, but then we run into a similar, although not quite the same issue as before. I set this up as a service and rebooted the computer. I came back after sufficient time had passed for it to be in in the third sub-phase of my first phase. The first two sub-phases are command line utilities - wget gets a file, bunzip decompresses it. Then TomeRaider, a GUI, opens and compiles the file. I found TomeRaider to be open and idle. I use Process Explorer from SysInternals.com, chose the "Bring to Front" feature for this process, and received the error, "No visible windows found for this proccess".

This doesn't necessarily mean that it doesn't exist, as I can experience the same situation when trying to bring forward processes being used by other users on the same mchine. But since it is sitting idly, I have to assume that again there is no window for AutoIt to interact with. Here is the specific bit of code we are getting caught up on:

;start TomeRaider and tell it to get ready to import
Run( "C:\Program Files\TomeRaider3\TomeRaider.exe", "C:\Program Files\TomeRaider3\", @SW_MAXIMIZE )
WinWait( "TomeRaider", "Categories" )
If not WinActive( "TomeRaider", "Categories" ) Then WinActivate( "TomeRaider", "Categories" )
Sleep(10000)
If not WinActive( "TomeRaider", "Categories" ) Then WinActivate( "TomeRaider", "Categories" )
Send( "{ALTDOWN}{ALTUP}{DOWN}{DOWN}{DOWN}{ENTER}" ) 

;changing settings, pushing buttons
    ControlClick("File Import", "", "Button3" )
    ControlClick("File Import", "", "Button9" )
    ControlClick("File Import", "", "Button5")
    ControlClick("File Import", "", "Button12")
    ControlSetText("File Import", "", "Edit1", "896");works, but TR3 doesn't seem to accept it. hrm.
ControlSetText("File Import", "", "Edit3", $db & $lang & "\WP_" & $lang & "_" & $plat & "_TXT.txt")
ControlClick("File Import", "", "Button19" );import!

I removed WinWaitActive from my code just to be sure that waiting for the window to activate wasn't the holdup. If I can get it to push Button19 i'm home free! :idiot:

Link to comment
Share on other sites

I'm wondering - suppose I had a program that recognized the Win2k logon screen and automatically logged on as administrator, and started that as a service. It's not particularly dangerous, the sole caveat being, how on earth do I get window information about that screen? It places your cursor for you, I could simply have it type the username, push tab, type the password, push enter, and have my automation program in the startupfolder rather than being a service. Any input or reality checks on this are highly welcome. I'm going to sleep on it :idiot:

Link to comment
Share on other sites

You can set Windows to auto-logon, by editing the Registry. AutoIt is not required for that, and it works. Then just put your AutoIt script in the Startup folder of the User Account you are using to Auto-logon.

Here's how to Auto-Logon:

HKEY_LOCAL_MACHINE \ SOFTWARE \ MICROSOFT \ Windows NT \ Current Version \ Winlogon:

AutoAdminLogon (String) = 1

ForceAutoLogon (String) = 1

DefaultUsername (String = USERNAME

DefaultPassword (Sting) = PASSWORD

DefaultDomain (String) = COMPUTERNAME

There's also lots of documents that give more detail about Auto-logon for Windows 2000, it's the same for XP, and I'm guessing 2003, just search Google.

Hope this helps,

Ian

EDIT: Also, VNC is still a good idea, IMO, so that you can monitor the progress of your script.

Edited by ioliver

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

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...