thrifty007 Posted June 7, 2017 Share Posted June 7, 2017 I have a script that tested fine as a .au3 file. I compiled it as a .exe for x86 and the send function in the script will not work. The window closes and restores still. I am running AutoIT v3.3.14.2 and the software is installed on Microsoft Windows Embedded POSReady 2009 version 2.0 Service Pack 3. The script is below. HQClientConnect() Func HQClientConnect() Local $iState = WinGetState("[Headquarters Client") If BitAND($iState, 2) Then Send("C:\Program Files\Microsoft Retail Management System\Headquarters Client\HQClient.exe{F5}") WinClose("[CLASS:ThunderRT6FormDC]") Else WinSetState("[CLASS:ThunderRT6FormDC]", "", @SW_RESTORE) WinWait ("[CLASS:ThunderRT6FormDC]", "", 2) Send("C:\Program Files\Microsoft Retail Management System\Headquarters Client\HQClient.exe{F5}") WinClose("[CLASS:ThunderRT6FormDC]") EndIf EndFunc Please advise. Thank you! Link to comment Share on other sites More sharing options...
thrifty007 Posted June 7, 2017 Author Share Posted June 7, 2017 19 minutes ago, thrifty007 said: I have a script that tested fine as a .au3 file. I compiled it as a .exe for x86 and the send function in the script will not work. The window closes and restores still. I am running AutoIT v3.3.14.2 and the software is installed on Microsoft Windows Embedded POSReady 2009 version 2.0 Service Pack 3. The script is below. HQClientConnect() Func HQClientConnect() Local $hWnd = WinWait("[CLASS:ThunderRT6FormDC]", "", 3) Local $iState = WinGetState($hWnd) If BitAND($iState, 2) Then Send("$hWnd{F5}") Else WinSetState("Headquarters Client", "", @SW_RESTORE) Send("$hWnd{F5}") EndIf WinClose("[CLASS:ThunderRT6FormDC]") EndFunc Please advise. Thank you! Link to comment Share on other sites More sharing options...
thrifty007 Posted June 7, 2017 Author Share Posted June 7, 2017 5 minutes ago, thrifty007 said: The HQConnect.exe won't run properly when double clicked. I also tried running it as Administrator from Right-Click Drop-Down menu and from elevate cmd prompt. However, and this is off, the HQConnect.exe will run if I open the 'Run Script' shortcut and select "Files of type: All files (*.*). I select the HQConnect.exe and it runs as expected. Please Advise... Link to comment Share on other sites More sharing options...
MattHiggs Posted June 8, 2017 Share Posted June 8, 2017 So this line right here: Send("$hWnd{F5}") I assume that is you trying to send "F5" to the Window with the handle assigned to that variable. You are only supposed to input the keys you want the send function to emulate in the send function. The $hWnd variable should not be in there. If that is what you are trying to do, try something like this instead: WinActivate ( $hWnd ) WinWaitActive ( $hWnd ) Send ( "{F5}", 0 ) Also, if the window which you are trying to interact with is running with elevated permissions, the script must be run as such as well in order for it to interact with the Window successfully. You might want to consider putting the following line at the top of your script: #RequireAdmin Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now