Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to start script over?

Status
Not open for further replies.

RonQA

Technical User
Jun 24, 2007
61
US
I have a script that searches files using an inputbox. What I want to do is have it search, complete the task, handle the results and start the script from the beginning for another search.

Basically re-start the script from the beginning.

I cannot find the right command to achieve this, does anyone have any ideas?

Thanks,
 
ettienne is right, you would want to loop your script to start from the beginning.
 
Well, depending on what exactly you are trying to do...you may want to do something similar to below:

Code:
strInput = Inputbox("Enter text")

DO
   SearchFiles(strInput)
LOOP

FUNCTION SearchFiles(strInput)

[COLOR=red] Your code here...strInput is for file to be searched. [/color]

END FUNCTION

Or if you are searching for multiple files, then you would need to add the input box into the loop:

Code:
DO
   strInput = Inputbox("Enter text")
   SearchFiles(strInput)
LOOP

FUNCTION SearchFiles(strInput)

[COLOR=red] Your code here...strInput is for file to be searched. [/color]

END FUNCTION

Good luck...

V/r,

SPC Key
United States Army
 
Hello,

You will need a value to enter in the input box that will kill the loop.

For example:

Dim filename,errorhandler

filename = InputBox ("What do you want to search?")
Do
If filename <> "" Then
filefunction(filename)
Else
errorhandler = Msgbox("Do you want to quit?",36)
If errorhandler = "6" Then
Exit Do
End If
End If

Loop

Function filefunction (stuff)
[your code processing file named stuff goes here]
End Function


I have been automating Client Access for 3 years and have it do everything the computer can do for me. Error handling is important. Failing to kill an infinite input box loop will not allow the rest of the program to work without killing the program and starting a new instance. If the input box is created a certain way, it will prevent accessing any other programs until the computer is forced to shut down.

Infinite loops are dangerous. Strive to create a kill process for any loops.

Respectfully yours,

Jesse Grune.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top