list of file/path references?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

list of file/path references?

Post by Snickers » Thu Aug 16, 2007 9:33 pm

I am trying to create and write to files; however, if the exact path of the user,s folders are not known is there a list of references to path names such as %TEMP_DIR%?

I can't find it in help or google.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Aug 17, 2007 1:42 am

Use the DOS SET command to see the values
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Fri Aug 17, 2007 1:35 pm

Bob Hansen wrote:Use the DOS SET command to see the values
I am unable to locate a list of DOS SET commands on the internet. Do you happen to know where the list might be found or how I can use the DOS SET command?

I only got into programming after 1999, I know very little (aka: nada) about DOS. :oops:

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Aug 17, 2007 1:42 pm

Click Start, then Run and type CMD.EXE

A "DOS" box will appear.

Now type:

SET

Hit enter.

Not actually DOS. SET is still a command, even in Vista, which does not use DOS. We often use the word DOS to describe the command line interface, though it is not really DOS any more.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Fri Aug 17, 2007 1:46 pm

Very nice! Thank you both!

Edit...Ok it isn't working.

I know I can writeln> to %TEMP_DIR% using Macro Scheduler; however, when looking at the DOS SET using the cmd.exe prompt and SET command, "TEMP_DIR" isn't listed. TEMP is listed but not the Macro Scheduler's understood TEMP_DIR.

I am trying to writeln to a file on the desktop. But the following isn't working:

WRITEln>%USERPROFILE_DIR%\desktop\junkfile.txt,r,successfully wrote to file

NOR

WRITEln>%USERPROFILE%\desktop\junkfile.txt,r,successfully wrote to file


I found this while searching in Forums:

wln>C:\Documents and Settings\%USER_NAME%\Desktop\

It isn't listed as such in the DOS SET. USER_NAME is listed as USERNAME in the DOS SET.
Last edited by Snickers on Fri Aug 17, 2007 2:09 pm, edited 1 time in total.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Aug 17, 2007 2:08 pm

TEMP_DIR is a *Macro Scheduler* variable. It stores the location of the Windows temporary folder.

TEMP is a Windows/DOS environment variable which stores the location of the Windows temporary folder.

Therefore they should always contain the same value. But they are not the same thing.

To see Windows Environment Variables go to Control Panel/System/Advanced/Environment Variables
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Aug 17, 2007 2:13 pm

Maybe you should explain what you are trying to do. If you want a list of Macro Scheduler system variables look in the help file under Command Reference/Variables/System Variables.

Several relate to various important paths:

TEMP_DIR = temporary folder
WIN_DIR = Windows folder
SYS_DIR = Windows System folder
SCRIPT_DIR = Folder containing currently running script (SELF)

This script returns the User's "My Documents" folder:

Code: Select all

VBSTART
VBEND
Let>Path=
Let>Path_SIZE=260
LibFunc>shell32.dll,SHGetSpecialFolderPathA,bres,0,Path,5,0
//The return string is "Null Terminated".  So find the end by looking for a null char - chr(0)
VBEval>chr(0),NullChar
Pos>NullChar,BRES_2,1,pNull
Let>pNull=pNull-1
//Extract to the null char
MidStr>BRES_2,1,pNull,DocFolder
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Fri Aug 17, 2007 2:18 pm

So far I have found out that Macro Scheduler understands %USER_NAME% and %TEMP_DIR%. TEMP is found under my environmental variables but TEMP_DIR and USER_NAME are not. USERNAME is found in DOS SET but USER_NAME is not.

Is there a list showing all Macro Scheduler understood pathing variables such as %USER_NAME% and %TEMP_DIR%?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Aug 17, 2007 2:19 pm

Let>desktop=C:\Documents and Settings\%USER_NAME%\Desktop
MDL>%desktop%

The trick would be how to know that it's on C: :?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Aug 17, 2007 2:20 pm

Snickers wrote:Is there a list showing all Macro Scheduler understood pathing variables such as %USER_NAME% and %TEMP_DIR%?
Help > Contents > Using Variables > System Variables

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Aug 17, 2007 2:21 pm

Me_again wrote:Let>desktop=C:\Documents and Settings\%USER_NAME%\Desktop
MDL>%desktop%

The trick would be how to know that it's on C: :?

Code: Select all

VBSTART
VBEND
Let>Path=
Let>Path_SIZE=260
LibFunc>shell32.dll,SHGetSpecialFolderPathA,bres,0,Path,5,0
//The return string is "Null Terminated".  So find the end by looking for a null char - chr(0)
VBEval>chr(0),NullChar
Pos>NullChar,BRES_2,1,pNull
Let>pNull=pNull-1
//Extract to the null char
MidStr>BRES_2,1,pNull,DocFolder
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Aug 17, 2007 2:24 pm

How about using:

GetEnvVar> ?

GetEnvVar>SystemDrive,sysdrive
MDL>%sysdrive%

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Fri Aug 17, 2007 2:24 pm

Me_again wrote:Help > Contents > Using Variables > System Variables
jeez! How the heck did I miss that!

Thank you!

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Fri Aug 17, 2007 2:25 pm

Me_again wrote:How about using:

GetEnvVar> ?

GetEnvVar>SystemDrive,sysdrive
MDL>%sysdrive%
beautiful!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Aug 17, 2007 2:28 pm

Better:

GetEnvVar>USERPROFILE,profile
Let>%desktop%=%profile%\desktop
MDL>%desktop%

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts