Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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