How to determine the vortex script you're running

Post Reply
Mr. Bigglesworth
Posts: 56
Joined: Fri Feb 16, 2001 6:54 pm

How to determine the vortex script you're running

Post by Mr. Bigglesworth »

Sorry for the basic question here, but I can't find it when I need to, it seems.

If I'm running a script like so:

http://...texis.exe/public/myscript

How can I extract the name of the actual script (in this case, "myscript") from within the page itself? Is there some <sysinfo> function that would allow me to do this? I know there is a way, but I just can't recall.
bart
Posts: 251
Joined: Wed Apr 26, 2000 12:42 am

How to determine the vortex script you're running

Post by bart »

See the variables: $PATH_TRANSLATED or $PATH_INFO
User avatar
Kai
Site Admin
Posts: 1271
Joined: Tue Apr 25, 2000 1:27 pm

How to determine the vortex script you're running

Post by Kai »

Also see $pathroot (which is $PATH_INFO without state info or function/extension) and $sourcepath, which is the file (not URL) path to the script.
paulman
Posts: 40
Joined: Tue Dec 19, 2000 4:08 pm

How to determine the vortex script you're running

Post by paulman »

I need to get the full path to the script. I tried $sourcepath and it seems to give me the relative path to the script from where I executed a script. For example I have a script called testscript in the test directory. If I execute the script from the test dir it diplays:
$ texis testscript
testscript
If I go to the parent directory I get:
$ texis test/testscript
test/testscript
Is there a way to get the full path?
bart
Posts: 251
Joined: Wed Apr 26, 2000 12:42 am

How to determine the vortex script you're running

Post by bart »

Try: $PATH_TRANSLATED
paulman
Posts: 40
Joined: Tue Dec 19, 2000 4:08 pm

How to determine the vortex script you're running

Post by paulman »

The systyem doesn't return anything when I use PATH_TRANSLATED. Does this have to be used in conjunction with vhttpd. Is it possible to get the full path when executing a script from the command line?
User avatar
Kai
Site Admin
Posts: 1271
Joined: Tue Apr 25, 2000 1:27 pm

How to determine the vortex script you're running

Post by Kai »

$PATH_TRANSLATED is set by the web server, so a command-line run won't see it. $sourcepath is set by Vortex and is always set, for command-line as well as web server runs, to the path given for the script. However, if you run from the command line and give a current-dir-relative path, $sourcepath will also be current-dir-relative.

To make $sourcepath absolute, you'll need to prepend the current dir if it's not absolute:

<rex ">>=/" $sourcepath>
<IF $ret eq "">
<sysinfo cwd>
<sum "%s" $ret "/" $sourcepath>
<$sourcepath = $ret>
</IF>

This assumes Unix (you'd have to check for drive letters under Windows), and a Vortex of 2000-08-15 or later (for <sysinfo>).
paulman
Posts: 40
Joined: Tue Dec 19, 2000 4:08 pm

How to determine the vortex script you're running

Post by paulman »

Thanks that works well.
Post Reply