Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
shortcutinfo: hotkey => si.hotkey (low / high order byte)
#1
If I use the SHORTCUTINFO (function/class) like this:

Macro Macro16
Code:
Copy      Help
str shortcut="x:\path\to\file.lnk"
SHORTCUTINFO si
GetShortcutInfoEx(shortcut &si)

out si.hotkey ;; 'CTRL' + 'SHIFT' + 'ALT' + 'END': 3875

I can retrieve the shortcut's "si.hotkey", but it retrieves an integer value.

So if the shortcut is: CTRL + SHIFT + ALT + END
The output of "si.hotkey" is: 3875

From the helpfile:

Quote:hotkey - hot key.
The low-order byte is virtual-key code.
The high-order byte is combination of flags HOTKEYF_ALT, HOTKEYF_CONTROL, HOTKEYF_SHIFT, HOTKEYF_EXT.

I understand some of the LOW and HIGH order byte part but I do not understand how to do the following:
In my example the shortcut uses the hot-key CTRL + SHIFT + ALT + END but I want to replace it with: CTRL + F1.

How can I do this? (and how do I translate the integer "si.hotkey" to key codes or VK codes?)
#2
Macro Macro2130
Code:
Copy      Help
SHORTCUTINFO si.hotkey=3875
;outx si.hotkey

;get virtual-key code and modifier keys
int vk=si.hotkey&0xff
int mod=si.hotkey>>8

;display
_s=""; FormatKeyString vk mod &_s; out _s
;if(mod&HOTKEYF_CONTROL) out "Control"
;if(mod&HOTKEYF_SHIFT) out "Shift"
;if(mod&HOTKEYF_ALT) out "Alt"

;replace mod
mod=HOTKEYF_CONTROL
;or remove some mod keys
;mod~(HOTKEYF_SHIFT|HOTKEYF_ALT)

;change virtual-key code
vk=VK_F1
;or use QM key code
;QmKeyCodeToVK "F1" &vk

;display
_s=""; FormatKeyString vk mod &_s; out _s

;make word
si.hotkey=mod<<8|vk
;outx si.hotkey
#3
THANK YOU!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)