Jump to content

HotKeySet Issue


Recommended Posts

So I've looked at the help file and it doesn't seem to mention anything about this, but maybe I'm missing something.
I'm trying to use code like this...

HotKeySet("{ALT}{F9}", "MyExit")

While True
    ; Do stuff here... not important
    Sleep(100)
WEnd

Func MyExit()
    ConsoleWrite("MyExit called")
    Exit
EndFunc

But when I press Alt + F9 nothing happens. However, this code works...

HotKeySet("!{F9}", "MyExit")

While True
    ; Do stuff here... not important
    Sleep(100)
WEnd

Func MyExit()
    ConsoleWrite("MyExit called")
    Exit
EndFunc

(Note: the only difference is ! instead of {ALT})
Is this expected behavior? I just find the code easier to read when not using !^+ instead of {ALT}{CTRL} and {SHIFT} :)
The help for Send() seems to indicate that {ALT} is valid in it's table

Edit: Forgot to mention, running AutoIt Version 3.3.14.5

Edited by seadoggie01

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

  • Moderators

seadoggie0,

HotKeySet can only work on one key, possibly with one or more of the Shft/Ctrl/Alt/Windows modifier keys. The {ALT} keyword is used to define the Alt key itself - so your first attempt will not work as you are trying to use 2 keys - one of which cannot be used as it is one of the modifiers (as explained in the Help file).

Your second attempt is syntactically correct and so will work as expected.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Melba23 changed the title to HotKeySet Issue

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...