Jump to content

Issues w/ ControlSend on headless workstation

Recommended Posts


I am having difficulties running a script on a headless workstation. I understand the implications of running scripts on a locked workstation (https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F), but I still can't get this to work. Here is the code I am trying to run:

if WinExists($winName) Then
      DebugOut("exit portfolio trader")
      ControlSend($winName, "", "menuStrip1", "!fe")


      DebugOut("confirm stop auto-trading")
      if WinExists("MultiCharts .NET64", "Do You want to stop portfolio strategy calculation") Then
         ControlSend("MultiCharts .NET64", "Do You want to stop portfolio strategy calculation", "", "y")

      DebugOut("wait for auto-trading to stop")
      Sleep(2 * 60 * 1000)

      DebugOut("confirm file save")
      if WinExists("MultiCharts .NET64", "Portfolio workspace has not been saved") Then
         ControlSend("MultiCharts .NET64", "Portfolio workspace has not been saved", "", "n")

And here is what happens:

  • if I start the script with the remote desktop session open, it works just as expected
  • if I start the script with the remote desktop session closed, nothing happens

What's even more puzzling is the fact that I have a quite similar script running immediately after my workstation boots up, and that script does not have any issues. This is on Windows 10 (1803), and the latest stable AutoIt version (

What am I missing? Any pointers highly appreciated.

Thank you,
best regards,


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