floyd Posted December 19, 2004 Report Share Posted December 19, 2004 Macro Express does not have a built-in command to return the attributes of a file such as ReadOnly, Hidden, System, and Archive. So, you can use this macro to do it instead. It runs a VBScript script program. The script is generated by the macro, saved to a unique file name in your temp folder, and is then run using the Program Launch command. All temporary files are erased before the macro terminates. The name of the target file, the one that you want to get the attributes from, is saved to a Key in an INI file (saved in your temp folder), which is read by the script when called. The script gets the target file attributes and returns them as a comma delimited string back to the INI file under another Key. When the script is done the macro takes control back and reads the attributes string from the INI file. The macro does the following: Gets the name of your temp folder Generates a unique file name Prompts for the target file name and saves it to the INI file Generates the VBScript script and saves it to the temp folder Runs the script, getting the attributes and saving them to the INI file Reads the INI file and displays the results Erases the files generated by the macro. The attributes returned are: Normal ReadOnly Hidden System Archive If a file has more than one attribute then they are returned as a comma delimited string such as "Hidden,System,Archive". If an error occurs in the script then a blank string will be returned. Tested under Win'XP, Win'2k, and Win'98. Get_File_Attributes.zip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.