View Full Version : How do I execute a toasterscript function from a c/c++ program?
kirtap
11-04-2003, 08:17 PM
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
11-07-2003, 01:30 PM
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
12-03-2003, 10:18 AM
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
12-03-2003, 10:54 AM
Email Andrew or Aussie for help.
That is the best advice I could give you.
UnCommonGrafx
12-03-2003, 05:32 PM
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
12-07-2003, 07:31 AM
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
12-07-2003, 01:42 PM
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
12-07-2003, 03:38 PM
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
Does anyone know if you can use a Post message rather than
a Sendmessage?
bob
vBulletin® v3.8.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.