| View previous topic :: View next topic |
| Author |
Message |
Ichthus General User

Joined: 23 May 2004 Posts: 6
|
Posted: Sun May 23, 2004 9:25 pm Post subject: getting the user's TEMP directory in windows |
|
|
Trying to write a script that saves a copy of the current document in the user's windows temp directory. This is set as a environment variable in windows, and you can see it at the command line by typing "echo %TEMP%" which gives "C:\DOCUME~1\Username\LOCALS~1\Temp".
Is there a way I can get the value of this variable inside a Macro? I tried:
ConvertToURL( "%TEMP%" )
which gives
file:///%25TEMP%25
Thanks in advance,
Kevin |
|
| Back to top |
|
 |
bitfarmer General User

Joined: 06 May 2004 Posts: 39 Location: Murcia, Spain
|
Posted: Sun May 23, 2004 11:30 pm Post subject: |
|
|
| You can also make a shellexecute of "SET > C:\tempo.txt", then load the tempo.txt file and look for a line beginning with "TEMP=" , the path is on the rest of this line. |
|
| Back to top |
|
 |
Ichthus General User

Joined: 23 May 2004 Posts: 6
|
Posted: Mon May 24, 2004 4:49 am Post subject: |
|
|
That is one idea... but I was hoping for something a little cleaner. To add to your idea though, it would be easier to do a shell execute of "echo %TEMP% > C:\tempo.txt"... cause that would make the only line in the file as the temp path... no searching
Anyone else have a better way? Thanks  |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Mon May 24, 2004 6:37 am Post subject: |
|
|
it's a simple command to get the Temp directory, at least for Windows. I don't know if you can do the same for Unix or for the Mac.
| Code: | | msgbox Environ("TEMP") |
Hope that helps.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
Ichthus General User

Joined: 23 May 2004 Posts: 6
|
Posted: Mon May 24, 2004 9:40 am Post subject: |
|
|
Thank you thank you to both of your replies. The Environ() call was what I was looking for, and will probably work for my situation since it will only be running on windows. But I may use the other one, just for kicks. Thanks guys  |
|
| Back to top |
|
 |
|