Custom Trigger behaviour

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Semper
Junior Coder
Posts: 30
Joined: Mon Feb 25, 2008 3:28 pm

Custom Trigger behaviour

Post by Semper » Wed May 15, 2013 12:39 pm

Hi

I'm using a custom trigger from the help page

Code: Select all

SRT>Trigger
 IfWindowOpen>Calculator
   Let>MACRO_RESULT=TRUE
 Else
   Let>MACRO_RESULT=FALSE
 Endif
END>Trigger
 
SRT>Reset
 IfWindowOpen>Calculator
   Let>MACRO_RESULT=FALSE
 Else
   Let>MACRO_RESULT=TRUE
 Endif
END>Reset
Then write a simple macro

Code: Select all

MessageModal>Found
and assigning the custom trigger to it.

When starting the Calculator the Found box is shown (trigger succesfuly recognized the window)

Then I close the Calculator, and start it again, but the MessageModal>Found does not show anymore.

Is this normal behaviour?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon May 20, 2013 2:36 pm

It is possible the trigger is matching against some other window. Try restricting the window type by adding the following at the top:

//no child windows
Let>WF_TYPE=0

See the SetFocus command in the help file for other WF_TYPE values.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Semper
Junior Coder
Posts: 30
Joined: Mon Feb 25, 2008 3:28 pm

Post by Semper » Tue May 21, 2013 1:48 pm

Restricting to child windows is good, thanks.

But for this example it was not neccesary, I was starting Calculator too fast, after i closed it.

I found that several seconds (10 or more) needs to pass after i can open calculator and the trigger to recognize the window and fire the macro again.
Is that suposse to work like that?

Another thing bugs me, after closing MS, and starting it again, the trigger does not work, unless i first start ANY macro.

Semper
Junior Coder
Posts: 30
Joined: Mon Feb 25, 2008 3:28 pm

Post by Semper » Wed May 29, 2013 7:51 am

I need to make an important script at work with custom trigger
so i would need to know how to deal with these two issues.

Can anyone help please?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed May 29, 2013 7:56 am

Hi,

We're investigating some issues with triggers right now. Not sure if this is the cause of your problem but you may want to wait for the next maintenance release.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts