Page 1 of 1
Environment vars in parameters
Posted: Thu Jun 11, 2015 10:07 pm
by VMat
Hi,
I'm trying to use environment variables in transformation parameters, is that supposed to work? For example, I'd like to add a watermark to my images, and one of the parameters is the "Image file". I tried "%USER_PROFILE%\Documents\...\my_watermark.gif", but it doesn't work. Is there any way to do that?
That's important because I want to save the script and distribute it to different machines at home, which have different user profile paths.
Thanks,
VMat
Re: Environment vars in parameters
Posted: Fri Jun 12, 2015 9:15 am
by xnview
with XnView?
Re: Environment vars in parameters
Posted: Fri Jun 12, 2015 10:53 am
by VMat
Yes! XnView Classic, just updated to 2.32. Running on Win81.
Sorry, I should have said that before.
VMat
Re: Environment vars in parameters
Posted: Fri Jun 12, 2015 1:23 pm
by xnview
but there is no environment vars to add a watermark
Re: Environment vars in parameters
Posted: Fri Jun 12, 2015 1:44 pm
by VMat
Maybe I didn't make myself clear.
Let's say in machine 1 I have a user FOO whose profile is in C:\Users\FOO, so the watermark file would be, for example, "C:\Users\FOO\Documents\My Pictures\my_watermark.gif". In machine 2 I have a user BAR whose profile is in D:\Users\BAR, and the watermark file would be "D:\Users\BAR\Documents\My Pictures\my_watermark.gif". Also, if I have a second user (e.g., my wife) in the same machine 1 that has a different watermark, in her own Documents directory, we would have the same problem.
I'd like to use exactly the same script in both machines, so I need to use an environment variable to specify the correct path that would work in both places, for any user - such as "%USER_PROFILE%\Documents\My Pictures\my_watermark.gif", otherwise I have to edit the xbs script in each machine/user. Doesn't XnView support that? Is there a workaround?
Thanks,
VMat
Re: Environment vars in parameters
Posted: Sat Jun 13, 2015 2:33 pm
by xnview
oh ok with a xbs script, so no it's not possible
Re: Environment vars in parameters
Posted: Sat Jun 13, 2015 10:10 pm
by cday
xnview wrote:oh ok with a xbs script, so no it's not possible
I think if you edit your xbs script to use relative paths from the script location it could be possible...
Re: Environment vars in parameters
Posted: Tue Jun 16, 2015 6:32 pm
by VMat
xnview wrote:oh ok with a xbs script, so no it's not possible
OK. I'll figure out something else.
Thank you/Merci,
VMat
Re: Environment vars in parameters
Posted: Tue Jun 16, 2015 7:18 pm
by VMat
cday wrote:xnview wrote:oh ok with a xbs script, so no it's not possible
I think if you edit your xbs script to use relative paths from the script location it could be possible...
I'll try that, thanks!
VMat
Re: Environment vars in parameters
Posted: Tue Jun 16, 2015 7:38 pm
by cday
VMat wrote:I'll try that, thanks!
VMat
Note that in my quick test I had to change back slashes ' \' to forward slashes '/' then it wrote the output to the expected relative path.
Sorry I didn't mention that before...
