Environment vars in parameters

Ask for help and post your question on how to use XnView Classic.

Moderators: helmut, XnTriq, xnview

Post Reply
VMat
Posts: 5
Joined: Thu Jun 11, 2015 9:58 pm

Environment vars in parameters

Post 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
User avatar
xnview
Author of XnView
Posts: 46255
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Environment vars in parameters

Post by xnview »

with XnView?
Pierre.
VMat
Posts: 5
Joined: Thu Jun 11, 2015 9:58 pm

Re: Environment vars in parameters

Post by VMat »

Yes! XnView Classic, just updated to 2.32. Running on Win81.

Sorry, I should have said that before.

VMat
User avatar
xnview
Author of XnView
Posts: 46255
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Environment vars in parameters

Post by xnview »

but there is no environment vars to add a watermark
Pierre.
VMat
Posts: 5
Joined: Thu Jun 11, 2015 9:58 pm

Re: Environment vars in parameters

Post 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
User avatar
xnview
Author of XnView
Posts: 46255
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Environment vars in parameters

Post by xnview »

oh ok with a xbs script, so no it's not possible
Pierre.
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Environment vars in parameters

Post 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...
VMat
Posts: 5
Joined: Thu Jun 11, 2015 9:58 pm

Re: Environment vars in parameters

Post 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
VMat
Posts: 5
Joined: Thu Jun 11, 2015 9:58 pm

Re: Environment vars in parameters

Post 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
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Environment vars in parameters

Post 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... :wink:
Post Reply