Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
middleclick mania
#2
Your function runs for about 2700 microseconds. I have rewritten it, and now it runs for about 38 microseconds.

Code:
Copy      Help
;\
function# iid FILTER&f
;ClearOutput
if(!f.hwnd2) ret -2

;int t1=perf

sel _s.getwinexe(f.hwnd) 1
,case "ppc"
,if(wintest(f.hwnd "" "ClassClass"))
,,mac "ppc_f1"
,
,case "vmware"
,if(wintest(f.hwnd "Sun Solaris - VMware Workstation" "VMUIFrame"))
,,mac "vm_solaris_out"
,
,case "PrintScreen" mac "catchget"
,
,case "TwinHanDTV" mac "twinhan_fav"
,
,case "thunderbird" mac "thunderbird_middle"
,
,case "firefox" mac "firefox_middle"
,
,case "powerproexename"
,if(wintest(f.hwnd "" "powerpronote"))
,,mac "ppro_note_run"
,
,;case "DesktopRuler" wmin(cla,h)
,
,case "blackbox"
,if(GetWinId(f.hwnd2)=22) mac "o3tt3rli"
,;else if(wintest(f.hwnd "" "ExploreWClass")) explorer_get_file
,
,case "strokeit"
,;sel GetWinId(f.hwnd2)
,,;case 1011 del_item("strokeit")
,,;case 1010 qm_paste_macro
,
,case "qm"
,if(wintest(f.hwnd "" "QM_Editor"))
,,sel GetWinId(f.hwnd2)
,,,;case 2202 del_item("qm",iid)
,,,case 2201 ClearOutput
,,,case 2203 mac "qm_editor_getsel"
,else if(wintest(f.hwnd "DESKBAR")) mac "qm_deskbar_middle"
,
,case else ret -2 ;;default action in other programs

;int t2=perf
;out t2-t1

The idea is - run different macros when you click the middle mouse button in different programs, windows and child windows (window parts).

To install this filter function:
1. Click menu File -> New -> Templates -> Filter Functions -> whatever item. Name the new function for example FF_Middle_Click.
2. Click the trigger field on the toolbar, and enter #M //FF_Middle_Click. This assigns middle click trigger to this function, and this filter function to the trigger.
3. Copy the above text and paste it in QM using menu Edit -> Other formats -> Paste escaped.
4. Since this is only a sample, edit the text to match programs and windows that you will use. To apply changes after you edit it, click the Save button.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)