FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Switch to a running application

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows
View previous topic :: View next topic  
Author Message
moldy
Newbie


Joined: 04 Jan 2008
Posts: 7

PostPosted: Sat Jan 05, 2008 11:03 am    Post subject: Switch to a running application Reply with quote

Hi there,

I am new to scripting, and have a query i hope someone will be able to help me with.

I have written a script which will run a command line executable and switches. This loads a program which starts recording via a webcam.

I want to write a script which will, when run, switch to the running application and simulate pressing the Escape key. THis is all it needs to do to stop recording and close down the program.

However, I am having no luck working out how to switch to the running process. i'm not sure if the .focus function or .isprocessrunning should be used - or whatever. I'm stumped.

If anyone has any ideas then i would be grateful.

Cheers, Moldy.
Back to top
View user's profile Send private message
moldy
Newbie


Joined: 04 Jan 2008
Posts: 7

PostPosted: Sat Jan 05, 2008 11:32 am    Post subject: Reply with quote

please dont worry...i have found the answer. for anyone that might find this useful my code is as follows:

var WshShell = new ActiveXObject('WScript.Shell');
function focusWindow()
{
WinTitle = "VirtualDub";
WshShell.AppActivate(WinTitle);
}

function stopRecording()
{
WshShell.SendKeys("{Enter}");
WshShell.SendKeys("{Esc}");
}

focusWindow();
stopRecording();

This switches the focus to the window whose title is VirtualDub, then presses the following key sequence: Enter, Esc.

Cheers. M.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group