Page 1 of 1
variables as parameters in CLI
Posted: Sun Jun 16, 2024 11:01 am
by photoevents
When using variables as parameters when starting a program I needed to use a double \\ before the variable name if it was in a string in my previous software.
Like this: %WORKFOLDER%\qrcodes\\%FileName%.png
How do you do that in robotask?
(I'm having trouble finding examples of this)
Another example that works in my previous script:
convert.exe "%CurrentItem%" -quality "70" -resize "990x1490^" -gravity "North" -extent "1200x1800" "%WORKFOLDER%\overlay\\watermark.png" -compose over -composite "%WORKFOLDER%\merged\\%FileName%"
how does that translate to robotask?
Christian
Re: variables as parameters in CLI
Posted: Sun Jun 16, 2024 1:59 pm
by Oleg
...how does that translate to robotask?...
I'm sorry I don't understand you...
Do you want to put double backslash (\\) before environment variable? Or remove extra slash?
...if it was in a string in my previous software...
What do you receive from "previous software" and what do you want to get as a result?
Or do you want to expand environment variables in string?
Re: variables as parameters in CLI
Posted: Mon Jun 17, 2024 10:08 am
by photoevents
Apologies if my query was unclear.
When starting a program using robotask run console application it is possible to add parameters.
Do I have to take special measures when merging variables within the command line ?
Like in winautomation it would be:
%WORKFOLDER%\qrcodes\\%FileName%.png (one extra backslash to make sure the variable is recognized as a variable)
and I guess in robotask this would be:
{WORKFOLDER}\qrcodes{FileName}.png
Correct?
Do I need to take certain measures (quotes, special characters, backslash, {} ) so robotask does not misinterpret the command line?
Thanks,
Christian
Re: variables as parameters in CLI
Posted: Mon Jun 17, 2024 11:39 am
by Oleg
Do I have to take special measures when merging variables within the command line ?
No.
Like in winautomation it would be:
%WORKFOLDER%\qrcodes\\%FileName%.png ...
System (Windows™) uses expressions like
%WORKFOLDER% and
%FileName% for environment variables in CMD or BATH files. Do you use environment variables?
and I guess in robotask this would be:
{WORKFOLDER}\qrcodes{FileName}.png
I think you missed one backslash.
No problem, use the expression as it is:
{WORKFOLDER}\qrcodes\{FileName}.png
without problem. If
WORKFOLDER and
FileName are internal user variables of RoboTask then the action engine expands then and put values instead of expressions
{WORKFOLDER} and
{FileName}
Re: variables as parameters in CLI
Posted: Mon Jun 17, 2024 12:14 pm
by photoevents
Re: variables as parameters in CLI
Posted: Mon Jun 17, 2024 12:37 pm
by Oleg
use photoheight without braces
If you want to save something to variable you should specify variable name only. It's better to specify the name explicitly.
You can use other variables to form variable name, but I'm afraid that variable photoheight does not contain any value at this moment
Re: variables as parameters in CLI
Posted: Mon Jun 17, 2024 2:13 pm
by photoevents
Okay, got it working
The whole command line is:
identify -format "%h" "{current_image}"
to get the height of the image
more info on imagemagick identify for those interested:
https://imagemagick.org/Usage/basics/#identify
Re: variables as parameters in CLI
Posted: Mon Jun 17, 2024 6:57 pm
by Oleg
By the way, take a look at the
Open Image action.
When you open an image from a file or clipboard, it can determine the
height and
width of the image.