PDA

View Full Version : TScript Commands to Other Windows


John Perkins
01-06-2006, 01:08 AM
I saw a request for sending commands to other windows from TScript so I thought I would post this plugin for VT4.6.

Last year I played around with sending commands and variables between windows so I stripped out some (mostly) broken functions and here it is.

Put this into the Plugins/VT folder and you will gain a cross window command like this:

SendScript( <the module name>, <script command>)
For example - SendScript("Switcher_Tabbed","Auto()")

You can call this from any script you like, and if a switcher is open, it will respond. If you format the SendScript command wrong, it will let you know there is a syntax error, but unfortunately there is no error returned if the command fails in this version. :-(

I've also noticed a few new window names you can address. the full list (I think) as of VT4.6 is:
"Desktop2"
"StretchyFileBin"
"ColorChooser_Global"
"AboutWindow"
"Preferences"
"Switcher_Tabbed"
"Desktop2_MenuBar"
"VideoEditor"
"RecordPanel"
"WaveformVectorScope"
"ToasterVision"
"AudioMixer3"
"VideoEditor_DDR"
"BackgroundGenerator"
"KeyerControl"
"CrossKeyer"
"CGToaster"
"ProcAmp"
"BobWindow"
"CGMiniToaster"
"ExternalSource2_UI"
"ExternalApp_Aura"
"VideoEditor_BatchCapture"
"GizmosControl"
"Switcher_ExternalVGA_Standalone"
"LiveStreamDlg"
"CGLive::PopupModule" - Title Templates! Any commands?


An advanced example of usage is this:

//Pointless remake of the launch command
//Only launches if one isn't already open
AddMenuItem("Open VTStream", code(
SendScript("Desktop2","if(!IsPluginRunning(\"LiveStreamDlg\")) Launch(\"LiveStreamDlg\",\"LiveStreamDlg\"") )
)

If you need to use a quote in the command, escape it with \ before it.

You can also combine lines of script into one long unreadable one as in my example.


Have a ball, I hope it works for you,

kltv
01-08-2006, 03:04 PM
Very cool! I'll give it a try.

Kris

billmi
01-19-2006, 12:10 PM
Thanks John,
I've just started getting my feet wet in ToasterScript, and your posts here are much appreciated.

John Perkins
01-31-2006, 03:05 AM
No problem, I enjoy helping with this stuff. :thumbsup:

In case anyone is interested in making new scripting commands, I've attached the source code for that command.

It should build correctly with Visual Studio 2003. You never can tell from version to version.

vojtek11
02-02-2006, 02:49 AM
Correct me if I'm wrong, but with Your new script command I can address only one instance of each module. I mean I can't open two Videoeditor_DDRs and control each one independently, right?

John Perkins
02-02-2006, 12:29 PM
It could be modified to address more, but I'm severely busy right now.

It addresses modules by a handle. It finds the handle by it's name. Unfortunately all DDR's have the same name. It would be possible to assign them numbers, like when you call DDR1, it goes to the first DDR in the list. DDR2 gets the second, etc.

If you fix it, please repost for us. From talking to you in the past, I think you can do it.

Poke around with Spy++ and you'll see exactly how it finds the modules.

mzafrany
03-13-2006, 07:22 AM
It could be modified to address more, but I'm severely busy right now.

It addresses modules by a handle. It finds the handle by it's name. Unfortunately all DDR's have the same name. It would be possible to assign them numbers, like when you call DDR1, it goes to the first DDR in the list. DDR2 gets the second, etc.

If you fix it, please repost for us. From talking to you in the past, I think you can do it.

Poke around with Spy++ and you'll see exactly how it finds the modules.


Do you have time to fix this so we can send command to several DDRs?
We have a project that need this ASAP.

:help:

mzafrany
03-13-2006, 07:34 AM
I found a way to make this work.

Before sending the "SendScript" command, use:

SetFocusToWindow( "VideoEditor_DDR", n)

Where n is the ddr number. The SendScript command will send the command to the DDR in focus.

:D

vojtek11
03-13-2006, 09:14 AM
Do You have any idea how to check what are the names of the opened DDR windows? Usually they are called "Videoeditor_DDR", "Videoeditor_DDR1", "Videoeditor_DDR2", etc. But sometimes - if old windows are not closed, system creates next numbers in order. Any chance for something that opens the DDR and returns it's name?

Vojtek

mzafrany
03-16-2006, 05:43 PM
I'm trying to use SendScript to control audio mixer with no luck.

I'm using commands like:

SendScript( "AudioMixer3","SetMainSX8Mute( 0 )")

with no change at the mixer.

Any idea?


:help:

John Perkins
03-16-2006, 05:54 PM
Try it locally first, like a test script running in the Mixer skin.

Then try it from sendscript.

I'm not sure, because that was a bit of a hack and not an included NewTek command.

John