Jump to content

Send function + Task Scheduler = not working


drloser
 Share

Recommended Posts

Hi,

I'm working on WinXP Pro. I launch autoit in a scheduled task :

"C:\Program Files\autoit\AutoIt3.exe" myscript.au3

myscript.au3 is very simple :

Run("C:\Program Files\toto.exe")
WinWait("Hello","")
WinActivate("Hello","")
Send("{ENTER}")

All of this is configured on a server. When I'm connected to the server via MSTSC, everything is working fine :

  • The scheduled task launches autoscript
  • autoscript launches toto.exe
  • autoscript activates the window "Hello"
  • autoscript sends the key "ENTER" (which closes the window "Hello")
  • autoscript ends

But if I close MSTSC (I'm still connected), the script is not working anymore :

  • The scheduled task launches autoscript
  • autoscript launches toto.exe
  • ???
  • ???
  • autoscript ends, but the window "Hello" is still opened and the "ENTER" had not been sent.
Edited by drloser
Link to comment
Share on other sites

Quick search on MSTSC reveiled:

Creates connections to terminal servers or other remote computers, edits an existing Remote Desktop Connection (.rdp) configuration file, and migrates Windows XP connections (connections created with Client Connection Manager) to new .rdp files.

so maybe your pc config needs that running to interact with the server.

If you don't mind it running, then maybe a check at the beginning of your script like:

$mstsc=ProcessExists("MSTSC.exe")
If $mstsc=0 Then
    Run(@SystemDir&"\MSTSC.exe")
EndIf

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I'm not sure to understand what you mean.

Everything is running on the server. autoit is launched on the server by the server Tasks Scheduler.

I use mstsc on my client PC in order to connect to the server and configure it, but there's no MSTSC.exe running on the server. Never.

Edited by drloser
Link to comment
Share on other sites

and you need MSTSC running on your pc (not server) for script to work?

Maybe a script on your pc that runs when windows starts to make sure that process is running? Or a scheduled task a couple minutes before the one on the server runs to make sure that exe is running first?

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I don't know much about servers, but that program sounds like a vital part in communication between server and pc. It would be like trying to call your friend from a landline with no telephone lines between, without an alternative method it would be impossible.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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