Variable Set from File
The Variable Set from File command obtains either the date and time of a specific file or the path of the file and saves the information to variables. Compare the variables for possible further action. For example, check to verify if the tested file should be replaced with one that has a more recent date and time.
Get File Date/Time
The Get File Date/Time option obtains the date and time of the file specified and saves the information into Integer variables. There are three different time frames to choose from.
•Creation Date/Time - The date and time that the file was originally created.
•Modified Date/Time - The date and time that the file was last modified or updated and saved.
•Last Accessed Date/Time - The date and time that the file was last accessed or opened.
üNote: Not every file system supports all three of these date/time formats. Macro Express issues a warning during playback if the format selected is not available.
Script Editor > Expand Variables Category > Variable Set from File
The date and time components are broken down to six different variables as described below.
Month/Date/Year
In the example above, the month is saved to Integer variable N[1], the day to N[2] and year to N[3]. So if the file date was December 25, 2020, the value saved to variable N[1] would be 12. The value saved to N[2] would be 25. And the value saved to N[3] would be 2020.
•Month - The month is saved to the variable as 1 through 12.
•Day - The day is saved to the variable as 1 through 31.
•Year - The year is always saved to the variable as a four digit number.
Hour/Minute/Seconds
•Hour -The hour is saved in a 24 hour format. If the file time were between midnight and 1:00am, the hour would be saved to the variable as 0. If the file time was between 11:00 am and noon, the hour would be saved to the variable as 11. If the file time was between 11:00 pm and midnight, the hour would be saved to the variable as 23.
•Minute - Minutes are saved to variables as 0 to 59.
•Seconds - Seconds are also saved to variables as 0 to 59.
To Date Variable
This option saves all of the above information (month, date, year, hour, minutes, seconds) to a Date Variable. Select the date variable to store the information.
Get File Path Info
The Get File Path option obtains the file path of a particular file and saves the information into text string variables. The file path is split into four distinct units, as explained below.
Script Editor > Expand Variables Category > Variable Set from File
•Drive - This is the letter drive on the computer, including the colon.
•Path - This variable contains the folder or folders where the file is located.
•Filename - This variable contains just the name of the file without the file extension.
•Extension - This variable contains the file extension, such as .txt, .bmp or .exe.
Example For the file displayed in the image above, here is what would be saved to each variable.
Drive: C: Path: \Program Files\Windows Media Player\ Filename: wmplayer Extension: .exe |
Expand the File Name
The Expand Filename converts a relative file name into a fully qualified path name. For example, if the current directory is c:\Temp and the Filename/Path is "..\work.txt" and Expand Filename is unchecked, then resulting values would be:
Drive:
Path: ..\
Filename: work
Extension: .txt
But if Expand Filename is checked, then the resulting values would be:
Drive: c:
Path: \
Filename: work
Extension: .txt
Get File Size
The Get File Size option obtains the size of the file selected and saves it to a variable. The value is saved in bytes.
Store Size In
Enter the variable name to receive the file size.