Moderators SmOke_N Posted July 4, 2005 Moderators Share Posted July 4, 2005 I'm trying to allow my users to rename their .exe of my program. It is called upon by the GUI by it's name. I was searching the Help: FileFindFirstFile(@ProgramFilesDir & "\File1\File2\File3\" & "*.*"); Name of file they cannot currently change The FileFindFirstFile seems would work, but it returns a "." or a ".." first then my .exe. Any ideas on how to get rid of the "." and ".."? Sorry if it's stupid question. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted July 4, 2005 Share Posted July 4, 2005 If $result <> "." OR $result <> ".." Then ;; stuff EndIf Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 4, 2005 Author Moderators Share Posted July 4, 2005 (edited) If $result <> "." OR $result <> ".." Then;; stuffEndIf<{POST_SNAPBACK}>HA!!, I knew that!! Too much 4th of July... Thanks MSLXEDIT: Spelled your name wrong!! Edited July 4, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 4, 2005 Author Moderators Share Posted July 4, 2005 Ok, I stand corrected, too much 4th cheer for me. While they Bar-B-Q, I script, but I am participated in the consumption LOL. I understood that, and thought as soon as I saw it that BINGO!! Out of help file w/ your help. ; Shows the filenames of all files in the current directory, note that "." and ".." are returned. $search = FileFindFirstFile(@ProgramFilesDir & "\File1\File2\File3\" & "*.*") ; 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 If $file <> "." OR $file <> ".." Then MsgBox(0, "Executible is:", $file) EndIf WEnd ; Close the search handle FileClose($search) But, I'm still getting a "..", and not the executible. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jpm Posted July 4, 2005 Share Posted July 4, 2005 Ok, I stand corrected, too much 4th cheer for me. While they Bar-B-Q, I script, but I am participated in the consumption LOL.I understood that, and thought as soon as I saw it that BINGO!!Out of help file w/ your help.; Shows the filenames of all files in the current directory, note that "." and ".." are returned. $search = FileFindFirstFile(@ProgramFilesDir & "\File1\File2\File3\" & "*.*") ; 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 If $file <> "." OR $file <> ".." Then MsgBox(0, "Executible is:", $file) EndIf WEnd ; Close the search handle FileClose($search)But, I'm still getting a "..", and not the executible. <{POST_SNAPBACK}>If $file <> "." OR $file <> ".." Thenmust beIf $file <> "." AND $file <> ".." Thentoo much beer in 4th Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 4, 2005 Author Moderators Share Posted July 4, 2005 You're a beautiful man!! (I mean that in the most respectfull way (hope my wife doesn't read that )) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted July 4, 2005 Share Posted July 4, 2005 Hehe, I need to lay off that soda, one 12-oz is too much Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 4, 2005 Author Moderators Share Posted July 4, 2005 No worries m8, this "Cokes" for u!! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
FuryCell Posted July 5, 2005 Share Posted July 5, 2005 If you are looking for a .exe then why not :; Shows the filenames of all files in the current directory, note that "." and ".." are returned. $search = FileFindFirstFile(@ProgramFilesDir & "\File1\File2\File3\*.exe") ; 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 MsgBox(0, "Executible is:", $file) EndIf WEnd ; Close the search handle FileClose($search) HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 5, 2005 Author Moderators Share Posted July 5, 2005 (edited) If you are looking for a .exe then why not:; Shows the filenames of all files in the current directory, note that "." and ".." are returned. $search = FileFindFirstFile(@ProgramFilesDir & "\File1\File2\File3\*.exe") ; 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 MsgBox(0, "Executible is:", $file) EndIf WEnd ; Close the search handle FileClose($search)<{POST_SNAPBACK}>Because I don't want the "." or "..". Test it out yourself you'll see.This works: Global $Exe = Exec() While 1 MsgBox(4096, "File:", $Exe) WEnd Func Exec() $search = FileFindFirstFile(@ProgramFilesDir & "\File1\" & "*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $Exe = FileFindNextFile($search) If @error Then ExitLoop If $Exe <> "." And $Exe <> ".." Then Return $Exe EndIf WEnd FileClose($search) EndFuncEdit: I posted this before I saw this: *.exe (I'll test that) Edited July 5, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 5, 2005 Author Moderators Share Posted July 5, 2005 There were a couple of syntax erros with yours buy you were right on the money too.... ; Shows the filenames of all files in the current directory, note that "." and ".." are returned. $search = FileFindFirstFile(@ProgramFilesDir & "\File1\File2\File3\*.exe") ; 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 MsgBox(0, "Executible is:", $file) WEnd ; Close the search handle FileClose($search) Very cool... ty Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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