Jump to content

Recommended Posts

Posted

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?

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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

Posted

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.

Posted

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.

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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

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
×
×
  • Create New...