Kaeft Posted August 6, 2010 Posted August 6, 2010 I haven't the fondest as to what I should search for so I'll post and see what I can get. Is there a function that will take a program and open a file. Like if I wanted to open a document for microsoft office it would be something like ProgramOpenFile(title - "microsoft office", text "", File to open "stuffnjunk.doc"). Or is Controlsend an "alt f o" then ControlSetText "the filename/path" the only way to do that? Thanks in advance.
omikron48 Posted August 6, 2010 Posted August 6, 2010 (edited) Usually, those programs accept commandline parameters which can also be used for opening files. Have you tried: $officepath = 'C:\Program Files\Microsoft Office\Office12\" ;whatever the path to MS word is $docfile = "test.doc" ;file you want opened Run($officepath & "winword.exe " & $docfile) EDIT: If you are looking for UDFs for Word or Excel, check the _Word* or _Excel* functions in the help file. As for other programs, not everything has a UDF of function, most specially the ones you normally do via commandline arguments. Edited August 6, 2010 by omikron48
Kaeft Posted August 6, 2010 Author Posted August 6, 2010 Usually, those programs accept commandline parameters which can also be used for opening files. Have you tried: $officepath = 'C:\Program Files\Microsoft Office\Office12\" ;whatever the path to MS word is $docfile = "test.doc" ;file you want opened Run($officepath & "winword.exe " & $docfile) Ok yeah that would be pretty simple. If all else fails I will definitely use that. Thanks! Would that work if the program was already running?
muhmuuh Posted August 6, 2010 Posted August 6, 2010 I use the ShellExecute function I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.
omikron48 Posted August 6, 2010 Posted August 6, 2010 That's if the program you want is associated to that particular file type. I'm tackling the case where you want an arbitrary program opening a particular file.
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