Jump to content

Recommended Posts

Posted

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.

Posted (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 by omikron48
Posted

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?

Posted

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.

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
  • Recently Browsing   0 members

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