0

Okay, I finally got my external program to open but how do I actually get it to run???

What I am trying to do is open a syncsort file called mjwsorter.srt (I can finally get it to open). Next, however, I want the program to execute... which is done by clicking the run button in syncsort. Is there some way to do this action in VB6? I want the process to be automated... no user interaction.

Here is what I have to open the file:

Option Explicit

Dim shell, fso
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
shell.Run """syncsort/run \\wgc-rtn-31\backups\bbms\archive\2005\Copy of 09-2005(Sep)\Syncsort routines - Tested\mjwmerge.srt"""

Thanks!

Dan

3
Contributors
3
Replies
5
Views
12 Years
Discussion Span
Last Post by DanH
1

Hi,
I haven't used this before but you could possibly use the 'SendKeys' comand.

Syntax:
Sendkeys keystroke[, wait]

Parameters:
keystroke - Required, String containing key strokes. eg Enter
wait - Optional, if True, control is not returned to the program until keys have been processed. use False for imediate control to be returned.

Hope this helps in some way.

Cheers
pG

0

He's absolutely correct, but beyond that, you may want to have a look at the setforegroundwindow, setactivewindow, and the setfocus API calls. Basically, this is to ensure that the window you are trying to send keys to is the active window. It MUST be the active window, in fact. The sendkeys command is just like a person sending data from the keyboard. So, if you would normally have to press tab, say, 3 times to make the "run" button become the button of focus, you would have to sendkeys 3 tabs in order to make that button the focus. If you need a list of the special codes (such as enter and tab) check out this site: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp

0

Okay... got it to work. It turns out that syncsort had some documentation on how to run it. I needed to get on the server side first though.

Thanks for your help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.