Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
middleclick mania
#1
my main middleclick filter:

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


if(wintest(f.hwnd "" "ClassClass" "ppc"))
,mac "ppc_f1"
if(wintest(f.hwnd "Sun Solaris - VMware Workstation" "VMUIFrame" "vmware"))
,mac "vm_solaris_out"
if(wintest(f.hwnd "" "" "PrintScreen"))
,mac "catchget"
if(wintest(f.hwnd "" "" "TwinHanDTV"))
,mac "twinhan_fav"
if(wintest(f.hwnd "DESKBAR" "" "qm"))
,mac "qm_deskbar_middle"
if(wintest(f.hwnd "" "" "thunderbird"))
,mac "thunderbird_middle"
;if(wintest(f.hwnd "" "" "firefox"))
,;mac "firefox_middle"
if(wintest(f.hwnd "" "powerpronote" ""))
,mac "ppro_note_run"
;if(wintest(f.hwnd "" "" "DesktopRuler"))
,;wmin(cla,h)
if(wintest(f.hwnd "" "" "blackbox"))
,if(GetWinId(f.hwnd2)=22)
,,mac "o3tt3rli"
if(wintest(f.hwnd "" "ExploreWClass" "blackbox"))
,explorer_get_file
if(wintest(f.hwnd "" "" "strokeit"))
,if(GetWinId(f.hwnd2)=1011)
,,del_item("strokeit")
,if(GetWinId(f.hwnd2)=1010)
,,qm_paste_macro
if(wintest(f.hwnd "" "" "qm"))
,if(GetWinId(f.hwnd2)=2202)
,,del_item("qm",iid)
,if(GetWinId(f.hwnd2)=2201)
,,ClearOutput
,if(GetWinId(f.hwnd2)=2203)
,,mac "qm_editor_getsel"

mac qm_editor_getsel:
Code:
Copy      Help
_s.getsel

ifi-("QM Help")
,run "$QM$\Qm2help.chm" "qm"

SelectTab(id(1007 "QM Help") 2)
_s=_s; _s.setwintext(id(1001 "QM Help"))
Acc b=acc("" "PUSHBUTTON" win("QM Help" "HH Parent" "hh") "Button" "" 0x1100 52 114)
b.DoDefaultAction

Acc a=acc("" "LISTITEM" "QM Help" "SysListView32" "" 0x1004)

a.Mouse(4)
ifi win("" "#32770" "hh")
,but id(2 win("" "#32770" "hh"))
,men 2013 qm._hwndqm ;;Find ...
,but id(1025 qm._hwndqm);err
,
mou
pi
#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.


Forum Jump:


Users browsing this thread: 3 Guest(s)