Jump to content

Recommended Posts

Posted

Hello,

I would like to know, if there is a way to terminate a script, if it has been paused. I made a script 4-5 years ago, where pressing CTRL-ALT-DELETE wouldn't allow the script to continue, but this is no longer the case.

Is there a way to terminate a script if CTRL-ALT-DELETE has been pressed?

Posted (edited)

A paused script does not run.  That's my theory on it anyways.

Using a second unpaused script, you could monitor the heartbeat of the first script.  If the heart is beating; it is not paused.

I would check for CTRL, ALT, DELETE with _IsPressed()

Edited by Xandy
Posted
Ctrl+Alt+Delete :  It is reserved by Windows

You cannot intercept that key.

3 hours ago, Xandy said:

I would check for CTRL, ALT, DELETE with _IsPressed()

Won't work because Windows will take over.

Just set a HotkeySet of whatever key you like...

Posted

I do not wish to intercept, interfere or stop CTRL-ALT-DELETE. I just want the script to terminate or cancel if it's been pressed. 

Is it possible to terminate the script if a mouse click or mouse movement is detected? 

Posted

of course, but your "problem" is way TOO evasive  to give you a correct answer, start with a detailed explanation of your needs, what you exactly want to achieve, a current example of your script that doesnt work, and then we will help you

Posted (edited)

You can absolutely detect [CTRL, ALT, DELETE] with _IsPressed().

#include <Misc.au3>
While Sleep(10)
    If _IsPressed(11) And _IsPressed(12) Then; CTRL, ALT
        If _IsPressed('2E') Then; DEL
            Beep()
        EndIf
    EndIf
WEnd

If you want to monitor when a script is paused give it a heart beat signal.  When it's paused the signal will stop.  Other script can end the paused script when signal stops.

Edited by Xandy
Posted

I am working on a login script, that uses parameters to detect which login to use. I have used BlockInput, but if you click CTRL-ALT-DELETE, you cancel BlockInput and can click anywhere. If you do this, the script can start writing the password in the incorrect field. That's why I need a way to cancel the script. I will try with IsPressed, but I don't think it works in conjunction with BlockInput. 

Posted (edited)

I finally solved this, by using some kind of while loop with _BlockInputEx

This at the start

#include <BlockInputEx.au3>
HotKeySet("{ESC}", "_Quit")

_BlockInputEx:

_BlockInputEx(1, "{ESC}")

and this at the end

While 1
   Sleep(100)
WEnd

Func _Quit()
   Exit
EndFunc

Exit

 

This keeps BlockInputEx running, which keeps inputs blocked, even if you use CTRL-ALT-DELETE. Absolutely amazing. Pressing ESC terminates the script!

Thanks for the assistance in here, it gave me inspiration!

Edited by Gidiyorsun
Added _BlockInputEx(1, "{ESC}")

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...