Add more language options to the "New Function" Bu

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Locked
smokinbanger
Posts: 204
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Add more language options to the "New Function" Bu

Post by smokinbanger »

From the help file:
To create a new function, click the New button. A small menu will appear allowing you to select a scripting language for your new function. You can use NeoBook's native scripting language, VBScript or JScript.
Note: The Insert Action button is only available when editing scripts created in NeoBook's scripting language.
If you would like to see more scripting lanuage options when clicking the above mentioned "New" button, edit the following registry key:

Code: Select all

HKEY_CURRENT_USER\Software\NeoSoft\NeoBook 5\FunctionLanguages
For example I've entered:

Code: Select all

NeoBook,VBScript,JScript,Pascal,HTML
Sure it's just a basic text editor and the Insert Action button isn't available in the added language selections and I'm not sure how NB will interact with it when calling a function, maybe Dave could shed some light on that. Looks like I got a little experimenting to do. :mrgreen:

Image
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Post by Neosoft Support »

I don't think HTML is will work here since it's not a programming language supported by the Windows Script Host (WSH). VBScript and JScript are installed into WSH as part of Windows. There are some other languages available for WSH, but you will probably need to install them first.

Below is a better explanation of WSH:

http://en.wikipedia.org/wiki/Windows_Script_Host
NeoSoft Support
smokinbanger
Posts: 204
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Post by smokinbanger »

Neosoft Support wrote:... a programming language supported by the Windows Script Host (WSH).
I think this partially answers a question; the the functions are executed by WSH. In fact, I think I remember a post where you had mentioned this. So I am making the assumption that Neobook launches WSH passing the function to it in a parameter or something similar. Or is there more to it than that? I guess there would be because of the nbGetVar and other similar actions. I guess the best solution is to still code the other languages in other editors then use the ever so handy Run action.

Well at least I thought I was on to something here :oops: Just thinking out loud again :idea:
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Post by dpayer »

Neosoft Support wrote:I don't think HTML is will work here since it's not a programming language supported by the Windows Script Host (WSH). VBScript and JScript are installed into WSH as part of Windows. There are some other languages available for WSH, but you will probably need to install them first.

Below is a better explanation of WSH:

http://en.wikipedia.org/wiki/Windows_Script_Host
Dave, are you saying, if we install python or php or ruby or delphi script or perlscript that we could use the function system of NB to access these? If so, how to identify them in the function file? Also, how to get and set variables between them and NB?

We currently have some option for PHP via a plugin and for NewLISP and Ruby via HansPeter's plugins. It would be nice if NB could handle other scripting languages almost natively via the function mechanism of NB.

I think it would be a great selling point for NB:

Learn to use all popular scripting languages right inside of Neobook!

That would be a winner.

David P.
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Post by Neosoft Support »

Dave, are you saying, if we install python or php or ruby or delphi script or perlscript that we could use the function system of NB to access these?
Yes.
If so, how to identify them in the function file?
After you install the language's WSH engine and set the "FunctionLanguages" registry entry for NeoBook, clicking on the Function Library's "New" button will display a list of languages for you to choose from.
Also, how to get and set variables between them and NB?


In theory, the nbSetVar and nbGetVar functions should work with all languages.
NeoSoft Support
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Post by dpayer »

Neosoft Support wrote:
Dave, are you saying, if we install python or php or ruby or delphi script or perlscript that we could use the function system of NB to access these?
Yes.
Dave, I installed the win32 version of Python from Python.org and I inserted the scriptlanguage name of 'Python' in the registry.

I created a new script and chose Python as the language.
I copied a very simple python script that just multiplies a number times itself into the Function editor and saved it.

When I call it in NB, I get this error:

"A script engine for the specified language cannot be created"

So I uninstalled the python.org version of python and installed ActiveState's python. I got the same error. I changed the language name in the registry to ActivePython (which is what they call their version) and I get the same error.

How does the WSH know to use the Python Script engine? Simply from the name Python in the NB registry entry? Is there some other association that has to be made somewhere?

I have .py as a file extension listed in the registry's HKCR although I don't see .pys which is what I understand to be the extension for scripts.

Any suggestions?

David P.
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Post by Neosoft Support »

I'm not a perl user so I really don't have much information for you. I did find a couple of articles that might help:

http://www.javaguicodexample.com/snorti ... odb15.html

http://www.aspfree.com/c/a/Windows-Scri ... Languages/

http://www.mvps.org/scripting/languages/
NeoSoft Support
smokinbanger
Posts: 204
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Post by smokinbanger »

Neosoft Support wrote:In theory, the nbSetVar and nbGetVar functions should work with all languages.
In theory, that is very cool!
Locked