Jump to content
Sign in to follow this  
willwatters

Open Files

Recommended Posts

How do I open the following file: H:\Visio Viewer Test\VisioTestTemplate.vsd

Try

Run(@comspec & ' /c "H:\Visio Viewer Test\VisioTestTemplate.vsd"','',@sw_hide)

Assuming that your file associations are correct.



Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

shouldnt it be

Run(@comspec & ' /c start "H:\Visio Viewer Test\VisioTestTemplate.vsd"','',@sw_hide)
Your version just brings up a command prompt on my computer


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

This method uses the file association:

$file = "H:\Visio Viewer Test\VisioTestTemplate.vsd"
Run("rundll32 url.dll, FileProtocolHandler " & $file)

The code is normaly used for opening a website:

$url = "http://www.autoitscript.com"
Run("rundll32 url.dll, FileProtocolHandler " & $url)

Share this post


Link to post
Share on other sites

Your version just brings up a command prompt on my computer

If quoted strings are passed to Start, it'll use them as a window title for a new command prompt.

START ["title"][/Dpath] [/MIN] [/MAX] ...etc...

"title" Title to display in window title bar.

@ w0uter: I usually add empty quotes to circumvent this behavior.

Compare these two lines:

Run(@comspec & ' /c start "C:\Program Files"',"",@sw_show)
  Run(@comspec & ' /c start "" "C:\Program Files"',"",@sw_show)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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...