AutoIt shortcut-> HotKeySet

Source: Internet
Author: User
AutoIt shortcut-> HotKeySet

You can customize shortcut keys when using AutoIt to compile GUI programs. You can usually use the following code:

 1 ; FILENAME HotKeySetDemo01.au3
2 ; PURPOSE: Hotkey demo
3 ; CREATED BY: @kysnail at
4 ; NOTE:
5 ;
6 ;
7 ; RESOURCE:
8 ;
9 ;
10 ; Press Esc to terminate script, Pause/Break to "pause"
11
12 ; Flag variable 'start/pause' the script
13 Global $Paused
14 ; Win Key + XXX
15 HotKeySet("#o", "WinHotKey")
16 ; CONTROL + ALT + XXX
17 HotKeySet("^!a", "CtlAltHotkey")
18 ; ALT + SHIFT + XXX
19 HotKeySet("!+a", "ShiAltHotKey")
20 ; {ESC}
21 HotKeySet("{ESC}", "Terminate")
22 ; {DOWN} -> Move down a menu
23 HotKeySet("{DOWN}", "MoveDownMenu")
24 ; Toggle the state
25 HotKeySet("{PAUSE}", "TogglePause")
26
27 ;;;; Body of program would go here ;;;;
28 While 1
29 Sleep(100)
30 WEnd
31 ;;;;;;;;
32
33 Func TogglePause()
34 $Paused = Not $Paused
35 While $Paused
36 Sleep(100)
37 ToolTip('Script is "Paused"', 2)
38 WEnd
39 ToolTip("")
40 EndFunc ;==>TogglePause
41
42 ; Terminate the demo
43 Func Terminate()
44 Exit 0
45 EndFunc ;==>Terminate
46
47 ; Move down a menu
48 Func MoveDownMenu()
49 MsgBox(4096, "MoveDownMenu Function", "You just move down a menu!")
50 EndFunc ;==>ShowMessage
51
52 ; Window Key + Key
53 Func WinHotKey()
54 MsgBox(0, "WinHotKey Function", "Actived by 'Win Key'")
55 EndFunc
56
57 ; Control + Alt + Key
58 Func CtlAltHotkey()
59 MsgBox(0, "CtlAltHotKey Function", "Actived by 'Ctrl + Alt + a'")
60 EndFunc ;==>CtlAltHotKey
61
62 ; Shift + Alt + Key
63 Func ShiAltHotKey()
64 MsgBox(0, "ShiAltHotKey Function", "Actived by 'Shift + Alt + a")
65 EndFunc

 

The HotKeySet function is described as follows:

Sets a hotkey that calla user function.

HotKeySet ("key" [, "function"])

According to the definition description, HotKeySet is mainly used to quickly set user-defined functions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.