jgus Posted October 22, 2004 Share Posted October 22, 2004 This should be simple, but I'm not figuring it out. How do I open an MSWord .doc file? Not just MSWord itself, but a specific .doc file. It appears the run command will only open an executable file and I can't seem to figure out any parameters to have it open a specific file. Link to comment Share on other sites More sharing options...
SlimShady Posted October 22, 2004 Share Posted October 22, 2004 This is an example: Run(@ComSpec & ' /c Start "" "' & @MyDocumentsDir & '\document1.doc"', @SystemDir, @SW_HIDE) Link to comment Share on other sites More sharing options...
Holger Posted October 22, 2004 Share Posted October 22, 2004 @Larry: thank you very much Now I can use instead of an external program (I used "Shelexec" before: http://www.naughter.com/shelexec.html)your lines Great...Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
ezzetabi Posted October 22, 2004 Share Posted October 22, 2004 (edited) Or via DllCall $sCmd = 'c:\path\file.doc' $sVerb = 'Open' $sArg = '';Arguments $sFolder = '' $aRet = DllCall ("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", $sVerb, "string", $sCmd, "string", $sArg, "string", $sFolder, "long", @SW_SHOWNORMAL) If $aRet[0] <= 32 Then MsgBox(16 + 4096,'Error','A problem occurred opening ' & $sCmd) EndIf Edited October 22, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
Josbe Posted October 22, 2004 Share Posted October 22, 2004 Or via DllCall$sCmd = 'c:\path\file.doc' $sVerb = 'Open' $sArg = '';Arguments $sFolder = '' $aRet = DllCall ("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", $sVerb, "string", $sCmd, "string", $sArg, "string", $sFolder, "long", @SW_SHOWNORMAL) If $aRet[0] <= 32 Then MsgBox(16 + 4096,'Error','A problem occurred opening ' & $sCmd) EndIf<{POST_SNAPBACK}>I like 'RunByAssoc' function, like an alternative to v3.0.102... But, cool tip here with DLLCall. Thxs, ezze. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
megahyperion Posted October 28, 2004 Share Posted October 28, 2004 This works perfect when I tried to open a .htm file i have on my hard drive but when I try to open a .txt or a .doc file I get this error Line 166 (file"C Myprogramdir~) If Run($szRegValue & $szFile) Then Return 1 Error: Unable to execute the external program. The system cannot find the file specified. Link to comment Share on other sites More sharing options...
megahyperion Posted October 28, 2004 Share Posted October 28, 2004 Ay screw it I just renamed the help file to .htm and it works. At leat now the help file is non-editable lol Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now