rejetto forum

Firing an event on macro completion

newbie · 6 · 1531

0 Members and 1 Guest are viewing this topic.

Offline newbie

  • Occasional poster
  • *
    • Posts: 27
    • View Profile
I would like to fire an event to do something (for e.g run exec) when a template script in my DiffTemplates finishes successfully.

For e.g: when exec |myprog.exe| runs and produces a file.ext, then fire an event that will then call another exec to do something with the file.
ie the appearance of the file constitutes an event, upon which some other process works on that file.

I looked at this https://rejetto.com/wiki/index.php?title=HFS:_Event_scripts#Other_events and searched in the forum, but it isnt clear to me how I can fire up my own event and watch for it.

I would really appreciate any help.

Thanks.



Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1986
    • View Profile
you can probably include an msdos command file to perform all operations so they will be executed in the correct order



Offline newbie

  • Occasional poster
  • *
    • Posts: 27
    • View Profile
Thanks for your response.

Ah. ok. I think I understand.
Actually, if myprog.exe is writing out the file, it can call the 2nd process to work on that file. :)
Sometimes, one tends to overthink things.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13271
    • View Profile
hi! events in HFS were introduced to execute scripts when something happens.
In your case it's a script that will cause another script to be executed, so events are not needed.
To call a script from another script you have at least 2 ways

- you put the script inside a section, for example [MySection] and then to execute it you will use {.$MySection.}

- you put the script inside a variable/function, using {.set|MyScript|{: *******  :}.} and then to execute it you will use {.^MyScript.}


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13271
    • View Profile
do you already know the {.exec.} command ?
if you use the "out" parameter i'm pretty sure it will wait for the execution to complete,
then you may use the {.exists.} command


Offline newbie

  • Occasional poster
  • *
    • Posts: 27
    • View Profile
Those are excellent pointers Rejetto. Thanks for your comments. I didnt know about the MySection technique, but I knew about exec and output.
Either of those will work. I am good here.