Sign in to follow this  
Followers 0
dcook23

GUI Automation with no session

2 posts in this topic

Similar questions have been asked in the past but I can't seem to get anything to work so I'm finally going to ask for help.

This situation is that I have an application that runs on a Windows terminal server and every night about 9:00 a user logs in from home, logs into the terminal server and runs an application. This application send/receives data and the company does not support any other way of data transfer other than through their application.

I'm trying to automate this process by using AutoIT to run a scheduled task that will click on the proper buttons and put in the login information needed to do the transfer. I am using ControlClick and ControlSend and it works great if I'm logged in and just execute the compiled script. If I try running as a scheduled task I get a return code of 0 for every ControlClick and ControlSend but the application does get launched. I have included my script below and as you can see I have a lot of FileWriteLine entries so I can see what is happening. Where I'm using sleep I was using WinWait but thought that may be causing me issues.

I have tried using psexec with the -i -s as one person suggested and I get the same results.

Any ideas would be appreciated.

-----

$var1 = Run("pathtoapp", "dirofapp")

FileWriteLine("c:\temp\out.txt","$var1")

FileWriteLine("c:\temp\out.txt",$var1)

WinWait("windowname")

sleep(5000)

$var2 = ControlClick("windowname", "Select the following options.", "&Connect")

sleep(5000)

FileWriteLine("c:\temp\out.txt","$var2")

FileWriteLine("c:\temp\out.txt",$var2)

$var3 = ControlSend("windownameLogin", "TextInWindow", "[CLASS:EDIT; INSTANCE:1]", "usr")

FileWriteLine("c:\temp\out.txt","$var3")

FileWriteLine("c:\temp\out.txt",$var3)

$var4 = ControlSend("windownameLogin", "TextInWindow", "[CLASS:EDIT; INSTANCE:2]", "pwd")

FileWriteLine("c:\temp\out.txt","$var4")

FileWriteLine("c:\temp\out.txt",$var4)

;sleep(15000)

$var5 = ControlClick("windownameLogin", "TextInWindow", "OK")

FileWriteLine("c:\temp\out.txt","$var5")

FileWriteLine("c:\temp\out.txt",$var5)

$var6 = WinWait("windowname", "TextInWindow")

FileWriteLine("c:\temp\out.txt","$var6")

FileWriteLine("c:\temp\out.txt",$var6)

ControlClick("windowname", "TextInWindow", "&Exit")

ControlClick("windowname", "TextInWindow", "&Yes")

Share this post


Link to post
Share on other sites



Similar questions have been asked in the past but I can't seem to get anything to work so I'm finally going to ask for help.

...
WinWait("windowname")
sleep(5000)
...
I'd assume, without a session there is *NO* GUI, so there can't be a window...

Autoit scripts without GUI interactions can be runned fine without an active logon session.

So you might want to check, if you can handle what you need without GUI windows. Think about spool files, e.g.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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  
Followers 0