Page 1 of 1

VBScript and JScript without using the NeoBook function?

PostPosted: Wed Aug 30, 2017 6:39 am
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...

Re: VBScript and JScript without using the NeoBook function?

PostPosted: Wed Aug 30, 2017 9:09 am
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.

Re: VBScript and JScript without using the NeoBook function?

PostPosted: Wed Aug 30, 2017 10:56 am
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.

Re: VBScript and JScript without using the NeoBook function?

PostPosted: Wed Aug 30, 2017 12:07 pm
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

Re: VBScript and JScript without using the NeoBook function?

PostPosted: Wed Aug 30, 2017 1:10 pm
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.

Re: VBScript and JScript without using the NeoBook function?

PostPosted: Wed Aug 30, 2017 6:08 pm
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.

Re: VBScript and JScript without using the NeoBook function?

PostPosted: Wed Aug 30, 2017 10:27 pm
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

Re: VBScript and JScript without using the NeoBook function?

PostPosted: Sun Sep 10, 2017 1:49 pm
by Neosoft Support
Neosoft: So a future CallEx could be: CallEx "[ScriptCode]" "SupportedLanguage" ;-)
Optional: [ScriptCode] can be codestring or filename.

Good idea.