  | | | Jscript on Linux, a thousand questions | Jscript on Linux, a thousand questions 2004-04-15 - By Christian Rittener
Back Thanks a lot Bradley, I now feel much better. Only one question remains: where does that Jscript on Linux come from? it can't be Microsoft's, yet it includes ActiveX...? is it included with Linux, or only comes with XSI installation? searching for "Jscript Linux" or "Javascript Linux" on google returns basically nothing...
Christian
Bradley Gabe wrote: > I've been programming in jscript on linux for the past year and there > are only a handful of caveats to be mindful of when coming from the > windows side: > > 1- The jscript version (3.0) is older than the windows (5.0+). So > you're missing some functionality on the jscript objects such as > string manipulation and array tools. > > These can be easily overcome by extending your jscript object > prototypes, which is documented well enough in the ms online jscript > reference. > > Less easily overcome is the lack of error handling in jscript version > 3.0, so you're forced to be more careful on how you structure your > script logic. I know I take a lot of special care to check all of my > data and pointers from one block of a script to the next... but > honestly, that's good programming edicate anyway. > > 2- Backslashes are different. Windows only reads 'em one way, linux > can handle either direction (or is it the opposite... I never > remember anymore). > > 3- File I/O on linux isn't as accessible as windows. So just avoid > doing anything that heavily relies on reading in text files and > parsing lines into strings. You can do it, it's just not as fast and > robust as it > could be. > > 4- Be wary of string characters for newline (\n) and tab (\t) and such > that might differ between linux and windows. Just make sure to test > that they work cross platform before using them. > > Everything else is the same... in fact, you can be mostly sure that > anything you build on the linux side will work on windows. This is not > as true the other way around. > > To answer some of your questions more directly: > >> Is this still the case? if yes, what's the equivalent of >> >> var ch_stuff = new ActiveXObject("XSI.collection") ; >> >> in Jscript on Linux ? >> > The same command works on linux. I use it at least a dozen times a day > while coding. > >> What about file I/O? starting a shell command and returning from the >> shell? are these issues easier to address with ActivePython? As I >> understand, it is truly "Active" only in Windows... >> >> > I've run commands through an external shell using the System() call in > XSI. These commands were written in Python, so any functionality you > don't get for file I/O out of jscript or ActivePython within XSI, you > can always build them externally and just call them into your script > that way. > > > All things considered, I've been treating my switch to the linux > version > of jscript as lemonade from lemons. The lack of more complete jscript > objects forced me to learn how to push jscript to the limits and > extend > the functionality of the language itself, and I'm certainly better off > for that knowledge now as I use it all over the place, above and > beyond > my original intentions. > > Also, the lack of error handling has forced me to learn scripting > techniques that are more robust, ways of hooking into objects without > ever risking raising an error. For doing all of that research, I've > developed a much deeper understanding on how to navigate and hook into > the object model and get things done, even in places we're "not > supposed > to go" yet. > > Best of all, it's turned me into a speed demon. I have an array of > techniques that can walk a script through a scene with 2000 nodes and > filter out any info I need in less than a tenth of a second. That > means > I can build interactive tools without having to resort to external SDK > coding... but that's next anyways. > > -Brad
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|
 |