Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Register hotkey though variable (not working correctly)
#1
I am having problems with my .exe code that registers hotkeys.

From my code:

Assuming I want CTRL+SHIFT+F5 to be registered intger: 884

Function clipmate_extension_RegHk
Code:
Copy      Help
ARRAY(int)- all_hk ;; COMES FROM TEXTFILE (CONVERTED TO 'INT')
ARRAY(__RegisterHotKey)- hk
for i 0 all_hk.len
,vk=all_hk[i]&255 ;; vk
,mod=all_hk[i]>>8 ;;mod
,t_hk=mod<<8|vk
,if(!hk[i].Register(hDlg i mod vk)) ;; 'MOD' IS NOT CORRECT (884 YIELDS MOD: '3', SHOULD BE 6? (MOD_CONTROL|MOD_SHIFT))
,,err_register_hk[]=i

The problem is, is that the key modifiers are not correctly present in container mod (code above).
I did an output of "MOD_CONTROL|MOD_SHIFT" and it outputs: 6 (which should be the correct contents for 'mod' if using CTRL + SHIFT)
But my code (above) contains '3' when trying to register CTRL+SHIFT+F5.

Below in the code is how I set/retrieve HK (hotkey) variables/containers, below 'mod' contains '3'.
I need mod to be extracted in this format MOD_CONTROL|MOD_SHIFT which has a value of '6'.
These integers (884) are originally saved in a textfile and extracted from there and then converted to an integer and then put in an integer based ARRAY. (in code above: ARRAY(int)- all_hk)

Macro Macro28
Code:
Copy      Help
str human_readable
int vk mod

;; declare
int t_hk=884 ;;  Ctrl+Shift+F5
out F"t_hk DECLARED: {t_hk}"

;;___________________

vk=t_hk&255 ;; vk
mod=t_hk>>8 ;;mod
out F"vk RETRIEVED (t_hk&255) : {vk}"
out F"mod RETRIEVED (t_hk>>8): {mod}"

;;___________________

;; retrieve 't_hk' through 'vk' and 'mod'
t_hk=mod<<8|vk
out F"t_hk RETRIEVED (t_hk=mod<<8|vk): {t_hk}"

;;___________________

;; translate vk AND mod into human readable string
FormatKeyString vk mod &human_readable

out F"HUMAN READABLE: {human_readable}"
#2
to swap bits 1 and 4
Macro Macro2462
Code:
Copy      Help
int m=3
m=(m~5)|(m>>2&1)|(m<<2&4)
out m
#3
okay!
Thank you!!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)