Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Different title or class
#1
1) How can we make a particular macro (regular macro or tsmenu - like Win+F) do something in a windowtitle "Caption" and different in titled "Save as" and diff in " * SOMETHING .. - Notepad++".

..

I Saw - this Filterfunction example but dont know what exactly does it mean in some cases -

Code:
Copy      Help
function# iid FILTER&f
sel wintest(f.hwnd "Window1[]Window2[]Window3" "" "" 16)
    case 1 ret "Macro1"
    case 2 ret "Macro2"
    case 3 ret "Macro3"

AND

Code:
Copy      Help
/
function# iid FILTER&f
sel wintest(f.hwnd "Notepad[]Internet Explorer" "" "" 16)
    case 1 ret "M1"
    case 2 ret "M2"

2) What I want to be sure of is -
By Window1 - Does it mean title ?
And if its TITLE - then can we also specify for CLASS ?


Thanks.
#2
Why don't use several macros with different trigger?

If need single macro, will need to set trigger that matches multiple windows. For example use a regular expression.

Maybe don't need a filter function. Can use similar code (wintest) in macro.

In your examples, "Window1" etc are window names. If class of these windows is different, don't use class with wintest, or use multiple wintest, for each window. Example:

Macro Macro1861
Code:
Copy      Help
int hwnd=TriggerWindow
if wintest(hwnd "name1" "class1")
,out 1
else if wintest(hwnd "name2" "class2")
,out 2
;...
#3
Hello,
Couldnt come earlier.

However I tried this macro, just to experiment -

Code:
Copy      Help
int hwnd=TriggerWindow
if wintest(hwnd "new file - metapad" "metapad")
"THIS IS METAPAD"
else if wintest(hwnd "Untitled - Notepad2-mod" "Notepad2")
"HELLO NOTEPAD2"
;...

And the trigger is Ctrl+Shift+k

I got the error -

Error in 15-02 TRY: empty block. Did you forget to tab-indent following lines?.

What can be the fault ?
#4
Hello

indentation maybe.

Try something like :

int hwnd=TriggerWindow
if wintest(hwnd "new file - metapad" "metapad")
______out "THIS IS METAPAD" <------------------------------- (type TAB to produce the undescores on new line. In QM, if... statements must be indented if not on the same line as the if condition test)
else if wintest(hwnd "Untitled - Notepad2-mod" "Notepad2") out "HELLO NOTEPAD2"

Highlight if word in editor, hit F1 and look for examples.

I did not test my correction as i don't have the same functions. But the idea is there

HTH. Regards


Forum Jump:


Users browsing this thread: 1 Guest(s)