Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Folder Creation Within Windows XP

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Folder Creation Within Windows XP
  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 >>
 Folder Creation Within Windows XP - 9/11/2006 9:45:46 PM   
  beardedbob

 

Posts: 4
Score: 0
Joined: 9/11/2006
Status: offline
Hi

I'm trying to write a VB Script that creates 3 folders from 3 different user inputs, e.g top level folder, then a sub to that then another sub so 3 levels deep.

example:-

C:\Dealer\
            Client\
                        Location

Then the end result will be another set of folders adding  2 more lower levels to what has been created already.

Where i'm getting stuck is that with the code i've written so far shows this error, I've not added the lower part yet as im trying to get it to just do this but it is a requirement.

“C:\Documents and Settings\UserName\Desktop\Creation.vbs(53, 1) Microsoft VBScript runtime error: Object required: 'objFolder'”

The app has to be run by the end user and has to be kept simple and not require aything else bar the .vbs stored locally.



I've pasted the code, if someone could help me that would be create, until i'll keep trying.

Thanks for your time in advance



‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
 
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
Dim Input
Dim Input1
Dim Input2
Dim InstallPath
Dim SecIn
Dim ThirdIn
 
'''''''''''''''''''''''''''''''''''''''''''''''''''''
 
Input = InputBox("Enter Dealer Name:", "Data Entry")
 
If IsEmpty(Input) Then
 
MsgBox "No data entered", vbExclamation, "Cancel Pressed"
 
End If
 
Input1 = InputBox("Enter Client Name:", "Data Entry")
 
Input2 = InputBox("Enter Location Name:", "Data Entry")
 
'''''''''''''''''''''''''''''''''''''''''''''''''''''
 
InstallPath = "C:\"
 
SecIn = InstallPath & Input
 
ThirdIn = SecIn & Input1
 
''''''''''''''''''''''''''''''''''''''''''''''''''''''
ParentFolder = InstallPath
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.NameSpace(ParentFolder)
If Not fso.FolderExists(InstallPath + Input) Then
objFolder.NewFolder "" & Input
Else
MsgBox "This Project Name Has Already Been Used, Please Use Another"
WScript.quit(1)
End If
 
ParentFolder = SecIn
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(ParentFolder)
objFolder.NewFolder "" & Input1
 
ParentFolder = ThirdIn
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(ParentFolder)
objFolder.NewFolder "" & Input2
.
 
 
Post #: 1
 
 RE: Folder Creation Within Windows XP - 9/11/2006 10:46:29 PM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
it is trying to get the parentfolder of thirdin but it is only finding C:\test3test1.

You are forgetting a \ between second and input1.

ThirdIn = SecIn & "\" & Input1

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to beardedbob)
 
 
Post #: 2
 
 RE: Folder Creation Within Windows XP - 9/12/2006 12:27:33 AM   
  beardedbob

 

Posts: 4
Score: 0
Joined: 9/11/2006
Status: offline
Hi,

Thanks for your input but this still give the same result, i've tried both SecIn & "" & Input1 and SecIn & "\" & Input1 and still It only build the folders for 2 levels.

This is already catered for fucther down the code at point objFolder.NewFolder "" & Input2, any other idea's are welcome.

if this did work for you could you please paste me the code.

Thanks.

< Message edited by beardedbob -- 9/12/2006 12:32:40 AM >

(in reply to beardedbob)
 
 
Post #: 3
 
 RE: Folder Creation Within Windows XP - 9/12/2006 12:41:14 AM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
it did work for me and the only change that I made was to the line that I posted above.

I changed
ThirdIn = SecIn & Input1

to

ThirdIn = SecIn & "\" & Input1

For the 3 inputs I entered
Dealer
Client
location

this is what I got.
C:\dealer\client\location

If all you are doing is creating a folder, take a look at this, I did not write it, I think someone here did, but i am not sure who.


      

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to beardedbob)
 
 
Post #: 4
 
 RE: Folder Creation Within Windows XP - 9/12/2006 2:01:23 AM   
  beardedbob

 

Posts: 4
Score: 0
Joined: 9/11/2006
Status: offline
Hi,

thanks for your help

I used this

InstallPath = "C:\"

SecIn = InstallPath & "" & Input

ThirdIn = SecIn & "\" & Input1

It has worked now thanks.

(in reply to beardedbob)
 
 
Post #: 5
 
 RE: Folder Creation Within Windows XP - 9/12/2006 2:02:32 AM   
  beardedbob

 

Posts: 4
Score: 0
Joined: 9/11/2006
Status: offline
Blank

< Message edited by beardedbob -- 9/12/2006 2:03:47 AM >

(in reply to beardedbob)
 
 
Post #: 6
 
 RE: Folder Creation Within Windows XP - 9/12/2006 4:00:55 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
http://www.visualbasicscript.com/m_37662/tm.htm

This might help.

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to beardedbob)
 
 
Post #: 7
 
 
 
  

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 >> Folder Creation Within Windows XP 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