Source language: Translate to:

Add more language options to the "New Function" Bu

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

Moderator: Neosoft Support

Add more language options to the "New Function" Bu

Postby smokinbanger » Thu Aug 16, 2012 9:10 pm

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
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Postby Neosoft Support » Fri Aug 17, 2012 11:08 am

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
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby smokinbanger » Fri Aug 17, 2012 5:39 pm

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:
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Postby dpayer » Sat Aug 18, 2012 10:30 am

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.
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Neosoft Support » Mon Aug 20, 2012 10:52 am

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
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby dpayer » Mon Aug 20, 2012 12:44 pm

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.
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Neosoft Support » Wed Aug 22, 2012 12:12 pm

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/snortiisphpbaseperladodb15.html

http://www.aspfree.com/c/a/Windows-Scripting/WSH-in-Other-Languages/

http://www.mvps.org/scripting/languages/
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby smokinbanger » Wed Aug 22, 2012 3:11 pm

Neosoft Support wrote:In theory, the nbSetVar and nbGetVar functions should work with all languages.

In theory, that is very cool!
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States


Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 1 guest