Question about Java Script

Next
 From:  fcwilt
12075.1 
Hi,

You posted a file with this bit of code:

var path = moi.geometryDatabase.currentFileName;


// Strip off file extension.
var base = path.substring( 0, path.lastIndexOf('.') );

// Get file extension.
var ext = path.substring( path.lastIndexOf('.') );

My general purpose Windows development tool has a class for manipulating file names and such.

You can set the property which accepts an entire file specification (server, drive letter, path, name, extension, etc.).

Then you can access several properties for the parts, such as file name and extension.

I am assuming since you coded those function your Java Script has no such class.

Is it possible to write such a class to use in your Java Script, so you need not code functions like you did above?

Thanks.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12075.2 In reply to 12075.1 
Hi Frederick,

re:
> Is it possible to write such a class to use in your Java Script, so you need
> not code functions like you did above?

Yes, I will add in some more file name processing functions to be available to scripts.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
12075.3 In reply to 12075.2 
Hi Michael,

Are classes even a thing in your Java Script?

If the exist can they be used in "end user scripts"?

JOOC is MoI written entirely in Java Script or is the some C++ code at the heart of it?

Thanks.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12075.4 In reply to 12075.3 
Hi Frederick,

re:
> Are classes even a thing in your Java Script?

They are, although the JavaScript engine that MOI uses is old and only supports the ES5 version of the JavaScript language.

In ES6 there is a new "class" keyword but it doesn't do a whole lot.

https://stackoverflow.com/questions/31908058/classes-in-javascript-ecmascript-5#31908169


> If the exist can they be used in "end user scripts"?

Yes, if you keep to the ES5 level.


> JOOC is MoI written entirely in Java Script or is the some C++ code at the heart of it?

There is a lot of C++ code at the core level, JavaScript is used for for controlling program flow, UI, and glue logic.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  fcwilt
12075.5 In reply to 12075.4 
Hi Michael,

So in addition to being a GUI wizard, a Java Script connoisseur, you are a C++ master?

Amazing.

Once I discovered Delphi I said goodbye to C++ and never looked back. Any one that can deal with C++ deserves applause.

Is a "Java Script Engine" something that is compiled into your program or is it something else?

Thanks for the ongoing education.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12075.6 In reply to 12075.5 
Hi Frederick,

> Is a "Java Script Engine" something that is compiled into your program or is it something else?

It's a library written itself in C++ that implements the JavaScript language.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  fcwilt
12075.7 In reply to 12075.6 
Hi Michael,

OK I think all is clear.

Frederick
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All