JScipt por favor

Ah. Math. Trig. All that fun stuff. Gotcha.

Thanks, George.

(Currently prescribing Guinness for myself.)

Howdy then. andnbsp;Easy question for mundy mornin.

Have you got a working JScript script? andnbsp;I can’t even work out how to get a andquot;hello dingbatandquot; running.

Language=JScript
function Main(3DCApp)
{
window.alert(andquot;Hello thereandquot;)
}

This doesn’t work as my host is not a browser. andnbsp;What’s the object for the output stream? andnbsp;Need output to debug more complicated script.

George

Umm. No I don’t. Sorry. I think I had one at one point, but I completely forget how I got it working.

Sorry,

Richard

Sorry I can’t help with the JavaScript, but do you mind if I ask why you would want to use JScript instead of VBscript? I’m a bit of a programming doofus these days (OOP = oops!), so forgive me if it’s a dumb question, but since 3DC supports scripting with VBscript, what advantages does JScript offer with a 3d development tool that VBscript doesn’t have? Have I totally missed the boat here?

Perhaps I should ask my nurse for more medication?

Can’t work out how to do a message box, so I worked around it by writing to a text file. andnbsp;A bit retro, but at least I don’t need to find a punch card reader with a driver for Win ME….

Here’s a working script. andnbsp;It just writes the name and ID of all objects to a file. andnbsp;now I’ve got that working I assume everything else will be easy <!– s:-) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":-)" title="Smile" /><!– s:-) –>

Language=JScript

function Main(3DCApp)
{

andnbsp; andnbsp;var fso, tf;
andnbsp; andnbsp;fso = new ActiveXObject(andquot;Scripting.FileSystemObjectandquot;);
andnbsp; andnbsp;tf = fso.CreateTextFile(andquot;c:\Program Files\3DC\Scripts\aaatestfile.txtandquot;, true);
andnbsp; andnbsp;var Scene ;
andnbsp; andnbsp;var CurrentObject;// andnbsp; andnbsp; andnbsp; ‘loop through objets till found
andnbsp; andnbsp;var TotalObjects;// andnbsp; andnbsp; andnbsp; andnbsp;’the total number of objects
andnbsp; andnbsp;var Counter;//
andnbsp; andnbsp;var Message;//
andnbsp; andnbsp;var ItsName;//
andnbsp; andnbsp;var ID;//
andnbsp; andnbsp;
// andnbsp; andnbsp;’get the scene
andnbsp; andnbsp; Scene = 3DCApp.GetActiveScene();

// andnbsp; andnbsp;’get the active object count
andnbsp; andnbsp;TotalObjects = Scene.GetGroupCount();
andnbsp; andnbsp;tf.writeline(andquot;Total Groups andquot;+TotalObjects);
andnbsp; andnbsp;for (Counter = 0; Counter [ TotalObjects; Counter++) {
andnbsp; andnbsp; andnbsp; andnbsp;CurrentObject=Scene.GetGroup(Counter);
andnbsp; andnbsp; andnbsp; andnbsp;ItsName = CurrentObject.GetName();
andnbsp; andnbsp; andnbsp; andnbsp;ID=CurrentObject.GetID();
andnbsp; andnbsp; andnbsp; andnbsp;Message=andquot;Object andquot; + Counter +andquot; is called andquot; + ItsName + andquot; andnbsp;its ID isandquot; + ID
andnbsp; andnbsp; andnbsp; andnbsp;tf.writeLine(Message);
andnbsp; } andnbsp;//next Counter
andnbsp; andnbsp;tf.Close();
}

I don’t know what your medication is. andnbsp;Tonight I’ve been on Ciney blondes, which I heartily recommend. andnbsp;(It’s a beer, not a human).

My main reason for using J script at the moment is that VB Script doesn’t have an arccos function, and the derived function I wrote didn’t work. andnbsp;Since the script isn’t very long I thought I’d just translate it to Javascript. andnbsp;It would have been easier to just write it as a plugin in VB6, but it might be useful for animation – if one day I decide I want animate something.

Take another sip.
CU
George

not really.

Alert is a method of the window object, which, if I get the lingo right, is an object provided by the browser to the script interpreter. andnbsp;Because it’s the top object, or for some other reason, the interpreter doesn’t have to see

window.alert

Thanks anway.
George

I know to make a MessageBox with java on the web its
Alert(andquot;messageandquot;)
That any help?

You must be logged in to reply in this thread.