Jump to content
Sign in to follow this  

Using Macros

Recommended Posts

How do I use a macro with FileOpen?

FileOpen (@MyDocumentsDir &"\FSRPrt.xls")

Tried mutiple variations of above but, can't get it to work.

Share this post

Link to post
Share on other sites

Debug time....

$path = @MyDocumentsDir & "FSRPrt.xls"

MsgBox(0,"Checking macro:", @MyDocumentsDir)
MsgBox(0,"Does file exist?", FileExists($path))
MsgBox(0,"Can it be read", FileOpen($path, 0))

First one fails if result it empty string

Second one fails is result is 0

Third fails if result is -1

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post

Link to post
Share on other sites

Remember, FileOpen, open ASCII files (also binary like *.xls, but not is readable).

If you want open this file with Excel (not read the binary text), then simply


Run(@COMSPEC ' /c Start ' & @MyDocumentsDir & '\FSRPrt.xls', '', @SW_HIDE)



Taked from the Docs (FAQ)

6. Why can I only use Run() to execute .exe files?  What about .msi / .txt and others?

Only a few file extensions are usually "runable" - these are .exe, .bat, .com, .pif.  Other file types like .txt and .msi are actually executed with another program.  When you double click on a "myfile.msi" file what actually happens in the background is that "msiexec.exe myfile.msi" is executed.  So to run a .msi file from AutoIt you would do:

    RunWait("msiexec myfile.msi")

Or, an even simpler way is to run the command "start" which will automatically work out how to execute the file for you:

    RunWait(@COMSPEC " /c Start myfile.msi")

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...