Jump to content

How to temporarily deactivate script?


 Share

Recommended Posts

I have a script that defines several hotkeys, but also that has a mode where (per the user's request) it disables itself. It issues these two steps, which causes it to suspend operation:

WinSetState($task, "", @SW_DISABLE)
    WinSetState($task, "", @SW_HIDE)

The disabling (and also re-enabling by clicking on the taskbar icon) works fine and the task window disappears, as expected. The problem is that the hotkeys (one of them is the Enter key) are still being "captured" by the task. For example, in trying to run Notepad, the enter key can't be used to form a new paragraph.

Is there some command to suspend the hotkey linkages? The documentation says this:

If you have paused the script by clicking on the AutoIt Tray icon, any hotkeys pressed during this paused state are ignored.

... but I haven't been able to locate a "pause" script step. Or do I have to unregister each hotkey every time the task goes into the suspended state?

Thanks in advance for any help.

Link to comment
Share on other sites

Well, I'm not sure, but I think you will have to deactivate the hotkeys.

Sleep does not affect it, Ibelieve, because it just calls the functions anyway

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

To unset the hotkey for the Enter key, you use this:

HotKeySet( "ENTER")

Without seeing your code, I could suspect that you need to study the use of the tray menus - study the Example in the help file under TrayCreateMenu

Das Häschen benutzt Radar

Link to comment
Share on other sites

To unset the hotkey for the Enter key, you use this: HotKeySet( "ENTER")

Thanks for the response ... but is it HotKeySet( "ENTER") or HotKeySet("{ENTER}")?

Regarding the use of tray menus, I'm actually trying to keep it ultra simple for the user -- click the icon to deactivate; click again to reactivate. Is there some downside or risk to doing it that way?

Link to comment
Share on other sites

You are correct, it is HotKeySet("{ENTER}") - this unsets the Enter key as a hotkey in your script.

As regards the tray - I couldn't tell from your description, just where the problem was except that you needed a way to unset a hotkey or maybe you just needed to provide more options using the tray - more simplicity for the user does not mean simpler code alway.

Post your code if you are having any more problems.

Das Häschen benutzt Radar

Link to comment
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
 Share

  • Recently Browsing   0 members

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