DCSS

Open file in default Office program

3 posts in this topic

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

That did it!!!!!

Thanx BrewManNH.   Much appreciated.

 

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

  • Similar Content

    • Ahile07
      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.
      Flo
    • aiter
      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 (3.3.14.2) 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:(3.3.14.2):C:\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.
       
    • aiter
      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.
    • Myicq
      By Myicq
      This question may be trivial: I am working on an application where customers can define parameters etc in Excel files (also). But the definition may be done in an office environment, whereas the definition file may be used in production, where Excel may not be available.
       
      So, in a compiled script (including excel.au3), can I read excel XLSX files (read-only is OK), or do I need certain components like ADO, or.. am I out of luck ?
      I can imagine others have been in similar situations, so would like to know the practicalities of the problem. If impossible, I will have to come up with something else / workaround.
       
    • Mian
      By Mian
      I wrote a script which deletes a single or range of columns from an excel file, however, I found that the file is frequently modified and the automation is not smooth.
      The task can be achieved in two ways, please help me in whichever is simple.
      1) Instead of column number, I delete single column or range of columns on the basis of heading in the first cell of the column. This way I will be able to select the desired columns even if the column number changes.
      2) I select the columns on the basis of heading in the first cell of each column and paste it in a new sheet or new excel file. This way I will get the desired column where ever they are in the file.
      Thanks