Custom Trigger not working

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
Supertommo
Newbie
Posts: 1
Joined: Fri Aug 01, 2014 10:59 am

Custom Trigger not working

Post by Supertommo » Fri Aug 01, 2014 11:33 am

All

I've created the following custom trigger which is used by a second macro called Test1

Code: Select all

SRT>Trigger
  ReadIniFile>%INI%,UserVariables,SearchDirectory,Directory
  ReadIniFile>%INI%,UserVariables,SearchFileSpec,FileSpec
  GetFileList>%Directory%\%FileSpec%,FileCount
  MessageModal>%FileCount%
  If>%FileCount%>0
    Let>MACRO_RESULT=TRUE
  Else
    Let>MACRO_RESULT=FALSE
  Endif
END>Trigger
SRT>Reset
  ReadIniFile>%INI%,UserVariables,SearchDirectory,Directory
  ReadIniFile>%INI%,UserVariables,SearchFileSpec,FileSpec
  GetFileList>%Directory%\%FileSpec%,FileCount
  If>%FileCount%>0
    Let>MACRO_RESULT=FALSE
  Else
    Let>MACRO_RESULT=TRUE
  Endif
END>Reset
Essentially it should be looking in a directory specified in an INI file for a csv file, however when the trigger runs I get the following error

Error in :
Line: 2 - Ini file in ReadIniFile does not exist.

To get around this I have tried to pass an INI variable in Test1 trigger parameter e.g.

Code: Select all

C:\temp\MJT\bin\FileTrigger.scp /INI=C:\temp\MJT\bin\FileTrigger.ini
If I did this the trigger did not fire

I also created a short cut and changed the short cut parameter to the following to pass the INI parameter

Code: Select all

"C:\Program Files\Macro Scheduler 14\msched.exe" FileTrigger /INI=C:\temp\MJT\bin\FileTrigger.ini
but this returned error

Error in :
Line: 0 - Subroutine/Label Trigger Not Found!

How can I pass an INI file to a trigger?

Thanks

Andy

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

Re: Custom Trigger not working

Post by Marcus Tettmar » Fri Aug 01, 2014 7:53 pm

You can't pass parameters to trigger macros. You'll need to hard code the INI file path in the trigger script.


Sent from my iPad using Tapatalk
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