Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About pbhound

  • Rank
  1. I'm sorry but i do not see the relevance between my question and the link that you posted.
  2. hello everyone my name is Eric, i dont know where to post this in this forum since it is vbscript but not pertaining to websites. im having a problem with a script i am trying to write for my administrative scripting class. yes this is a school project, and no i dont want anyone to write it for me i would like to learn what i am doing wrong and how to fix it. i have done large amounts of research and cannot find a solution to my problems. so i am seeking help here.here are the requirements for my project:Create a script that includes the following:Header sectionreference sectionWorker InformationOutput InformationDocument every line of the scriptAll variable names must be uniquedetermines how long the script will runAsk the user how many folders he wants to create by using a Msg Boxcheck to see if folders existsask the user where he wants to store the folders by using a Msg Box. Give the user an example of how to enter the information.create the folders by using Sub or a FunctionCreate a file in each folder that you create. Add the following lines to the file:I am writing a scriptblank lineFor a grade in my IST321 course2 blank linesI expect a good grade!Notify the user that you have created the file in the folder.use a counter and echo out each folder as it is createdUse an Array.let the user know when the script is completeand here is the script that i have created so far (it is not done and all of the requirements are not there yet but i am trying to get the counter for folder creation to work first.) ' Header information' Header information''========================================================'' File Name: IST321_EWalker_MidTerm.vbs' This is a VBS script to run change the extention to .vbs'' Author: Eric Walker' Date: July 7, 2011''========================================================option explicit'on error resume nextdim TimeStart 'variable for time script starteddim TimeEnd 'variable for time script endsdim TimeRan 'variable for total time script randim FolderName 'variable for foldernamedim LocalDrive 'variable for c:'dim CreateFolder 'variabledim foldercount 'variable for folder countingdim FolderInput 'variable for the number of folders the user wishes to createdim folderamount 'variable for folderinputdim filearray 'variable for array to store information about the files createddim FolderLocation 'variable for the location of where the folders will be created.dim textdocument 'variable for the text document that will be created in each new folderdim sleep 'variable for placing the computer to "sleep" or pause for a given amount of time' Reference informationtimestart = now 'starts the stopwatch timerfolderInput = InputBox("How many folder do you wich to create: ", "folder amount", "any number between 1 and 6") 'this is the input box for the use to define how many folder they wish to createfolderLocation = inputbox("Folder Location", "where would you like the folders to be placed", "C:\Documents and Settings\eriwal6880\Desktop\") 'this is the input box for the use to define the location of the folders that will be createdif folderinput <> "" then 'if-then-else statement that will compare the inputbox for folder location is not empty then it will proceed to next linefolderamount = folderinput 'defining folderamount to be equal to folderinputelse 'else statement for the if-then-else conditionquit 'this will terminate the scriptend if 'ends the if-then-else condition' Worker and output informationSet LocalDrive = CreateObject("Scripting.FileSystemObject") 'creates a connection to the file system of the operating system in this case its NTFSfoldercheck 'calls the subroutine "foldercheck"createfolder 'calls the function "createfolder"wscript.echo("all done") 'prints (on screen) "all done"' *** Subroutines and functions are below ***sub FolderCheck 'this declares the variable foldercheck as a subroutineIf LocalDrive.FolderExists("folderlocation" & createfolder) Then 'if-then-else condition where if the folder to be created already exists in the location specified then proceed to next lineWScript.Echo("folder exists and will not be created") 'prints (on screen) "folder exists and will not be created"Else 'else statement for the if-then-else conditionWScript.Echo("folder does not exist and will be created") 'prints (on screen) "folder does not exist and will be created"End if 'ends the if-then-else condition end sub 'ends the subroutinefunction createfolder() 'declares the variable "createfolder" as a functiondo until foldercount < folderamount 'do-until condition will execute as long as the foldercount is less than folderamountfor foldercount = 1 to folderamount 'counter where foldercount will range from to 1 what ever folderamount isset createfolder = localdrive.createfolder(folderlocation & "folder" & foldercount) 'creates a connection to the file system to create the folder at the location specified with the name "folder" and the foldercountwscript.echo createfolder 'prints (on screen) the location and the folder that was createdfoldercount = foldercount +1 'adds a 1 to the current counter for foldercountloop 'loops back to the begining of the functionend function 'ends the function i got the inputbox's to work correctly but when i try to create the folders using a function it will only create one folder and gives me a runtime error stating that the folder already exists i know where the problem is but do not know how to fix it.any and all help is greatly appreciated.Thanks in advanceEric
  3. pbhound

    wrong location

    wrong location
  • Create New...