Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

VBS - GOTO Do Loop


  • Please log in to reply

#16
IO-error

IO-error

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 276 posts
Yeah, but I don't understand what you mean and I got no examples to help me. So I still can't do it.

Can you provide me with an example? If it's not too much of trouble for you.
  • 0

Advertisements


#17
Ctrl_Alt_Del

Ctrl_Alt_Del

    Member

  • Member
  • PipPip
  • 74 posts
It looks as though what you are trying to do is run a default file name if you don't get input from the user. If that's the case then you really don't need to even have a loop. I don't write a lot of asp and all of my code is on another machine so fill in with the asp terms as needed.


You could do something like this.

Function GetFileName(Prompt as string) as string

	GetFileName = InputBox(Prompt, "Name Entry")


End Function

Dim sPrompt as string
Dim sFileName as string

sPrompt = "Enter a file name to process"
sFileName = GetFileName(sPrompt)

If sFileName = "" then
   sPrompt = "File Name cannot be empty.  PLease enter a file name"
   sFileName = GetFileName(sPrompt)
   If sFileName = "" then
	   sFileName = DefaultfileName
   end if
end if

ProcessFile


An example of recursion would be the following where GetFileName is called from within GetFileName

Function GetFileName(Prompt) as string
	Dim sFileName as string
	Dim index as integer
	
	index = 0
	sFileName = ""
	 
	Do while sFileName = "" or index < 5
		 sFileName = InputBox(Prompt, "Name Entry")
		 index = index + 1
	Loop
End Function

  • 0

#18
IO-error

IO-error

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 276 posts
Thank you for the help.
It's really helpfull for my future scripts.
I'm not using it in this taskbooter program, because it's now finished in a different way.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP