Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multi triggers (window active AND keypress)
#1
I am trying to make simple multi trigger macro, which starts on the following conditions:
- when notepad is active
AND
- when [CONTROL] + [LEFT MOUSE CLICK]

If the above conditions are met then:
start a menu ("test_menu")

There is a "multi trigger" button but it runs the the attached macro and skips the second trigger.

To be more clear, I have a menu called "test_menu":

Menu test_menu
Trigger #CL 0x8     Help - how to add the trigger to the macro
Code:
Copy      Help
text abc :key "some text abc"
text def :key "some text def"

The code above triggers on: [CONTROL] + [LEFT MOUSE CLICK]

But I used the "multi-trigger" button to add a macro which runs the above "test_menu" but only when a notepad window is active.

Macro trigger2_test_menu
Trigger !a"Untitled - Notepad" "Notepad"     Help - how to add the trigger to the macro
Code:
Copy      Help
;/test_menu
int hwnd=val(_command)

When I switch to notepad, it immediately runs the macro "test_menu".
But I only want it to run when the [CONTROL] + [LEFT MOUSE CLICK] is clicked within notepad.

What am I doing wrong? (Or is there another way I must approach this?)
#2
The multi-trigger button makes OR, not AND.

Assign a filter function to the keyboard trigger: In Properties click FF, Copy, choose FFT_Window, OK OK. It creates new filter function. Edit it to match your window.
#3
That worked!!
Thanks!!

Final question

I am trying to make a 'search-replace-filter' that makes a string 'windows-folder-name-friendly'.
What I mean is, that the string can be used in a windows folder-name.
So I remove unwanted characters like " ^ " , " ' " , " ; " etc...
And only replace ":" with "-"

Is there a more effective way than I have shown beneath.

Macro Macro2
Code:
Copy      Help
str folder="test**:foldername"

folder.findreplace("*" "" 8)
folder.findreplace("^" "" 8)
folder.findreplace(":" "-" 8)
;etc...
out folder
#4
Macro Macro1841
Code:
Copy      Help
str folder="test**^';:foldername"

folder.replacerx("[\*\^\'\;]")
folder.findreplace(":" "-")
out folder

or
Macro Macro1841
Code:
Copy      Help
str folder="test**^';:foldername"

folder.replacerx("[\Q*;'^\E]") ;;put all the characters between [\Q and \E]
folder.findreplace(":" "-")
out folder
#5
THANK YOU!!!!!!


Forum Jump:


Users browsing this thread: 2 Guest(s)