Jump to content
Sign in to follow this  

Open file in default Office program

Recommended Posts

I have an AutoIT script that places a drop down menu toolbar on the user screen with links to various web sites important to the users.  The menus and links are kept in .ini files.

Now I want to use the same script to open Word documents and Excel spreadsheets kept on a shared drives.  I was hoping AutoIT would use the default program Windows has associated with a file extension to open the correct program.   I have not been able to do this and cannot find a solution in the Forums, documentation or Examples.   I was also hoping to extend this to PDF and Powerpoint files.    Basically, any program associated in Windows to a file extension.

Is this doable with AutoIT?    Any advise will be much appreciated.

Share this post

Link to post
Share on other sites

ShellExecute should do that for you.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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.

  • Similar Content

    • By Skeletor
      A gui splash screen. Themed after the famous MS Office Suite.
      Three colours to choose from, Red, Blue and Green.
      You can change the labels to your own application.
      Animated side scrolling dots just like MS does.

      Also bundled with this is the KODA form. So you can open up and see the basic structure of this splash screen.
    • By Skeletor
      MS Splash Screens
      The office 2016/17 office suite has made many people turn heads with its functions and especially their splash screen.
      I now present to you, the MS Style Splash Screen. For Rookies, Novices and anyone who wants a ready made splash screen for your gui application.

      You can now download it and also try it out yourself.
      You have three colors to choose from:
      All three colours are from the famous programs.
      I also included the KODA form to you can have freedom with this splash screen.
      Note: the KODA form does not have the three colours as well as the correct blue. 

      Have fun and enjoy.
      Thanks to kaz for updating the side scrolling dots.
    • By Ahile07
      Hello Guys,
      I'm trying to open a document with _WordDocOpen and replace some text in it with _Word_DocFindReplace and then print with _Word_DocPrint and finally close with _Word_DocClose and kill word with _Word_Quit. Works perfectly.
      My question is (can't find an answer anywhere): Can i do those commands in the background so i don't see word opening and replacing everything? Can't find anything in the proprieties of "WordDocOpen".
      Thank you.
    • By aiter
      I have tried to use _Excel_RangFind, but it fails. It even fails in the example in the help file (see example 1).
      This the error
      >Running AU3Check ( from:C:\Program Files (x86)\AutoIt3 input:C:\Program Files (x86)\AutoIt3\Examples\Helpfile\_Excel_RangeFind.au3 +>12:09:10 AU3Check ended.rc:0 >Running:(\Program Files (x86)\AutoIt3\autoit3.exe "C:\Program Files (x86)\AutoIt3\Examples\Helpfile\_Excel_RangeFind.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop "C:\Program Files (x86)\AutoIt3\Include\Excel.au3" (656) : ==> The requested action with this object has failed.: $aResult[$iIndex][1] = $oMatch.Name.Name $aResult[$iIndex][1] = $oMatch^ ERROR My own code fails with a similar message
      Local $aResult = _Excel_RangeFind($oWorkbook, "john") _ArrayDisplay($aResult) Help please.
    • By aiter
      I cannot get  the method movestart to work in my program
      $oRange = _Word_DocFind($oDoc, "3 4") ; return a range $oRange.MoveStart($WdLine,-1) ; supposed to move the start range to the beginning of the line I get an error '... requested action with this object has failed.'
      I have seen this statement used in Word.Udf, but cannot see why my statement is failing.
      Help appreciated.
  • Create New...