Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generate exe files, unable to respond to trigger hotkey
#43
kyjdp Wrote:Using the following code, I can run successfully, Thank you very much Smile Smile

Macro Macro1
Code:
Copy      Help
run "$desktop$\day.txt"

WaitForHotkey "CF10" ;;Ctrl+F10

key "this txet will to day.txt"


Function WaitForHotkey
Code:
Copy      Help
;/
function $qmKeyCode

;Temporariy registers a hotkey and waits for it.

;qmKeyCode - QM <help>key</help> codes.

;EXAMPLE
;WaitForHotkey (`s)"Cj" ;;Ctrl+j


int i k vk mod
rep
,i=QmKeyCodeToVK(qmKeyCode k)
,if(i=0) break
,qmKeyCode+i
,sel k
,,case VK_CONTROL mod|MOD_CONTROL
,,case VK_SHIFT mod|MOD_SHIFT
,,case VK_MENU mod|MOD_ALT
,,case VK_LWIN mod|MOD_WIN
,,case else vk=k
if(vk=0) end "no key"

__RegisterHotKey hk
if(!hk.Register(0 45227 mod vk)) end "failed to register the hotkey, probably it is taken be some other application or Windows"

rep
,MSG m; if(GetMessage(&m 0 0 0)<1) end
,if(m.message==WM_HOTKEY and m.wParam=45227) ret
,DispatchMessage &m

Can I write a user-defined function to the system folder and become a QM built-in function? Confusedhock:


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)