THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/07/2012 at 15:34, xxxxxxxx wrote:
I figured 
I don't get any errors anymore that I didn't announced the var but the string I added to it with clicking on the apply button don't get through to my test in the main function.
Problem is, if I not put the code into the main function. I get those odd errors again for some of my variables that "a variable or function is expected" 
Here is the code. It gets the position and rotation of the current object and gives them out into a text file (in the format of how AE is reading ascii keyframes). Plus your code of course, I actually just pasted my stuff into it, just to test if I can get the basics to work 
And yes I downloaded the 9.5 SDK and I am looking through it but haven't found an answer to that yet 
var test;
enum
{
MYTEXT = 1002,
MYVALUE = 2000,
MYCOMBOBUTTON = 2003,
APPLYBUTTON = 2004,
_End_
}
class MyDialog : GeModalDialog
{
public:
MyDialog();
var stored_x, stored_y, stored_z;
CreateLayout();
Init();
Command(id, msg);
}
MyDialog::MyDialog()
{
super();
}
MyDialog::CreateLayout()
{
SetTitle("Scale Units");
AddGroupBeginV(1000, BFH_SCALE|BFV_SCALE, 1, "", 0);
{
AddGroupBorder(BORDER_GROUP_IN);
AddGroupBorderSpace(4,4,4,4);
AddGroupSpace(4,4);
AddGroupBeginV(1001, BFH_SCALE|BFV_SCALE, 2, "", 0);
{
AddStaticText(MYTEXT, BFH_LEFT, 0,0, "X", 0);
AddEditNumberArrows(MYVALUE, BFH_SCALE, 80, 0);
}
AddGroupEnd();
AddComboBox(MYCOMBOBUTTON, BFH_SCALE|BFH_FIT, 0, 0);
AddItem(MYCOMBOBUTTON, 0, "First");
AddItem(MYCOMBOBUTTON, 1, "Second");
AddItem(MYCOMBOBUTTON, 2, "Third");
AddButton(APPLYBUTTON, BFH_SCALE|BFH_FIT, 0, 0, "Apply");
AddDlgGroup(DR_DLGGROUP_OK); // Enter button
AddDlgGroup(DR_DLGGROUP_CANCEL); // Cancel button
}
AddGroupEnd();
return;
}
MyDialog::Init()
{
SetInt(MYCOMBOBUTTON, 0, 0, 3, 1);
SetPercent(MYVALUE, 100.0, MINREAL, MAXREAL, 0.01);
return;
}
MyDialog::Command(id, msg)
{
var child = GetInt(MYCOMBOBUTTON); //Gets the children of the combobutton
switch (id == MYCOMBOBUTTON)
{
case 0:
if(child == 0)
{
println("First Option Selected");
SetPercent(MYVALUE, 0.0, MINREAL, MAXREAL, 0.01);
}
break;
case 1:
if(child == 1)
{
println("Second Option Selected");
SetPercent(MYVALUE, 500.0, MINREAL, MAXREAL, 0.01);
}
case 2:
if(child == 2)
{
println("Third Option Selected");
SetPercent(MYVALUE, 100.0, MINREAL, MAXREAL, 0.01);
}
}
if(id == APPLYBUTTON)
{
println("You Clicked the Apply Button");
var test = "Test";
}
return;
}
main(doc,op)
{
var dlg = new(MyDialog);
var result = dlg->Open(-1, -1);
var userEndTime = 90; //Change this value to record the number of frames to print
var obj = doc->GetActiveObject();
if(!obj)return FALSE; //NOTE*: Use "False" for older C4d versions!!!
var arr = new(array,userEndTime); //The array that holds the vector positions of the object
var arr2 = new(array,userEndTime);
var frames = new(array,userEndTime); //The array that holds the frame number the scrubber is on
CallCommand(12501); // set the time slider to zero
var i = 0;
for(i=0; i<userEndTime; i++)
{
var frame = doc->GetTime()->GetFrame(doc->GetFps()); //Get the current frame
frames[i] = int(frame);
var pos = obj->GetPosition();
arr[i] = pos;
var rot = obj->GetRelRot()*57.2957795;
arr2[i] = rot;
CallCommand(12414); // Goto Next Frame
var redraw = DrawViews(DA_STATICBREAK);
EventAdd(EVENT_ANIMATE);
}
CallCommand(12501); // set the time slider back to zero
var text = doc->GetFilename();
text->SetFullString("C:/wsd"); are used
if(!GeFileExist(text,TRUE))GeFileCreateDir(text);
text->AddLast("Positions.rtf");
var file=new(BaseFile);
var newline = "\n";
var AE_Header = "Adobe After Effects 8.0 Keyframe Data\n Units Per Second 23.889\n Source Width 640\n Source Height 360\n Source Pixel Aspect Ratio 1\n Comp Pixel Aspect Ratio 1\nTransform Position\n Frame X pixels Y pixels Z pixels \n";
var AE_Footer = "End of Keyframe Data";
var AE_Orient = "Transform Orientation\n Frame X degrees \n";
var tab = " ";
var j;
file->Open(text,GE_APPEND);
file->WriteString(AE_Header);
file->Close();
for(j=0; j<userEndTime; j++)
{
var myframes = stradd(tostring(frames[j])," ");
var coord = stradd(tostring(arr[j].x,".1f")," ",tostring(arr[j].y,".1f")," ",tostring(arr[j].z,".1f"),tostring(newline));
if(!file->Open(text,GE_APPEND))
{
file->WriteString(tab);
file->WriteString(myframes);
file->WriteString(coord);
file->Close();
}
file->WriteString(tab);
file->WriteString(myframes);
file->WriteString(coord);
file->Close();
}
file->Open(text,GE_APPEND);
file->WriteString(AE_Orient);
file->Close();
for(j=0; j<userEndTime; j++)
{
var myframes = stradd(tostring(frames[j])," ");
var rotation = stradd(tostring(arr2[j].x,".1f")," ",tostring(arr2[j].y,".1f")," ",tostring(arr2[j].z,".1f"),tostring(newline));
if(!file->Open(text,GE_APPEND))
{
file->WriteString(tab);
file->WriteString(myframes);
file->WriteString(rotation);
file->Close();
}
file->WriteString(tab);
file->WriteString(myframes);
file->WriteString(rotation);
file->Close();
}
file->Open(text,GE_APPEND);
file->WriteString(AE_Footer);
file->WriteString(test);
file->Close();
}