Jump to content

Run a default editor (i.e. MS Word for .DOC)


Liibo
 Share

Recommended Posts

Hallo guys,

I am trying to run default associated program (like MS Word for .DOC files), but I have not found better solution then one below. At command line, I can write command like "Start file.doc" and it run MS Word with this file, I wonder if this could be done (or how, please) in AutoIt?

Thanks for your help.

$prikaz="c:\My Documents\Counters_gd.doc"   ; or something similar to that
if StringRight($prikaz,3)="DOC" Then RunWait(@COMSPEC & ' /C Start winword "' & $prikaz & '"')
If FileExists("c:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe") AND StringRight($prikaz,3)="PDF" Then RunWait(@COMSPEC & ' /C Start "c:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" "' & $prikaz & '"')
Link to comment
Share on other sites

Do a search for _ShellExecute() and _Run() in the Scripts and Scraps forum. That should give you exactly what you are looking for.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

@ JSThePatriot - Waw, thank you, it was soo fast - I just added all 200 lines of _ShellExecute function to my script and it works at first try! B)

@ Valuater - Oh yes, of course I've tried that (but it didn't work as expected) :-)

Edited by Liibo
Link to comment
Share on other sites

@ JSThePatriot - Waw, thank you, it was soo fast - I just added all 200 lines of _ShellExecute function to my script and it works at first try! B)

@ Valuater - Oh yes, of course I've tried that (but it didn't work as expected) :-)

No problemo. Glad to be of service. Valuater was on the right track, just your script would have needed a few more lines. I have written a simple one using the @ComSpec before, but I think the _Run() or _ShellExecute() would be better. I am glad it all worked out for you.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...