To test this, you can change the place that has c:\temp to read a folder of your choice. Save this file as listfolder.vbs and then execute it at a command prompt with:

cscript listfolder.vbs

You will see that it pulls the name of all subfolders and displays them on the screen. I remove the line: ShowSubFolders Subfolder so it will only show the subfolders of the first folder (in this case: c:\temp) and not recurse the entire directory.

In my NBBrowserExecScript, I do not want to Echo the value, I want to get it and set a NB variable

a) Not sure if you copy/pasted the code sections directly from your NeoBook Function files or just typed them in from memory ... but there is no matching Next command to the For Each SubFolder ... command in your second code block

b) VBScript has some syntax differences compared to Javascript ... instead of Set PPF = in Javascript, VBScript uses PPF = ... but you also need to define such a variable first using the Dim command.

Also, not sure why you have brackets around the SubFolder.Path.

c) Don't know if window.external.nbSetVar( '[PPF]', PPF ) works when used in NeoBook Functions of the VBScript kind ... or just when inside html documents running in a Browser Object ... but I use ...publication.nbSetVar "[PPF]",PPF

80020101 is the "catch all" zipcode ... I mean error code ... that gets returned for every kind of error encountered in such an environment ... often, the only recourse is to add one command to a working Function ... test ... repeat until you encounter an error ... then figure out why it balks at the latest change.

a) Not sure if you copy/pasted the code sections directly from your NeoBook Function files or just typed them in from memory ... but there is no matching Next command to the For Each SubFolder ... command in your second code block

b) VBScript has some syntax differences compared to Javascript ... instead of Set PPF = in Javascript, VBScript uses PPF = ... but you also need to define such a variable first using the Dim command.

Also, not sure why you have brackets around the SubFolder.Path.

c) Don't know if window.external.nbSetVar( '[PPF]', PPF ) works when used in NeoBook Functions of the VBScript kind ... or just when inside html documents running in a Browser Object ... but I use ...publication.nbSetVar "[PPF]",PPF

80020101 is the "catch all" zipcode ... I mean error code ... that gets returned for every kind of error encountered in such an environment ... often, the only recourse is to add one command to a working Function ... test ... repeat until you encounter an error ... then figure out why it balks at the latest change.

Thanks Gaev (and Beno) for your comments.

a) you are right but since I created a folder with only one subfolder, I would have thought that not an issue
b) interestingly enough, in my testing, I did use DIM statements to see if it made a difference. It didn't. Also, the script itself (which works) does a set without a DIM statement. I think it is recommended to be explicit and define all variables but not required for a local case like this.
c) I think this is where my error most likely is to be found. I did place a browser window in my NB pub and reference it when I execute the script. (I believe it acts as a host for the script in the same way cscript.exe does at a command line). I don't know if I am supposed to be using something more specific.

re: brackets around the path. Well, I thought it had to 'resolve' that and not treat it like a variable. Ahh.... learning the syntax of a language. I am pretty sure I have some sort of syntax error in my use.

OK, I will play with this a bit more. The NB docs in the help file are a bit sparse on this.

One question, can you execute a script without a browser object? The dialogue box requires and object to utilize a script. It didn't recognize my entry when I simply tried to name it something. I had to reference an existing object in the NB file.

Gaev wrote:c) Don't know if window.external.nbSetVar( '[PPF]', PPF ) works when used in NeoBook Functions of the VBScript kind ... or just when inside html documents running in a Browser Object ... but I use ...publication.nbSetVar "[PPF]",PPF

Specific question:

When you say: ... but I use ...publication.nbSetVar "[PPF]",PPF

are you recommending I literally use publication.nbSetVar or MYPUBNAME.nbsetvar ?

Do you drop the parenthesis around the "[PPF]",PPF and use full quotes instead of single quote (apostrophe?) as in the helpfile?

you are right but since I created a folder with only one subfolder, I would have thought that not an issue

... different languages have different levels of "strictness" about syntax structures ... most (including html) are gravitating towards "full compliance" ... as it becomes too difficult to figure out the complex nested structures.

interestingly enough, in my testing, I did use DIM statements to see if it made a difference. It didn't.

... if there were multiple errors, and this reduced them by one, you will still get this error message until there are none left.

Also, the script itself (which works) does a set without a DIM statement. I think it is recommended to be explicit and define all variables but not required for a local case like this.

... the one that works does not have any user created variables ... properties of created object are NOT standalone variables.

I think this is where my error most likely is to be found. I did place a browser window in my NB pub and reference it when I execute the script. (I believe it acts as a host for the script in the same way cscript.exe does at a command line). I don't know if I am supposed to be using something more specific.

... pardon me but all my comments were under the ASSumption (on my part) that you were deploying your code in a NeoBook Function ... as facilitated with v5.6 ... and not as a script inside an html that you load into a WebBrowser Object.

One question, can you execute a script without a browser object?

... as part of a NeoBook Function ... see comment above.

The dialogue box requires and object to utilize a script. It didn't recognize my entry when I simply tried to name it something. I had to reference an existing object in the NB file.

... sorry I do not understand this at all.

When you say: ... but I use ...publication.nbSetVar "[PPF]",PPF

are you recommending I literally use publication.nbSetVar or MYPUBNAME.nbsetvar ?

Do you drop the parenthesis around the "[PPF]",PPF and use full quotes instead of single quote (apostrophe?) as in the helpfile?

... literally publication.nbSetVar .. followed by [someNeoBookVariableName] inside double quotes .... followed by a comma ... followed by the VBScript variable name.

This is a command that the VBScript command interpreter interprets/executes ... publication is an automatically created "object" that VBScript knows about ... nbSetVar is a "method" defined within this object.

I think you need to look at the Help section that refers to coding of "commands" inside NeoBook Functions using a Javascript or VBScript language ... not the section that deals with html/script code in html pages that are loaded inside Browser Objects.