Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting from javascript to vbscript

Status
Not open for further replies.

databasedeveloping

Technical User
Nov 17, 2003
25
SE
Im working with converting from javascript to vbscript,
im totally lost in javascript and would be happy to get help with this easy one to get started.

Javascript:

var fc;
fc = new Enumerator(f.SubFolders);

while(!fc.atEnd())
{
sTmp = new String(fc.item());
fc.moveNext();
}



what does this looks like in vbscript?
thank you for answering!
 
Hello databasedeveloping,

The forum probably tolerates quite badly for this kind of request. It is all right once for a while. So you have to do your part.
Code:
dim fc
set fc = f.SubFolders
for each folder in fc
    sTmp = folder.name
next
(I suppose this is a short extract otherwise sTmp is quite pointless.)

regards - tsuji
 
can i skip .name

dim fc
set fc = f.SubFolders
for each folder in fc
sTmp = folder
next


do you know if it matters?
 
databasedeveloping,

No. folder is here an object, whereas folder.name is a string. That's why.

- tsuji
 
okey, but what about the difference between sTmp and f here

var f2, fc2, sTmp,f;
fc2 = new Enumerator(f2.files)

while(!fc2.atEnd())
{
sTmp = new String(fc2.item());
f = fc2.item();

 
databasedeveloping,

It is still No. The reason is the same.

But, I must add a note here. The default property which is being returned by either
new String(fc2.item());
or
new String(fc.item());
are both the path, rather than the name. Hence, the exact conversion in the first script block is actually this, to be exact:
Code:
dim fc
set fc = f.SubFolders
for each folder in fc
    sTmp = folder.[blue]path[/blue]
next
- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top