Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Right-click trigger for QM editor
#1
Hi,

I want to create a right-click trigger for the QM editor

When I select some texts, right-click to open the menu Right_SelText

Otherwise, if no text is selected, right-click to open the menu  Right_noSelText

The following filter functions do not work

Thanks in advance for any advice and help
david

Function FF_QM_Editor
Trigger #R     Help - how to add the trigger to the macro
Code:
Copy      Help
;/
function# iid FILTER&f

if(!f.hwnd2) ret -2
if(!wintest(f.hwnd "Quick Macros" "QM_Editor")) ret -2

if(GetWinId(f.hwnd2)=2210)
,_s.getsel
,if _s.len
,,ret "Right_SelText"  
,else
,,ret "Right_noSelText"
,
;,ret iid

ret -2

Menu Right_SelText
 
Code:
Copy      Help
SelText :mes "hello" * findacc.ico

Menu Right_noSelText
 
Code:
Copy      Help
noSelText :mes "hello" * findacc.ico
#2
Function FF_QM_Editor
Trigger #R 0x1 /QM /FF_QM_Editor     Help - how to add the trigger to the macro
Code:
Copy      Help
;/
function# iid FILTER&f

if f.hwnd2=GetQmCodeEditor
,if !SendMessageW(f.hwnd2 SCI.SCI_GETSELECTIONEMPTY 0 0)
,,mac "Right_SelText"
,else
,,mac "Right_noSelText"

ret -2
#3
Thanks for your help

use mac "Right_SelText" It didn't work,

changed to ret "Right_SelText"  it worked, But it jumps, it flashes From the right-click menu

Is there a more general way? I want to use this trigger in Word or PowerShell ISE ...

Strangely, using mac sometimes works(When I press the right button quickly) and sometimes not works
#4
Quote:Is there a more general way? I want to use this trigger in Word or PowerShell ISE ...
No. OS does not have API to detect selection. The only way I know is to try to copy. But it would be insane to copy on every right-click.
#5
I added a function that now works, This seems a little more generic

but the response is slow and there will be an alarm sound

Function FFC_QM_Editor
 
Code:
Copy      Help
;/

function# iid FILTER&f

if(!f.hwnd2) ret -2
if(!wintest(f.hwnd "Quick Macros" "QM_Editor")) ret -2

if(GetWinId(f.hwnd2)=2210) ret iid

ret -2

Function sel_menu
Trigger #R //FFC_QM_Editor     Help - how to add the trigger to the macro
Code:
Copy      Help
_s.getsel
if _s.len
,mac "Right_SelText"
else
,mac "Right_noSelText"

but overrides the right-click comment function


Forum Jump:


Users browsing this thread: 1 Guest(s)