cyberczar37 Posted October 25, 2012 Share Posted October 25, 2012 Hi, I am new to AutoIt. I am working on my first script. This is intended to close a program gracefully while a PC is locked. It assumes that the program is at a specific screen. However, I am having problems getting it to work. I receive no syntax error. AutoItSetOption("MouseCoordMode", 0) ControlGetFocus("Program") ControlClick("left",367,355,1) ControlSend("Program", "", "", "{ESC}") ControlSend("Program", "", "", "{ESC}") ControlSend("Program", "", "", "{ESC}") ControlSend("Program", "", "", "{ESC}") ControlClick("left",13,46,1) ControlClick("left",69,253,1) I built the script below to do the same thing when the PC is unlocked. It works fine. AutoItSetOption("MouseCoordMode", 0) WinActivate("Program") MouseClick("left",367,355,1) Send("{ESC}") Send("{ESC}") Send("{ESC}") Send("{ESC}") MouseClick("left",13,46,1) MouseClick("left",69,253,1) Could anyone explain why the script is not working? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 25, 2012 Moderators Share Posted October 25, 2012 You need to look over ControlSend again in the help file. The ControlID is not optional. "", as you have it, will not work for you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
water Posted October 25, 2012 Share Posted October 25, 2012 ControlSend("Program", "", "", "{ESC}")doe not work this way. You have to specify the name/ID of a control as parameter 3. Can you tell us which program you try to close and why it is necessary to close it while the PC is locked? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 25, 2012 Share Posted October 25, 2012 If I recall correctly, AutoIt will not operate as expected, even if at all, if the computer is locked. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
JohnOne Posted October 25, 2012 Share Posted October 25, 2012 AutoIt will work just fine 99% of the time when a PC is locked. Just working with some particular functions will and might fail. For example pixel functions will fail, and some window and control functions will fail, because they can not be the active window. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
cyberczar37 Posted October 25, 2012 Author Share Posted October 25, 2012 Water, I tried multiple controlid parameters, including 3, and it still didn't work. The program is a teller application. It must be gracefully closed at the end of day in order for transactions to be released, even if the teller walks away without closing their application. Unfortunately, I cannot simply kill the process. Link to comment Share on other sites More sharing options...
water Posted October 25, 2012 Share Posted October 25, 2012 You have set the value to 3? What you need to do is run "AutoIt Windows Information Tool" and move the crosshair to the control. On the control tab of the info tool you'll see all kind of info for the control. Use the "ID" or the "Advanced Mode" with function ControlSend. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 25, 2012 Share Posted October 25, 2012 While I appreciate the power of AutoIt, software engineering is no substitute for social engineering. Why not institute and enforce a policy of shutting down one's terminal at the end of shift/day? Once a few people start receiving write-ups for not following policy, the issues will take care of themselves. By all means, continue with the script as a fail-safe; though the method you're attempting to use may not work behind the locked screen. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache 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