I have a AutoIt script that I need to start when a RemoteApp session is created.
The script waits for a window to appear and then extracts the text of a certain label and writes it to a file.
I already have this script and it works fine when I run it manually but if I set the script to start through a scheduled task on logon or by group policy it doesn't appear to have access to the windows that appear in the session.
It appears that the process doesn't have interactive access to the session but how would I go about starting it so that it does?
Here's the AutoIt script in question
Local $WindowName = "Infinity Cash Out"
Local $ClientName = EnvGet("CLIENTNAME")
Local $Filename = "S:\Pole\" & $ClientName & ".txt"
While(true)
$hWnd = WinWait("[TITLE:Infinity Cash Out]")
$sText = ControlGetText($hWnd, "", "[NAME:CurrTotal]")
$sText = StringMid($sText, 1, StringInStr($sText, ".") + 2)
$sText = "Total:" & @CRLF & $sText
$file = FileOpen($Filename, 2)
FileWrite($file, $sText)
FileClose($file)
WinWaitClose($hWnd)
$file = FileOpen($Filename, 2)
FileWrite($file, "")
FileClose($file)
WEnd