Launch app (Shell)

C

Craig

I have a general question regarding the shell execute command...

I'm using Acess XP. I'd like to launch (for example ScanPST.exe) and I'd
like to know if there is a way to control dialog box selections and other
functions via code. This way the process will be completely automated.

For example, when ScanPST.exe is launched I want to be able to check off
certain dialog boxes that pop-up so that the user doesn't have to.

Hope this makes sense and thanks in advance for the help.
 
T

Tom van Stiphout

On Sat, 1 Mar 2008 16:44:01 -0800, Craig

Assuming ScanPST (which I have never heard of) doesn't have an
Automation interface, your only choice is to use SendKeys. Quite
dangerous and fragile, but perhaps your only choice here.

-Tom.
 
C

Craig

Thanks.

ScanPST is an app that scans Outlook PST files to check for corrupt bits.
Just using it as an example. Maybe I should have chosen something like adobe
acrobat.

If I had chosen acrobat for example, and wanted to open a specific
multi-page pdf file, and then (through code) select the menu and dialog
options to extract the multi-page pdf into single pdf files - again without
user interaction - is this possible only through sendkeys?

Not sure what an "automation interface" is exactly...??

Thanks.
 
T

Tom van Stiphout

On Sat, 1 Mar 2008 21:22:00 -0800, Craig

Some applications, e.g. most Office applications, are Automation
Servers, which you can programmatically talk to using their COM
interfaces.
Pseudo-code:
dim o as object
set o = CreateObject("Word.Application")
o.OpenDocument("c:\test.doc")
'etc.

If your app doesn't have this great capability (e.g. Calculator),
SendKeys is one of your very few options.

The full version of Acrobat has an Automation interface; I don't know
about Acrobat Reader.

-Tom.
 
J

JonWayn

I personally hate SendKeys and there is a less friendly method to do this -
whether the app exposes an automation object or not. I have done this using
API calls. When you shell out to an app, there are API functions that can
return a unique numeric identifier for that window. Using this id, you can
call other API functions that manipulate the menus of that window in the same
way a user can. It is a cleaner option than SendKeys. SendKeys is buggy,
inelegant, and often fails
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top