magOO Posted February 24, 2004 Share Posted February 24, 2004 Hello! I have many little Update-Files for my Database. Until now i have to Double-Click on the Files in the Explorer to Update the Database. And so i think AutoIt is perfect to do this Job. But I try to create a Script with FindFirst, FindNext and Run but it didn't work for me. The Script should start every File (*.upf) that is in the Directory from where the Script starts. Because I#m new with AutoIt i hope that somebody give me an example Script. Many Thanks For Your Help! magOO Link to comment Share on other sites More sharing options...
scriptkitty Posted February 24, 2004 Share Posted February 24, 2004 If is registered to automatically open, try this: ; Shows the filenames of all files in the current directory $search = FileFindFirstFile("*.upf") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop RunWait('start '&$file) ; this waits till each is done before it continues. ; Run('start '&$file) ; this will start it and go to the next file if it opens or not. ; MsgBox(4096, "File:", $file) WEnd ; Close the search handle FileClose($search) It will open each file individually. Comment out runwait and remove the ; comment tag in front of run if you wish to have them run simultaneously. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
scriptkitty Posted February 24, 2004 Share Posted February 24, 2004 Run('start '&$file) is kind of cheating. Basically you should give the application name and path, and then send the commandline to it. For example: Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.hiddensoft.com') Run('start http://www.hiddensoft.com') Start will open up a command window temporarly, and run the default program associated with the extention. If you open it directly with the program, you have more options. In this example, you won't see the command window, but you will see explorer start up. Run('start http://www.hiddensoft.com','',@SW_HIDE) in this one, I started it minimised. Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.hiddensoft.com','',@SW_MINIMIZE) If you use Start, you can't control how the actual program starts up. After a few scripts you can choose exactly how you want it to work, and know why it works like it does. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
magOO Posted February 24, 2004 Author Share Posted February 24, 2004 Many Thanks for the Code! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now