How do I execute a toasterscript function from a c/c++ program?

kirtap

New member
I'm trying to figger out how to exucute a ToasterScript-command from a C++-program. I've read thru the SDK-ToasterScript-manual, but the info there (what I've concluded) only includes info on how to implement addtioional toasterscript-commands in C++. I would appriciate some additional examples, if possible, with includes and such.

What I realy want to do is execute the Take-command from an external application.

Any pointers?
 

Blake

New member
kirtap,

One solution is adding a keyboard shortcut, perhaps alt+Y, to the switcher in a userscript.

CreateShortCut("Alt Y", code( Take() ), "OrderedFocus", 1500) //should work there

In your program, just send the keystroke to VT.

Hope that helps.

-Blake
 

kirtap

New member
Problem almost solved

I solved this problem by using the Remote TScript-example in the SDK. However, this uttered an unexpected result: Scripts executed in a module/class this way won't execute in the same scope as most other scripts. The scope is even so poor that variables dont survive between calls if the (*ToasterConnection).SendMessage()-function.

Any ideas on how to expand the executing scope of the script to include atleast the scope of normal scripts executed inside VT?
 

PIZAZZ

NewTek System Integrator
Email Andrew or Aussie for help.

That is the best advice I could give you.
 

UnCommonGrafx

Wandering about
In the past, I would have referred you to The Aliens. But no more: I want someone from NewTek to answer you here as there are a lot of us pouring over the SDK right now trying to figure it out.

Kirtap, wait until you need a button....

I'm gonna add my neophyte question elsewhere. I support your question and really want answers (examples) here.
 

madoka

New member
execute ToasterScript from c++

I tried to compile a c++ program to execute toasterscript commands but I was unable to do that, even following SDK documentation
Could you tell me step by step, how you compiled it?

Thank you very muh in advance
 

kirtap

New member
Execute TScript in C++

Take a close look at the Remote TScript exampel in the SDK, and you will get the idea. It's almost too easy to open the projekt in MS Visual C++ and compile the program.

The magic comes from

COPYDATASTRUCT cds;
cds.cbData=strlen(Temp)+1;
cds.lpData=Temp;
cds.dwData=m_MessageID;
return SendMessage(m_ApplicationWindow,WM_COPYDATA,NULL,(long)&cds) ? true : false;

where temp is the command to send, and the m_ApplicationWindow is the window in VT you wish to receive the command. You could get the handle to this window from

m_ApplicationWindow=FindWindow(Window,NULL);

where Window is a string containing the window name. Se the ToasterConnection.h file in the SDK for valid window names.
 

madoka

New member
Re: execute ToasterScript from c++

Thank you for your help!

My problem is that I get an error every time I try to compile a program with VT SDK.

Could you give me your email, please? I would want to ask you for some help.


Best regards,


Madoka
 

Bobt

Creator of BobFX for VT
Does anyone know if you can use a Post message rather than
a Sendmessage?

bob
 
Top Bottom