JohnTWI 0 Posted January 29, 2020 The following code works fine with active Remote Desk Top: WinActivate ("THRIVE PRODUCTION SERVER - Thrive") Sleep(6000) ControlFocus("THRIVE PRODUCTION SERVER - Thrive", "", "Button1") Sleep(3000) SEND("{LEFT}{ENTER}") Sleep(6000) But does not work when RDP session is locked. Thank you in advance Share this post Link to post Share on other sites
Jos 2,176 Posted January 29, 2020 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
SlackerAl 37 Posted January 30, 2020 You can't Send to a locked system, can you switch that Send to a ControlSend (note, you will need to get the control ID)? Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Share this post Link to post Share on other sites
BigDaddyO 61 Posted January 30, 2020 (edited) running scripts on a remote server from RDP can get complicated really quick if you have to disconnect. This is an option I put out in the Example form, but I would suggest trying to update your script first so it only interacts directly with controls as SlackerAl suggested. There are lots of issues interacting with windows too. If you are able to leave the RDP session open the entire time, and it's just that the server is going to sleep, there are other options to force the server to stay active. Edited January 30, 2020 by BigDaddyO hmm... I guess I have to have a signature... Share this post Link to post Share on other sites
JohnTWI 0 Posted February 4, 2020 Is the Control ID the complete file path? Share this post Link to post Share on other sites
JohnTWI 0 Posted February 4, 2020 (edited) My ControlSend example below: ControlSend("C:/Users/jfSmith/cpsi/edward.cpsinet.com/u03792/data_4/" & $sText,"","","^{F4}" $sText is the file name Edited February 4, 2020 by JohnTWI Share this post Link to post Share on other sites
Zedna 277 Posted February 4, 2020 https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
JohnTWI 0 Posted February 5, 2020 Zedna I am using a ControlSend on my locked workstation, but I am still not getting my desired result. Is the Syntax of my ControlSend correct? Share this post Link to post Share on other sites
Zedna 277 Posted February 5, 2020 Use explicit ClassNameNN parameter instead of empty one because empty one implies control (in target window) with focus but on locked station there is no window/control with focus. Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
JohnTWI 0 Posted February 5, 2020 Zedna I tried this ControlSend("C:/Users/jfsmith/cpsi/edward.cpsinet.com/u03792/data_4/" & $sText,"","[CLASSNN:Edit1]","^{F4}") And it did not work Share this post Link to post Share on other sites
Zedna 277 Posted February 6, 2020 1) are you sure about your window's title? 2) what Ctrl+F4 does? maybe SendMessage + WM_COMMAND can be better solution in this case ... Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
JohnTWI 0 Posted February 6, 2020 Zedna I tried this but it is not working, Func ClosePDF($hWnd, $iOnOff) Local Const $WM_SYSCOMMAND = 274 Local Const $SC_CLOSE = 61808 _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_CLOSE, $iOnOff) If @error Then MsgBox($MB_SYSTEMMODAL, "_ClosePDF", "_SendMessage Error: " & @error) Exit EndIf EndFunc Thanks again for your help. Share this post Link to post Share on other sites
Zedna 277 Posted February 6, 2020 (edited) For SendMessage + WM_COMMAND use Winspector utility to check which message corresponds to your window's (manually invoked) action ... https://www.softpedia.com/get/Security/Security-Related/Winspector.shtml Edited February 6, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
JohnTWI 0 Posted February 6, 2020 Zedna Can you point to an example using SendMessage + WM_COMMAND to close a file or pdf? Thank you Share this post Link to post Share on other sites
Zedna 277 Posted February 6, 2020 (edited) For closing application use WinClose() or WinKill(). WinClose() = PostMessage + WM_CLOSE Edited February 6, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites