 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
jpkishere Guest
|
Posted: Tue Jun 29, 2004 3:11 pm Post subject: Variables.. |
|
|
Was wondering if it would be easy to implement somthing similiar to what AutoIT3 has with macros..
Basically I need to make an app that copies some files over to all users desktop, but at our environment that path varies from machine to machine, os to os..
Below is an alphabetized list of all the macros available in AutoIt.
Macro Description
@AppDataCommonDir path to Application Data
@AppDataDir path to current user's Application Data
@AutoItVersion Version number of AutoIt such as 3.0.81.0
@CommonFilesDir path to Common Files folder
@Compiled Returns 1 if script is a compiled executable; otherwise, returns 0.
@ComputerName Computer's network name.
@ComSpec value of %comspec%, the SPECified secondary COMmand interpreter;
primarily for command line uses, e.g. Run(@ComSpec & " /k help | more")
@CR Carriage return, Chr(13); sometimes used for line breaks.
@CRLF = @CR & @LF ;occasionally used for line breaks.
@DesktopCommonDir path to Desktop
@DesktopDir path to current user's Desktop
@DesktopHeight Height of screen in pixels. (horizontal resolution)
@DesktopWidth Width of screen in pixels. (vertical resolution)
@DocumentsCommonDir path to Documents
@error Status of the error flag. See the SetError function.
@FavoritesCommonDir path to Favorites
@FavoritesDir path to current user's Favorites
@HomeDrive Drive letter of drive containing current user's home directory.
@HomePath Directory part of current user's home directory. To get the full path, use in conjunction with @HomeDrive.
@HomeShare @HomeShare - Server and share name containing current user's home directory.
@HOUR Hours value of clock in 24-hour format. Range is 00 to 23
@IPAddress1 IP address of first network adapter. Tends to return 127.0.0.1 on some computers.
@IPAddress2 IP address of second network adapter. Returns 0.0.0.0 if not applicable.
@IPAddress3 IP address of third network adapter. Returns 0.0.0.0 if not applicable.
@IPAddress4 IP address of fourth network adapter. Returns 0.0.0.0 if not applicable.
@LF Line feed, Chr(10); typically used for line breaks.
@LogonDNSDomain Logon DNS Domain.
@LogonDomain Logon Domain.
@LogonServer Logon server.
@MDAY Current day of month. Range is 01 to 31
@MIN Minutes value of clock. Range is 00 to 59
@MON Current month. Range is 01 to 12
@MyDocumentsDir path to My Documents target
@OSBuild Returns the OS build number. For example, Windows 2003 Server returns 3790
@OSLang Returns code denoting OS Language. See Appendix for possible values.
@OSServicePack Service pack info in the form of "Service Pack 3" or, for Windows 95, it may return "B"
@OSTYPE Returns "WIN32_NT" for NT/2000/XP and returns "WIN32_WINDOWS" for 95/98/Me
@OSVersion Returns one of the following: WIN_XP, WIN_2000, WIN_NT4, WIN_ME, WIN_98, WIN_95
@ProgramFilesDir path to Program Files folder
@ProgramsCommonDir path to Start Menu's Programs folder
@ProgramsDir path to current user's Programs (folder on Start Menu)
@ScriptDir Directory containing the running script. (Result does not contain a trailing backslash)
@ScriptFullPath Equivalent to @ScriptDir & "\" & @ScriptName
@ScriptName Long filename of the running script.
@SEC Seconds value of clock. Range is 00 to 59
@StartMenuCommonDir path to Start Menu folder
@StartMenuDir path to current user's Start Menu
@StartupCommonDir path to Startup folder
@StartupDir current user's Startup folder
@SW_HIDE Hide window.
@SW_MAXIMIZE Maximize window.
@SW_MINIMIZE Minimize window.
@SW_RESTORE Undoes a window minimization or maximization
@SW_SHOW Shows a previously hidden window.
@SystemDir path to Windows' System (or System32) folder
@TAB Tab character, Chr(9)
@TempDir Path to the temporary files folder.
@UserProfileDir Path to current user's Profile folder.
@UserName ID of the currently logged on user.
@WDAY Numeric day of week. Range is 1 to 7 which corresponds to Sunday through Saturday.
@WindowsDir path to Windows folder
@WorkingDir Current/active working directory. (Result does not contain a trailing backslash)
@YDAY Current day of year. Range is 1 to 366 (or 365 if not a leap year)
@YEAR Current four-digit year
Thanks! |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jun 29, 2004 4:34 pm Post subject: |
|
|
Many of those are either built-in variables or can be retrieved from the environment. See http://www.autohotkey.com/docs/Variables.htm#BuiltIn for the list.
Variables such as @AppDataCommonDir can be read from a standard(?) place in the registry.
You probably already know that environment variables can be read by enclosing their names in percent signs like any other variable.
Are there any in particular from that list that you want? Otherwise, I'll just make a note to add more of the registry entries as built-in variables someday. |
|
| Back to top |
|
 |
jpkishere Guest
|
Posted: Tue Jun 29, 2004 8:37 pm Post subject: Variables cont'd |
|
|
Was specifically looking for:
@DesktopCommonDir
Using it as sort of an installer; so I need to copy to different spots depending on OS.. i.e. NT uses C:\winnt\profiles, 2k uses Documents and Settings, etc..
Thanks! |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Wed Jun 30, 2004 1:57 am Post subject: |
|
|
Until such time as it is added, this might be useful from you. This is the approach AutoIt3 uses to get the value:
Util_RegReadString(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Desktop", _MAX_PATH, szValue);
If the above finds nothing:
Util_RegReadString(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Desktop", _MAX_PATH, szValue);
If you need it now, just translate the above into two RegRead commands. |
|
| Back to top |
|
 |
Payam
Joined: 07 Apr 2004 Posts: 58
|
Posted: Wed Jun 30, 2004 9:39 am Post subject: |
|
|
Any idea how to get this one:
@ComputerName
?
It would be quite useful in a network environment, thanks |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Wed Jun 30, 2004 12:32 pm Post subject: |
|
|
| One XP at least, it's in the environment. You can read the value by using %COMPUTERNAME% in a script. I will try to add some of these as built-in variables for the next version. |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Wed Jun 30, 2004 1:17 pm Post subject: |
|
|
The %computername% variable works on NT/2000/XP.
thanks,
beardboy |
|
| Back to top |
|
 |
jpkishere Guest
|
Posted: Wed Jun 30, 2004 2:41 pm Post subject: Thanks.. |
|
|
Chris,
Went ahead and did that for common desktop and program files path..
thx!
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|