Environment vars in parameters
Moderators: helmut, XnTriq, xnview
Environment vars in parameters
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
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
Yes! XnView Classic, just updated to 2.32. Running on Win81.
Sorry, I should have said that before.
VMat
Sorry, I should have said that before.
VMat
Re: Environment vars in parameters
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
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
I think if you edit your xbs script to use relative paths from the script location it could be possible...xnview wrote:oh ok with a xbs script, so no it's not possible
Re: Environment vars in parameters
OK. I'll figure out something else.xnview wrote:oh ok with a xbs script, so no it's not possible
Thank you/Merci,
VMat
Re: Environment vars in parameters
I'll try that, thanks!cday wrote:I think if you edit your xbs script to use relative paths from the script location it could be possible...xnview wrote:oh ok with a xbs script, so no it's not possible
VMat
Re: Environment vars in parameters
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.VMat wrote:I'll try that, thanks!
VMat
Sorry I didn't mention that before...
