TonyP Posted August 14, 2008 Posted August 14, 2008 Okay so this may sound dumb, but I'm trying to grab a large amount of file names and write them to a txt file. I figured out how to do that and figured why not take it a step further. So I am now trying to figure out how to output a expression. For instance if I grab a filename called "stuff.exe" and output it into a txt file, it will show up as "stuff.exe" but how can I make it show up like this in the text file? FileInstall ("stuff.exe", "stuff.exe")Is there a way to do that?ThanksCode so far below: ; Shows the filenames of all files in the current directory $search = FileFindFirstFile("*.exe") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf $file = FileOpen("updates.txt", 2) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, "List of files in this directory with a exe extension:" & @CRLF) While 1 $filename = FileFindNextFile($search) If @error Then ExitLoop FileWrite($file, $filename & @CRLF) WEnd ; Close the search handle FileClose($search) MsgBox(4096, "Complete", "Filenames are listed in updates.txt")
enaiman Posted August 14, 2008 Posted August 14, 2008 While 1 $filename = FileFindNextFile($search) If @error Then ExitLoop FileWrite($file, 'FileInstall (""'&$filename&'"", ""'&$filename&'"")'&@CRLF) WEnd The key here is using double-quotes to "tell"AutoIt how to deal with them. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
TonyP Posted August 18, 2008 Author Posted August 18, 2008 Oh, double quotations, I hadn't' thought of that. Thanks I will try playing around with that then.
Moderators SmOke_N Posted August 18, 2008 Moderators Posted August 18, 2008 Oh, double quotations, I hadn't' thought of that. Thanks I will try playing around with that then.Just in case you're actually to do a list of files to install, you may want to check this out: http://www.autoitscript.com/forum/index.ph...c=34805&hl= 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.
TonyP Posted August 18, 2008 Author Posted August 18, 2008 Just in case you're actually to do a list of files to install, you may want to check this out: http://www.autoitscript.com/forum/index.ph...c=34805&hl=Oh nice! Thats actually what I was doing, though your script looks much more... well better than mine was... Thanks
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