ALIENQuake Posted May 16, 2011 Posted May 16, 2011 Hi. I was able to do script that display "Enter you path to application.exe". After doing it, i want to search this given path for an *.exe files and if there won't be any .exe it means that path is invalid. This is what i do: If IsAdmin() Then $varmanual = InputBox("Ścierzka do katalogu", "Podaj ścieżkę do katalogu", "C:\Program Files\WinRar", "",-1, -1, 0, 0) If @error=1 Then Exit Else $search = FileFindFirstFile("winrar*.exe") ; Check if the search was successful If $search = -1 Then MsgBox(16, "Błąd", "W podanej ścieżce znalazłem pliku exe.") Exit Else ; Close the search handle FileClose($search) DirCopy(@SCriptDir, $varmanual, 1) FileCopy(@SCriptDir & "\*.*", $varmanual, 9) EndIf but how to insert user-provided path as a parameter for FileFindFirstFile dir ? Can i use this: $search = FileFindFirstFile($varmanual & "winrar*.exe") ?
Arterie Posted May 16, 2011 Posted May 16, 2011 (edited) If IsAdmin() Then $varmanual = InputBox("Scierzka do katalogu", "Podaj sciezke do katalogu", "C:\Program Files\WinRar\", "",-1, -1, 0, 0) If @error=1 Then Exit Else $search = FileFindFirstFile($varmanual &"winrar*.exe") EndIf ; Check if the search was successful If $search = -1 Then MsgBox(16, "Blad", "W podanej sciezce znalazlem pliku exe.") Exit Else ; Close the search handle FileClose($search) DirCopy(@SCriptDir, $varmanual, 1) FileCopy(@SCriptDir & "\*.*", $varmanual, 9) EndIf EndIf You missed a "\" for the path. i added that at the first line So you either do this $varmanual = InputBox("Scierzka do katalogu", "Podaj sciezke do katalogu", "C:\Program Files\WinRar\", "",-1, -1, 0, 0) or that $search = FileFindFirstFile($varmanual &"\winrar*.exe") Edited May 16, 2011 by Arterie
sleepydvdr Posted May 16, 2011 Posted May 16, 2011 Check out the help file for: FileOpenDialog. #include <ByteMe.au3>
ALIENQuake Posted May 16, 2011 Author Posted May 16, 2011 (edited) You missed a "\" for the path. i added that at the first lineSo you either do this $varmanual = InputBox("Scierzka do katalogu", "Podaj sciezke do katalogu", "C:\Program Files\WinRar\", "",-1, -1, 0, 0)or that $search = FileFindFirstFile($varmanual &"\winrar*.exe")Good catch, thank you. I was able to get -1 if no file found :-)Check out the help file for: FileOpenDialog.Thank you for providing better way to what i want to archive P.S. Another great support board where i cannot hit "Thanks" fo users ? How it can be Edited May 16, 2011 by ALIENQuake
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