PDA

View Full Version : Environment Variable: PATH



NewsArchive
11-03-2006, 04:45 AM
Hi Guys.

How do I retrieve the "PATH" environment variable? I'm using the "Get
System Information" dialog, second option is "Expand Environment Variable",
what's the third field? Have tried "Path" but it doesn't seem to work.

Thanks..

Best Regards,

Gary.

Gary James
Strategy, South Africa
Web: www.strategyonline.co.za
Blog: www.strategyonline.co.za/blog

NewsArchive
11-03-2006, 04:46 AM
Hi Gary,

To retrieve the PATH environment variable, you have to enter PATH in the 3rd
field.

For example (line may wrap):
Set Variable %PATHVAR% to ScriptItem->Get System Information(Expand Environment Variable) of "PATH"

Does this help?

Friedrich

--
Friedrich Linder
CEO, Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 5

NewsArchive
11-04-2006, 06:07 AM
Hi Friedrich.

Wow! Thanks for the quick reply.. That's not working here..
"COMPUTERNAME" works fine, but "Path" or "PATH" return nothing.. Using the
latest SB.. Any ideas? Running WinXP Pro.

Best Regards,

Gary.

Gary James
Strategy, South Africa
Web: www.strategyonline.co.za
Blog: www.strategyonline.co.za/blog

NewsArchive
11-04-2006, 06:07 AM
Hi Gary,

Sorry, but I have no idea. I have tested this on all machines here (2000,
XP, x64, 2003, and Vista) and it always returned the correct PATH
environment variable. Perhaps your PATH variable is > 1023 bytes. In
general, the path variable is limited to 1023 bytes. In XP SP this
increased to 2048 bytes.

SetupBuilder variables have a 1024 byte limit, so perhaps this is the
problem.

HTH,
Friedrich

NewsArchive
11-04-2006, 06:08 AM
Hi Friedrich.

My path was at 1318 characters (this is a test machine <g>). I reduced that
to under 1024 (768) but it's still not working.. I'll keep fiddling and let
you know if I find anything..

Thanks..

Best Regards,

Gary.

Gary James
Strategy, South Africa
Web: www.strategyonline.co.za
Blog: www.strategyonline.co.za/blog

NewsArchive
11-04-2006, 06:08 AM
Hi Gary,

We are using a Windows API call here: ExpandEnvironmentStrings()

I don't know if your machine hit another Windows limit :-(
http://www.lindersoft.com/forums/showthread.php?t=1065

Friedrich

NewsArchive
11-04-2006, 06:08 AM
Hi Friedrich.

Just ran the same compiled script on a new machine (XP Pro, very little
installed on it) and I get the same result..

This is what I'm doing:

Set Variable %PATHVAR% to ScriptItem->Get System Information(Expand
Environment Variable) of "PATH"
Display Message Box "%PATHVAR%" -- "PATH"
Displays nothing.. COMPUTERNAME works fine though.. Sorry for being a
nuisance.. I'll keep fiddling this side..

Best Regards,

Gary.

Gary James
Strategy, South Africa
Web: www.strategyonline.co.za
Blog: www.strategyonline.co.za/blog

NewsArchive
11-04-2006, 06:11 AM
Hi Gary,

I have attached my test script (Gary.sb5). It works fine on all machines
here (see screenshot).

What happens if you call the ExpandEnvironmentStrings() Windows API from a
Clarion test application?

Friedrich

NewsArchive
11-04-2006, 06:11 AM
Hi Friedrich.

Thanks, I appreciate the help.. Your script did the same as mine this side
(on 3 machines), it shows nothing in the message box.. I have to leave the
office in about 5 minutes, I'll play around with the API later this weekend
and let you know what I find.. Very weird..

Best Regards,

Gary.

Gary James
Strategy, South Africa
Web: www.strategyonline.co.za
Blog: www.strategyonline.co.za/blog

NewsArchive
11-04-2006, 06:12 AM
Friedrich's script on XP Pro SP2 laptop

Jane Fleming

NewsArchive
11-07-2006, 08:04 AM
Hi Jane.

No need to brag <g>..

Thanks.. Taking another look at it now.. Not sure what I've done to all my
PCs, going to play around with the API and see what that turns up..

Best Regards,

Gary.

Gary James
Strategy, South Africa
Web: www.strategyonline.co.za
Blog: www.strategyonline.co.za/blog

NewsArchive
11-07-2006, 08:05 AM
Hi Friedrich.

API works fine here, code as follows:

program
map
module('WinAPI')
ExpandEnvironmentStrings (*cstring lpSrc, *cstring lpDst, long
nSize),long,pascal,raw,name('ExpandEnvironmentStri ngsA'),proc
end
end
p1 cstring(256)
p2 cstring(1024)
p3 long
code
p1 = '%PATH%'
p3 = size(p2)
ExpandEnvironmentStrings (p1, p2, p3)
stop(p2)

SB still returning nothing.

Best Regards,

Gary.

Gary James
Strategy, South Africa
Web: www.strategyonline.co.za
Blog: www.strategyonline.co.za/blog

NewsArchive
11-07-2006, 08:05 AM
Hi Gary,

Unforunately, I have no idea. I cannot reproduce this problem on any of our
machines.

Friedrich

NewsArchive
11-09-2006, 05:45 AM
Perhaps Gary could step thru this with the debugger?

--
Russ Eggen
www.radfusion.com
IRC Info: www.radfusion.com/irc.htm
Freebies: www.radfusion.com/downloads.htm

NewsArchive
11-09-2006, 05:45 AM
You and your debugger <G>

Jane Fleming

NewsArchive
11-09-2006, 05:45 AM
Not mine, Friedrich's <bg>

--
Russ Eggen
www.radfusion.com
IRC Info: www.radfusion.com/irc.htm
Freebies: www.radfusion.com/downloads.htm