Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBScript Help!

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64288
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript Help!
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBScript Help! - 9/15/2008 6:34:46 AM   
  yuchen

 

Posts: 2
Score: 0
Joined: 9/15/2008
Status: offline
i had an assignment in which you had to create a program that generates 50 subfolders, though the program i made could do that, it couldnt generate over 100 folders. Im just curious. is the file extension too long? and how do i solve this? Script is below...


Dim strfolder, b, sub1
Dim strRoot2, root

strRoot="c:\Users\Admin\Desktop"
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objFolder=objFSO.GetFolder(strRoot)
Set colFolders=objFolder.SubFolders

strFolder = InputBox("Please Enter a Folder Name.")
b = InputBox("Please Enter How Many SubFolders")

If objFSO.FolderExists(strRoot & strFolder) Then
WScript.Echo "Folder " & strRoot & strFolder &_
" already exists"
Else
End If

Do while b>0
colfolders.Add strFolder
b = b-1
strRoot=strRoot&"\"&strfolder
Set objFolder=objFSO.GetFolder(strRoot)
Set colFolders=objFolder.SubFolders
Loop


Wscript.Echo "Job Done"

I keep on getting the error
line 20
char 5
file not found
when entering values higher then 100
 
 
Post #: 1
 
 RE: VBScript Help! - 9/15/2008 9:03:03 AM   
  dm_4ever


Posts: 2669
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
The path may be too long (over 255)

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to yuchen)
 
 
Post #: 2
 
 RE: VBScript Help! - 9/16/2008 7:52:23 AM   
  yuchen

 

Posts: 2
Score: 0
Joined: 9/15/2008
Status: offline
is there a way to extend the max char???

(in reply to yuchen)
 
 
Post #: 3
 
 RE: VBScript Help! - 9/16/2008 11:32:09 AM   
  wjcott

 

Posts: 41
Score: 0
Joined: 9/7/2008
Status: offline
No, but the net effect might be accomplished creating/using mapped drives that are daisy chained, not a pretty solution. Otherwise, there do not appear to be many options as the Windows API can't be directly accessed from VBScript. Of course, you could write a COM object that uses the API, referencing that in your script, but that is over my head.

(in reply to yuchen)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript Help! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts