VBScript and JScript without using the NeoBook function?

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Locked
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

VBScript and JScript without using the NeoBook function?

Post by mishem »

Is it possible to run VBScript and JScript without using the NeoBook function?

Maybe there is some special global variable? In which you can pass Language = VBScript or Language = JScript before executing the script.

For example:

Code: Select all

SetVar "[Language]" "VBScript"
Run the VBScript script ...

SetVar "[Language]" "NeoBook"
Продолжить выполнение скрипта NeoBook...
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: VBScript and JScript without using the NeoBook function?

Post by Gaev »

mishem:

How about BrowserExecScript ... from the Help file ...
Syntax:
BrowserExecScript "object name" "script code" "script language"

object name
The name of an existing Web Browser object.

script code
This is the actual written in the scripting language specified below.

script language
One of the following:
JavaScript
JScript
VBScript

Example:
The following action will replace the contents of the object WebBowser1 with "Hello from NeoBook!":

BrowserExecScript "WebBrowser1" "text=[#34]Hello from NeoBook![#34];|document.write(text);" "JavaScript"
You can hide the Browser object from the user ... or place it off screen.

You can also pass information to/from NeoBook variables.
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

Re: VBScript and JScript without using the NeoBook function?

Post by mishem »

This is understandable, but I'm interested in another question. :)

If we open the NeoBook function in the Notepad, we see the following:

Code: Select all

{NeoBook Function}
Version=5,80
Language=VBScript
Language=VBScript

Code: Select all

{NeoBook Function}
Version=5,80
Language=NeoBook
Language=NeoBook

Means NeoBook as that processes these parameters?
So I thought that maybe it's possible to transfer these parameters yourself.
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: VBScript and JScript without using the NeoBook function?

Post by Gaev »

mishem:
So I thought that maybe it's possible to transfer these parameters yourself.
I am not sure what you are trying to achieve with such a facility.

But, if it is OK to expose the Function fie to your users, you can ...

1) rename the function file to (say) myFunction.mishem (or copy it from the Functions folder to your [PubDir])

2) at compile time, embed the renamed file in your pub

3) at run time ...
a) ExtractFile this (renamed) file to [PubDir] or [TempDir]
b) use FileWrite to edit it
c) do a Call to this file in its target folder
mishem
Posts: 581
Joined: Mon Oct 08, 2012 1:51 pm

Re: VBScript and JScript without using the NeoBook function?

Post by mishem »

I am not sure what you are trying to achieve with such a facility.
Thanks for trying to help.

I write WizardPlayAction to hpwPlayAction.
And I'm trying to understand if the VBScript function is wrapped in a plug-in, then how to execute it afterwards.

I want from neosoft to get an answer, maybe it's like doing it, or not.
If not, then I think in the future such an opportunity would not be in the way.

We still hope to update the program. :)

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

Re: VBScript and JScript without using the NeoBook function?

Post by Neosoft Support »

There is no way to execute a JavaScript or VBScript function outside of a file. Gaev's suggestion of writing the function to a temporary file and using Call to execute is the only way to accomplish what you want.
NeoSoft Support
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Re: VBScript and JScript without using the NeoBook function?

Post by HPW »

Hello,

Addition to Gaev's first hint: Using an offsreen BrowserObject you can execute code from a variable.

Drawback: You always need the BrowserObject which has to be loaded and started. And you have to know its objectname.

Code: Select all

SetVar "[WebBrowserName]" "WebBrowser1"
SetVar "[WebBrowserCode]" "text=[#34]Hello from NeoBook![#34];|document.write(text);"
BrowserExecScript "[WebBrowserName]" "[WebBrowserCode]" "JavaScript"
Neosoft: So a future CallEx could be: CallEx "[ScriptCode]" "SupportedLanguage" ;-)
Optional: [ScriptCode] can be codestring or filename.

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

Re: VBScript and JScript without using the NeoBook function?

Post by Neosoft Support »

Neosoft: So a future CallEx could be: CallEx "[ScriptCode]" "SupportedLanguage" ;-)
Optional: [ScriptCode] can be codestring or filename.

Good idea.
NeoSoft Support
Locked