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
Environment vars in parameters
Moderator: xnview
-
xnview
- Author of XnView
- Posts: 47539
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
VMat
- Posts: 5
- Joined: Thu Jun 11, 2015 9:58 pm
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
-
xnview
- Author of XnView
- Posts: 47539
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
VMat
- Posts: 5
- Joined: Thu Jun 11, 2015 9:58 pm
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
-
xnview
- Author of XnView
- Posts: 47539
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
cday
- XnThusiast
- Posts: 4524
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
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
-
VMat
- Posts: 5
- Joined: Thu Jun 11, 2015 9:58 pm
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
-
VMat
- Posts: 5
- Joined: Thu Jun 11, 2015 9:58 pm
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
-
cday
- XnThusiast
- Posts: 4524
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
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...