Desktop Path with ver.7

Discussions concerning programming of SOFTIMAGE©
Post Reply
User avatar
islasyr
Posts: 16
Joined: 02 Jul 2009, 11:23

Desktop Path with ver.7

Post by islasyr » 05 Jul 2009, 13:30

Hi
I Have a Problem with Paths..
In Version 6.5 of XSI I was using this line (JScript):

var DesktopPath = XSIUtils.ResolvePath("$USERPROFILE")+"\\Desktop";

I used this line to get Desktop path to export objects or
models..

But when I worked on ver.7 the command send me an error
on Value: "$USERPROFILE": Invalid argument specified.
He couldn't resolve that path..

So What's the problem?
Is there another way to get user profile path..?



Thanks 4 reading..


-

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Desktop Path with ver.7

Post by Hirazi Blue » 05 Jul 2009, 20:18

An alternative way to get you the path you want would be:

Code: Select all

var DesktopPath = XSIUtils.Environment.Item("XSI_USERROOT") + "\\Desktop"
I can't say, why "$USERPROFILE" doesn't work anymore.
I just tested it: under 7.01 and 7.5 it returned no error, but an empty string
and as you already stated, under 6.5 it still works.... :-?
Stay safe, sane & healthy!

User avatar
islasyr
Posts: 16
Joined: 02 Jul 2009, 11:23

Re: Desktop Path with ver.7

Post by islasyr » 06 Jul 2009, 11:17

Thanks it really works..
But how could I know more items of this environment please??

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: Desktop Path with ver.7

Post by Hirazi Blue » 06 Jul 2009, 12:03

Go to "Advanced Setup and Configuration > Environment Variables" in the User's Guide...

To find out how to get and set "environment variables" in scripting, type "Environment" in the index tab of the SDK documentation. ;)
Stay safe, sane & healthy!

User avatar
islasyr
Posts: 16
Joined: 02 Jul 2009, 11:23

Re: Desktop Path with ver.7

Post by islasyr » 07 Jul 2009, 10:48

Thanks really
Now I've understood a lot of things happend in Softimage..

now I Can define a variable and so many abilities are now available.. ;)

Thanks again :ymhug:

luceric
Posts: 1251
Joined: 22 Jun 2009, 00:08

Re: Desktop Path with ver.7

Post by luceric » 07 Jul 2009, 23:27

try this instead
var DesktopPath = XSIUtils.ResolvePath("$(USERPROFILE)")+"\\Desktop";

User avatar
islasyr
Posts: 16
Joined: 02 Jul 2009, 11:23

Re: Desktop Path with ver.7

Post by islasyr » 08 Jul 2009, 09:21

Well..
Just Perfect..!

It is the closest solution..

Thanks..

But I Have a simple question: How can I get more Paths like "$USERPATH"
is it from Environment variables??

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests