Send Keys to a specific application (1 Viewer)

petehilljnr

Registered User.
Local time
Today, 10:49
Joined
Feb 13, 2007
Messages
192
Gidday!

I want to send keys to a specific application that is running, regardless of what the user is doing ... I was kinda hoping there might be some sort of API for this?

Here's the background to this:
I've got a lot of roading video data stored as avi's. One avi file contains many different roads and depending on how it was surveyed, the road may not be a continuous run. However, I want to splice these videos so they are a continuous run.
Luckily, I have reference file with the name of the road name, distance down the road, and the frame number for every video file.
I have managed to find and use a piece of software that spliced the video files up which was command line based and now one road may have the following files:
Peter_Street_1.avi : 0 - 500m
Peter_Street_2.avi : 500 - 1000m

Now I want to join these files up, except I haven't been able to find a command line based video 'joiner'. The software I do have is perfect (as it doesn't re-render the video files) but it isn't command line based, hence I thought I could open it and use the send keys commands to control it for me.

Note - I'm planning to set it running and leave it running overnight.

Being that there are a large number of videos to process, I'm concerned that at some stage, the application I want to send keys to to control may not have the focus when it needs to, and things will turn to custard.

Hence, is there anyway to guarantee or force send keys to a specific application?

Regards,
Pete
 

KeithG

AWF VIP
Local time
Today, 10:49
Joined
Mar 23, 2006
Messages
2,592
You could use the SendMessage API which will send one of the numerous window messages to a window. I don't understand how your code is going to know when to send the keystroke with SendKeys. Are you utilizing some event?
 

KeithG

AWF VIP
Local time
Today, 10:49
Joined
Mar 23, 2006
Messages
2,592
Being that there are a large number of videos to process, I'm concerned that at some stage, the application I want to send keys to to control may not have the focus when it needs to, and things will turn to custard.

You can use the AppActivate function before the Sendkeys function to make sure you application has focus.
 

petehilljnr

Registered User.
Local time
Today, 10:49
Joined
Feb 13, 2007
Messages
192
You could use the SendMessage API which will send one of the numerous window messages to a window. I don't understand how your code is going to know when to send the keystroke with SendKeys. Are you utilizing some event?

It's looping through a list.

The pseudo code looks something like:

1) Gather the list of roads that need processing (from table of combined reference files)
2) Get next road from that list
3) Pass road to routine to split video files (to get continuous run based on reference file remembering that 1 road may be part of many video files)
4) Combine split videos to create 1 video file for road.
5) Go back to step 2.

At the moment, I've managed to get the road parts from the various video files and order them so if they were combined they'd run continuously in one direction. Step 4 is the only part I'm thinking there might be problems with (the combining).

I'll have a crack at both of your suggestions - Cheers for the quick responses!
 

Users who are viewing this thread

Top Bottom