Jump to content
Sign in to follow this  
cyberczar37

Locked PC & graceful close of program (noob)

Recommended Posts

cyberczar37

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?

Share this post


Link to post
Share on other sites
JLogan3o13

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
water

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 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Blue_Drache

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

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
cyberczar37

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.

Share this post


Link to post
Share on other sites
water

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 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Blue_Drache

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

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
Sign in to follow this  

×