rejetto forum

exec | A | B and wait or pause execution (SOLVED!)

80063r · 10 · 5604

0 Members and 1 Guest are viewing this topic.

Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
What I really need to do is run a command-line exe and pause the template execution until the process is finished.  The process completes in less than half a second.  It is similar to RAWR-Designs thumbnail and preview generator.

There is no console output, but can I capture the exit code?  Something like >1 is failed and 0 means success.
Also, the command line can include /M to show a small dialog box upon completion.

Or, can HFS possibly be updated to include the output of the error code.  Like:

{.exec|filenameAndPath|commandLineParameters|out=#colsoleoutput|code=#errorcode.}

I'm not sure where to ask a question like this.  I searched for "pause execution" and found no results.

Also, if you can give advice on this, I only want the process run if the picturename_tn.jpg file does not exist in the /thumbs subfolder.  I've been working on this only for a few hours, so given time I may be able to figure it out myself.  I may have to make my own thumbnail generator which I could do.

Thanks in advance for any advice.
« Last Edit: May 29, 2009, 04:49:00 AM by 80063r »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
i think that using the "out" parameter it should wait for the process to complete, or it could not give you the output!


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
next version will have "timeout" parameter for {.exec.}


Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
Quote
...the out parameter...

This program, EasyThumbs or ezthumbs.exe, does not appear to support any console output.  The only output I can get is to use the /M switch to display a dialog box.

When I tried the "out" parameter, I got a blank output, but the thumbnail was correctly created.

BUT, can I be assured that by using the "out" parameter that the process IS actually complete.  That would be enough.

I like the program because of the many option switches for the command line.

@mars:
I tried {.WHILE|true|{: {.exec|......} :}|timeout=5.} and the exec didn't get exec'd.
According to the Wiki:
Quote
The special macros with such behaviour are: if, set, for, switch and breadcrumbs.
Is this correct?
When I removed the quoting, {: :}, it worked but the timeout didn't delay the macro execution at all.
Just for fun, I also tried "false" and it had identical results.
What is surprising to me is that, when I watched "Task Manger", I only saw one "ezthumbs.exe" process.  I thought it may show many copies running.  Maybe it is set for "only one instance" by default.
I ran:
Code: [Select]
{.while|true|{.exec|ezthumbs.exe|{:"C:\Users\80063r\Pictures\Screen Shots\UltraEdit_Environment_2.jpg" /D="C:\Users\80063r\Pictures\Screen Shots\thumbs" /P=_tn /W=100 /H=100 /Z=ShrinkToFit /F=Nearest /Q=70 /B=0 /C=0 /S=0 /R=0 /Log=tnlog:}.}|timeout=20.}
{.set|#tn|1.}
{.call|#tn.}
{.focus.}
and the "Run Script" dialog focused immediately and showed the "1".

I can't seem to get any delay with "while".

Code: [Select]
> exec|ezthumbs.exe|{:"C:\Users\80063r\Pictures\Screen Shots\UltraEdit_Environment_2.jpg" /D="C:\Users\80063r\Pictures\Screen Shots\thumbs" /P=_tn /W=100 /H=100 /Z=ShrinkToFit /F=Nearest /Q=70 /B=0 /C=0 /S=0 /R=0 /Log=tnlog:}
<  

> while|true| |timeout=20
<

> set|#tn|1
<

> call|#tn
< 1

> focus
<

Also, just to be crazy, I set a variable to the value of the thumbnail and tried to compare or "cut" that.  I can't get cut to work properly with any variable even with:
Code: [Select]
{.set|#tn|abcdefg}
{.cut|3|4|#tn.}
I get "n" as in the third character of "#tn".  I tried every combination of ! # ^ % {. .} I can think of.

Setting a variable to the value of the thumbnail just seemed to mess up macro execution.
« Last Edit: May 28, 2009, 10:08:42 PM by 80063r »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
Forget my suggestion, I have just realized that she is in fact supposed to execute the macro ' exec ' as often as she can it during the granted lapse of time. >:(

This is the perfect example of the fact what is a bad example ;D

{.set|#x|ragnagna.}
{.WHILE|#x|{: {.add to log|RAGNAGNA.} :}|timeout=5.}


Saddened for it but even rejetto did not think of it, it will be necessary to wait for the next build.
Quote
next version will have "timeout" parameter for {.exec.}
« Last Edit: May 28, 2009, 11:02:41 PM by mars »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
Quote
{.set|#tn|abcdefg}
{.cut|3|4|#tn.}

{.set|#tn|abcdefg}
{.cut|3|4|{.^#tn.}.}


Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
Have a look at this.  I thought that quoting could be grouped. Like {:.....{:.....:}.....:}.  But apparently it can't.
Wouldn't it be nice if this script would "add to log" 10 times at 1 second intervals.  If quoting was grouped, then I could do what I wanted to as the first post requests.
Code: [Select]
{.focus.}
{.set|#x|1.}
{.set|#y|10.}
{.while|#y|{:{.dec|#y.}{.set|#flag|1.}{.while|#x|{:{.if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if.}:}|timeout=1/while.}:}.}
This is not what I intended.
Code: [Select]
---
> focus
<

> set|#x|1
<

> set|#y|10
<

> dec|#y
<

> set|#flag|1
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if
< {.set|#flag|0.}{.add to log|RAGNAGNA.}

> set|#flag|0
<

> add to log|RAGNAGNA
<

> while|#x|{:{.if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if.}:}|timeout=1/while
<

> while|#y|{:{.dec|#y.}{.set|#flag|1.}{.while|#x|{:{.if|#flag|{:{.set|#flag|0.}{.add to log|RAGNAGNA.}:}/if.}:}|timeout=1/while.}:}
<
« Last Edit: May 29, 2009, 01:54:46 AM by 80063r »


Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
i think that using the "out" parameter it should wait for the process to complete, or it could not give you the output!

YES!  I just confirmed that using the "out=" parameter does pause the execution until the process is complete.

With this program "ezthumbs.exe", it provides no output, so the #variable after "out=" will serve as a dummy variable.

Thank you.  That is what I needed to know.

By the way, my exec macro looks like this:
Code: [Select]
{.exec|ezthumbs.exe|{:"C:\Users\80063r\Pictures\Screen Shots\UltraEdit_Environment_2.jpg" /D="C:\Users\80063r\Pictures\Screen Shots\thumbs" /P=_tn /W=100 /H=100 /Z=ShrinkToFit /F=Nearest /Q=70 /B=0 /C=0 /S=0 /R=0 /Log=tnlog:}|out=#tn.}
EasyThumbs is also Freeware.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
quotings CAN be grouped.

you must do this way {.cut|3|4|var=#tn.}


Offline 80063r

  • Occasional poster
  • *
    • Posts: 40
    • View Profile
quotings CAN be grouped.

you must do this way {.cut|3|4|var=#tn.}

Thank you, that covers my other questions.

I will keep trying.