The virtual key code can be found in the _IsPressed function.
And using Yashied's _WinAPI_MapVirtualKey function you can find the scan key code.
The example shows with F13 as a hot key Send("{F13}") will trigger that hot key.
Looking at _IsPressed Remarks, you will find the virtual key codes for F13 to F24.
;#Include "APIConstants.au3"
;#Include "WinAPIEx.au3"
HotKeySet("{F13}", "ImagineryKey")
; From _IsPressed Function "0x7C" is virtual key code for F13 key.
ConsoleWrite('Virtual-key code F13: 0x' & Hex(0x7C) & @CR)
ConsoleWrite('Scan code F13: 0x' & Hex(_WinAPI_MapVirtualKey(0x7C, 0)) & @CR); $MAPVK_VK_TO_VSC = 0
ConsoleWrite("----------------------------" & @LF)
; From _IsPressed Function "0x14" is virtual key code for CAPS LOCK key.
ConsoleWrite('Virtual-key code CAPS LOCK key: 0x' & Hex(0x14) & @CR)
ConsoleWrite('Scan code CAPS LOCK key: 0x' & Hex(_WinAPI_MapVirtualKey(0x14, 0)) & @CR) ; $MAPVK_VK_TO_VSC = 0
Send("{F13}")
Func ImagineryKey()
ConsoleWrite("{F13} key pressed" & @LF)
EndFunc ;==>ImagineryKey
; Copied from http://www.autoitscript.com/forum/topic/98712-winapiex-udf/page__st__280#entry930607
; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_MapVirtualKey
; Description....: Translates a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code.
; Syntax.........: _WinAPI_MapVirtualKey ( $iCode, $iType )
; Parameters.....: $iCode - The virtual key code or scan code for a key. How this value is interpreted depends on the $iType parameter.
; $iType - The translation to be performed. This value depends on the value of the $iCode parameter and can be
; one of the following values.
;
; $MAPVK_VK_TO_CHAR
; $MAPVK_VK_TO_VSC
; $MAPVK_VSC_TO_VK
; $MAPVK_VSC_TO_VK_EX
;
; Return values..: Success - A scan code, a virtual-key code, or a character value, depending on the above parameters.
; Failure - 0 and sets the @error flag to non-zero.
; Author.........: Yashied
; Modified.......:
; Remarks........: An application can use _WinAPI_MapVirtualKey() to translate scan codes to the virtual-key code constants
; $VK_SHIFT, $VK_CONTROL, and $VK_MENU, and vice versa. These translations do not distinguish between the left and
; right instances of the SHIFT, CTRL, or ALT keys.
;
; An application can get the scan code corresponding to the left or right instance of one of these keys by calling
; _WinAPI_MapVirtualKey() with uCode set to one of the following virtual-key code constants.
;
; $VK_LSHIFT
; $VK_RSHIFT
; $VK_LCONTROL
; $VK_RCONTROL
; $VK_LMENU
; $VK_RMENU
;
; Related........:
; Link...........: @@MsdnLink@@ MapVirtualKey
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_MapVirtualKey($iCode, $iType)
Local $Ret = DllCall('user32.dll', 'uint', 'MapVirtualKeyW', 'uint', $iCode, 'uint', $iType)
If (@error) Or (Not $Ret[0]) Then
Return SetError(1, 0, 0)
EndIf
Return $Ret[0]
EndFunc ;==>_WinAPI_MapVirtualKey
#cs
Output at console:-
Virtual-key code F13: 0x0000007C
Scan code F13: 0x0000000000000064
----------------------------
Virtual-key code CAPS LOCK key: 0x00000014
Scan code CAPS LOCK key: 0x000000000000003A
{F13} key pressed
#ce