Help with nbExecAction

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Locked
User avatar
AsleyCruz
Posts: 113
Joined: Fri Sep 16, 2011 2:12 pm

Help with nbExecAction

Post by AsleyCruz »

Hi guys!
I use this action in JavaScript:

Code: Select all

window.external.nbExecAction( 'AlertBox "Hello from HTML" "Executing action from HTML source via javascript!"' );
But, how can I use this code in VBScript?

I have tried, but nothing, maybe this is something easy for you and I will thank you in advanded.

Hope you can help me ;-) Regards
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Help with nbExecAction

Post by Gaev »

Asley Cruz:

Try this code ...

Code: Select all

window.external.nbExecAction "AlertBox " & chr(34) & "Hello from HTML" & chr(34) & " " & chr(34) & "Executing action from HTML source via vbscript" & chr(34)
User avatar
AsleyCruz
Posts: 113
Joined: Fri Sep 16, 2011 2:12 pm

Re: Help with nbExecAction

Post by AsleyCruz »

Gaev wrote:Asley Cruz:

Try this code ...

Code: Select all

window.external.nbExecAction "AlertBox " & chr(34) & "Hello from HTML" & chr(34) & " " & chr(34) & "Executing action from HTML source via vbscript" & chr(34)

Hi Gaev
Many thanks but for excecuting this script I need to create an object "window".
How can I solve this? How to create an object? It says:

An object "window" is required... something like this.
Many thanks for your help.

.
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Help with nbExecAction

Post by Gaev »

AsleyCruz:
for excecuting this script I need to create an object "window".
How can I solve this? How to create an object?
I got the impression (from reading your first post) that you were looking for a command that would work within vbscript inside an HTML document that was going to run inside a WebBrowser object ... if that is so, the suggested command should work fine ... it did in a sample pub/html document I created.

However, if you were looking to Call a vbscript directly from your publication e.g. ...

Code: Select all

Call "gkvbAlertBox"
... then try this command ...

Code: Select all

publication.nbExecAction "AlertBox " & chr(34) & "Hello" & chr(34) & " " & chr(34) & "from vbscript" & chr(34)  
User avatar
AsleyCruz
Posts: 113
Joined: Fri Sep 16, 2011 2:12 pm

Re: Help with nbExecAction

Post by AsleyCruz »

Cool, Gaev... it works in WebBrowser object... no more :)
Thanks and regards!
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Help with nbExecAction

Post by Gaev »

AsleyCruz:

I am confused by your latest response ...
Cool, Gaev... it works in WebBrowser object.
I am assuming that you had the following vbscript command inside an HTML document ... that you loaded in a WebBrowser object ...

Code: Select all

window.external.nbExecAction "AlertBox " & chr(34) & "Hello from HTML" & chr(34) & " " & chr(34) & "Executing action from HTML source via vbscript" & chr(34)
... notice that it says window.external.nbExecAction
If I want to display an AlertBox using a VBScript Function...
how is the correct way? any idea? is this possible?

But, How can I send an "AlertBox" to NeoBook using VBScript code? (Not inside an HTML document)
As per my last post, you use this command ...

Code: Select all

publication.nbExecAction "AlertBox " & chr(34) & "Hello" & chr(34) & " " & chr(34) & "from vbscript" & chr(34)
... notice that it says publication.nbExecAction ... and you place it inside a "Function defined as using vbscript" ... which you Call from a code section in your publication.
Ex: This VBScript code sends to NeoBook any result:
publication.nbSetVar "[%1]", Total
This will populate the variable defined in the first parameter (of the Call command) with the value of the vbscript variable called Total ... it has nothing to do with asking NeoBook to execute NeoBook commands from a vbscript.
User avatar
AsleyCruz
Posts: 113
Joined: Fri Sep 16, 2011 2:12 pm

Re: Help with nbExecAction

Post by AsleyCruz »

Hi Gaev
Any answer you post here, worked for me...
... all I was looking for is this simple code: :x :x :x

Code: Select all

publication.nbExecAction( "AlertBox ""My Title"" ""My Message""" )
It is for my coming new tool called: "Simple Website Blocker", something like this :wink:

For using in a VBScript Function without any WebBrowser object.
I only have to say many thanks again :)
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
David de Argentina
Posts: 1596
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina
Contact:

Re: Help with nbExecAction

Post by David de Argentina »

Hi Ernesto,

This is working for me under XP SP3 and IE8. I guess it may work on newer OS versions and IE Versions

a) Create a new pub
b) add a button.
c) add this actions to the button:

[syntax=neobook]BrowserLoadFromStr "NavegadorWeb1" "<html>|<head>|</head>|<body>|<script>|function vb() {|alert([#34]this is the internal html javascript function, that calls the MyVBFunction[#34]);|window.external.nbExecAction( 'Call [#34]c:/MyVBFunction.nbf[#34]' );|}|</script>|</body>|<button onclick=[#34]vb()[#34]>Click me</button>|</body>|</html>"
[/syntax]

d) create using Notepad a text file called "MyVBFunction.nbf" at the root folder of your C drive:
with this text:

Code: Select all

{NeoBook Function}
Version=5.80
Language=VBScript
{End}
MsgBox "hello world from the VBScript function called MyVBFunction"
e) Run the program.

Tell me if this is you are searching.

Greetings from Buenos Aires,
David de Argentina
User avatar
AsleyCruz
Posts: 113
Joined: Fri Sep 16, 2011 2:12 pm

Re: Help with nbExecAction

Post by AsleyCruz »

Many thanks David
All this is usefull for me... it works perfectly.

I was looking for all this for a upcoming tool I am developing.
Best regards :wink:
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
Locked