Source language: Translate to:

VBScript and JScript without using the NeoBook function?

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

VBScript and JScript without using the NeoBook function?

Postby mishem » Wed Aug 30, 2017 6:39 am

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...
mishem
 
Posts: 575
Joined: Mon Oct 08, 2012 1:51 pm

Re: VBScript and JScript without using the NeoBook function?

Postby Gaev » Wed Aug 30, 2017 9:09 am

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.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: VBScript and JScript without using the NeoBook function?

Postby mishem » Wed Aug 30, 2017 10:56 am

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.
mishem
 
Posts: 575
Joined: Mon Oct 08, 2012 1:51 pm

Re: VBScript and JScript without using the NeoBook function?

Postby Gaev » Wed Aug 30, 2017 12:07 pm

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
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: VBScript and JScript without using the NeoBook function?

Postby mishem » Wed Aug 30, 2017 1:10 pm

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.
mishem
 
Posts: 575
Joined: Mon Oct 08, 2012 1:51 pm

Re: VBScript and JScript without using the NeoBook function?

Postby Neosoft Support » Wed Aug 30, 2017 6:08 pm

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

Re: VBScript and JScript without using the NeoBook function?

Postby HPW » Wed Aug 30, 2017 10:27 pm

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
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: VBScript and JScript without using the NeoBook function?

Postby Neosoft Support » Sun Sep 10, 2017 1:49 pm

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

Good idea.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest