[aztec-users] Re: js

  • From: "Phillip Martin" <pmartin@xxxxxxxxxxx>
  • To: <aztec-users@xxxxxxxxxxxxx>
  • Date: Tue, 9 Jul 2002 15:31:53 +1000



> -----Original Message-----
> From: aztec-users-bounce@xxxxxxxxxxxxx
> [mailto:aztec-users-bounce@xxxxxxxxxxxxx]On Behalf Of Dominique Boutin
> Sent: Tuesday, 9 July 2002 7:41 AM
> To: aztec-users@xxxxxxxxxxxxx
> Subject: [aztec-users] js
>
>
>
> I looked again a bit into the js thing, but I did not come very far.
>
> Jordan wrote some time ago:
> ---
> 1. just write your own js function,
> 2. give it a name,
> 3. edit the key config file to use that command,
> 4. and there you go!
> ----
>
> Is there a mechanism that loads/runs/evaluates scripts from a certain
> directory at startup?

No, unfortunately there isn't.

> How do I have to manipulate the cfg file, in order to have keys calling js
> functions? (a GUI for that would be great !!!)

Again, this can't be done at the moment.

I think I will whack in a simple mechanism for loading scripts on startup,
and for executing scripts as well. It may not be the perfect way to do it,
but at least there will be something there.

> Script Console:
> It would be cool being able to recall/reprint the last command (even if it
> did not work) ... with crtl+arrowUp or something.

Aye, I think there needs to be a more sophisticated script editor as well.

>
> Commands:
> How can I have acces to all scene objects? couldn't find something like:
> Scene.allObjects
> or Scene.selecetAll
> How can I get the name of an object - or how can i select an
> object by name?

First here is a little handy function from common/scripts/test.js:

function showParams(obj) {
  for (x in obj)
    print(x + ": " + obj[x]);
}

It will come in very handy.

------

To select an object do this:

Scene.selectObject('objectname');
or
Scene.selectObject(actualJavaScriptAztecObject);

------

This is is very non obvious, to select all objects, do this:
Scene.KEditSelectAll();

Note the very horrid name of it. This is the same name of the function that
is bound to a keypress when you customise your keys.

------

Here is an example of getting all the selected objects in a scene:

function printSelectedObjects() {
  selObjs = Scene.getSelectedObjectList();

  for (x in selObjs) {
    print('Object ' + selObjs[x].Name + ':\n');
    showParams(selObjs[x]);
  }
}

------


Other related posts: