Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Generate exe files, unable to respond to trigger hotkey
#31
The API documentation says that F12 is "reserved for use by the debugger at all times". Probably Shift+F12 too. But Ctrl+Shift+F12 works.

__RegisterHotKey hk3
if(!hk3.Register(0 3 MOD_SHIFT VK_F12)) mes- "This hotkey is already registered by another application." "" "x"
#32
You are right, thank you very much Smile

The following post, the use of global hot keys and dialog boxes, definition AutoText, for beginners are very friendly, I hope to add this feature in the new version

How Define AutoText for Multiple Lines of Code
#33
If I want to set up a third hotkey (CTRCL + j) How do I write code?
The following code reports an error :oops:

Macro Macro4
Code:
Copy      Help
__RegisterHotKey hk1.Register(0 1 MOD_CONTROL VK_F10)
__RegisterHotKey hk2.Register(0 2 MOD_CONTROL VK_F11)
__RegisterHotKey hk3.Register(0 3 MOD_CONTROL j)
#34
'J'
#35
Press CTRL + j does not work, the taskbar on the QM icon, is pink

Macro Macro4
Code:
Copy      Help
__RegisterHotKey hk1.Register(0 1 MOD_CONTROL VK_F10)
__RegisterHotKey hk2.Register(0 2 MOD_CONTROL VK_F11)
__RegisterHotKey hk3.Register(0 3 MOD_CONTROL 'j')
MSG m
rep
,if(GetMessage(&m 0 0 0)<1) break
,sel m.message
,,case WM_HOTKEY
,,sel m.wParam
,,,case 1
,,,mac "sub.no1"
,,,
,,,case 2
,,,mac "sub.no2"
,,,
,,,case 3
,,,ret
,,,
,DispatchMessage &m

#sub no1
mes "NO1"

#sub no2
mes "NO2"
;BEGIN PROJECT
;main_function  Macro4
;exe_file  $my qm$\Macro4.exe
;icon  <default>
;manifest  $qm$\default.exe.manifest
;flags  6
;guid  {303436AC-30B2-48DD-BB01-E05114B75FFC}
;END PROJECT
#36
You are right, I wrote J to j, thank you very much :lol:
#37
Macro Macro5
Code:
Copy      Help
run "$desktop$\day.txt"


How to write code to achieve: The above file opens, only when I (Ctrl + j) hotkey, the following command can be executed, otherwise, wait for me to press :)


key "this txet will to day.txt"
#38
Function WaitForHotkey
Code:
Copy      Help
;/
function $qmKeyCode

;Temporariy registers a hotkey and waits for it.

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

;EXAMPLE
;WaitForHotkey "CF10" ;;Ctrl+F10


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
#39
How to call this user-defined function? How to write code to the second line of the location
Just learning programming, not too understand :oops:
thank you very much


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

wait 0 K "CF10"

key "this txet will to day.txt"
#40
Like in EXAMPLE.
#41
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
#42
I hope to achieve in a future version, without defining the function, can directly wait for the combination of hotkey Tongue
#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:
#44
No, System is read-only.
#45
I defined a sub-process, and then repeat the implementation of 10 sub-process, run-time error: window not found, but a separate test sub-process is normal, Where is the problem? Confusedhock:

Macro Macro3
Code:
Copy      Help
rep 10
,sub.note



#sub note
run "notepad"
int w1=act(win("- Notepad" "Notepad"))
lef 83 46 w1 1
'"test"
#46
Like in all functions, default speed (spe) in sub-functions is 0.

Add
spe -1

Also nee to wait for window, now the code is too unreliable.
#47
Added wait, or the prompt window is not found, however, the direct run subroutine can be run


Attached Files Image(s)
   
#48
This is OK, but in the above sub-process, the operation is unsuccessful


Attached Files Image(s)
   
#49
Gintaras Wrote:Like in all functions, default speed (spe) in sub-functions is 0.

Add
spe -1

Also nee to wait for window, now the code is too unreliable.

Suggest:
In the Wait for dialog box, add an option to wait for the hotkey, such as the picture below Smile


Attached Files Image(s)
   
#50
Generated exe file, can i set a hotkey to let exe file temporarily stop? Tongue
#51
Difficult. QM does not have a "pause" function.
#52
Hello,
I have encountered a situation, using the above method, can not wait for the window Thanks in advance Smile

I found that each step of the window title is the same, but the text in the window is not the same, I can use the text in each window to distinguish the window? How to write code? Any suggestions are welcome Tongue

Software installation of the recording, have the same problem: the window title is the same, always in the playback can not find the window, hoping to have an office to solve this problem

Video operation demonstration:
https://youtu.be/yQ64a06ynC0

Software download address:
https://chmeditor.com/

Macro Macro1
Trigger SF9     Help - how to add the trigger to the macro
Code:
Copy      Help
spe 500
#region Recorded 2/19/2017 8:41:35 AM
;int w1=win("Program Manager" "Progman")
;dou 192 131 w1 1 ;;list 'Desktop', list item 'chmeditor-demo-3.1.0-setup'
;int w2=wait(15 win("Open File - Security Warning" "#32770"))
;lef 258 149 w2 1 ;;push button 'Run'
run "$desktop$\chmeditor-demo-3.1.0-setup.exe"
int w3=wait(16 win("CHM Editor Demo Setup" "#32770"))
lef 355 344 w3 1 ;;push button 'Next >'
wait 30 WT w3 "CHM Editor Demo Setup "
lef 356 335 w3 1 ;;push button 'I Agree'
lef 352 340 w3 1 ;;push button 'Install'

wait 5 -WV w3
int w4=wait(17 win("Open File - Security Warning" "#32770"))

lef 188 155 w4 1 ;;check box 'Run CHM Editor Demo'
lef 361 340 w4 1 ;;push button 'Finish'
#endregion
#53
The recorder is not good when recording setup process. In this case need to insert command "wait for check box 'Run CHM Editor Demo' ". Look in floating toolbar, use dialog Wait, or Find Accessible Object, or Find Image.
#54
Thank you very much, use the following code, successfully get Smile

Macro Macro1
Trigger SF9     Help - how to add the trigger to the macro
Code:
Copy      Help
spe 500
#region Recorded 2/19/2017 8:41:35 AM
;int w1=win("Program Manager" "Progman")
;dou 192 131 w1 1 ;;list 'Desktop', list item 'chmeditor-demo-3.1.0-setup'
;int w2=wait(15 win("Open File - Security Warning" "#32770"))
;lef 258 149 w2 1 ;;push button 'Run'
run "$desktop$\setup.exe"
int w3=wait(16 win("CHM Editor Demo Setup" "#32770"))
lef 355 344 w3 1 ;;push button 'Next >'
wait 30 WT w3 "CHM Editor Demo Setup "
lef 356 335 w3 1 ;;push button 'I Agree'
lef 352 340 w3 1 ;;push button 'Install'

int w=win("CHM Editor Demo Setup " "#32770")
int w1=wait(0 WA id(1203 w)) ;;check box 'Run CHM Editor Demo'
int w2=win("CHM Editor Demo Setup " "#32770")
lef 7 8 id(1203 w2) 1 ;;check box 'Run CHM Editor Demo'
int w4=win("CHM Editor Demo Setup " "#32770")
lef 38 10 id(1 w4) 1 ;;push button 'Finish'
#endregion


Forum Jump:


Users browsing this thread: 1 Guest(s)