This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM. Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 8 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
PrimalScript 2015, v7.1.74, 64bit
Operating system: Windows 10-64bit
I am wondering whether it is possible to run standalone JavaScript codes in PrimalScript and output the result to the PrimalScript "Output" window. For example, I want to run the following code and I need to use the Node.js or any other interpreter except the Microsoft JScript runtime. How do I set this up so that the result of the script is displayed on the PrimalScript "Output" window?
You can use a custom interpreter by navigating to Options -> Environment -> Languages and selecting JavaScript. Off to the right you'll see a section for the Script Interpreter:
Custom_Interpreter.png (26.88 KiB) Viewed 7172 times
Ok, I should have mentioned that I had already tried this suggestion but it still doesn't work. PrimalScript still picks the Microsoft JScript interpreter. This then fails to execute any valid JavaScript code successfully.
I have tried various arguments and Initial Directory paths to no avail. I have tried the following arguments
$file$
node $file$
$filename$ along with $filedir$
Executing my script from the Windows command line using the Node.JS interpreter works without issue as seen in the below screenshot.
It must be a simple setting somewhere but I have been able to figure this out. Please help! Anyone?
Attachments
CommandLine_NodeJS.png (28.17 KiB) Viewed 7150 times
JavaScript_Interpreter.png (262.97 KiB) Viewed 7150 times
I'm sorry about that, I said JavaScript but JScript has the .js extension associated to it. The easiest way to fix this is to instead modify the JScript settings like so:
2016-01-19_10-38-13.png (28.11 KiB) Viewed 7109 times
With these settings I had no issue running a basic console.log('This is a test.'); file.
Perfect! This works now with the above settings. In fact I went into the JScript options and disassociated the JS extension from JScript and back to the JavaScript options, I have associated the JS extension with JavaScript. Thank you.
This topic is 8 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.