bobheart Posted May 20, 2004 Share Posted May 20, 2004 I have this code I found in the readme . $file = FileOpen("willthiswork.doc", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, "Line1") FileWriteLine($file, "Line2" & @CRLF) FileWriteLine($file, "Line3") FileClose($file) So it will make a doc for me but how would you make it everytime you say click a button the make the doc it adds a new number on the end of it ? So it would be willthiswork1.doc ,willthiswork2.doc etc .. And I guess it would need to keep some info in the reg so if you restart it and would start from the last number . Link to comment Share on other sites More sharing options...
herworth Posted May 20, 2004 Share Posted May 20, 2004 You would need to set the filename using a loop something like this: $x = 1 While 1 $file = "C:\path\willthiswork" & $x & ".doc" if fileexists("C:\path\willthiswork" & $x & ".doc") then $x = $x + 1 continueloop else exitloop wend rest of script using $file where appropriate This assumes that all the *.docs are in the same folder. [u][font="Arial"]Pete[/font][/u] Link to comment Share on other sites More sharing options...
emmanuel Posted May 20, 2004 Share Posted May 20, 2004 You would need to set the filename using a loop something like this: $x = 1 While 1 $file = "C:\path\willthiswork" & $x & ".doc" if fileexists("C:\path\willthiswork" & $x & ".doc") then $x = $x + 1 continueloop else exitloop wend rest of script using $file where appropriate This assumes that all the *.docs are in the same folder.I was trying to think of how to tell him how to do that... thanks! "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Valik Posted May 20, 2004 Share Posted May 20, 2004 emmanuel... Best. Avatar. Ever. Link to comment Share on other sites More sharing options...
bobheart Posted May 20, 2004 Author Share Posted May 20, 2004 Well sure looks good .. now I have figure out where to put it all . lol Link to comment Share on other sites More sharing options...
emmanuel Posted May 20, 2004 Share Posted May 20, 2004 emmanuel... Best. Avatar. Ever.thanks Valik, and funny enough, it's a play on words... 'cause looking at the helpfile does nothing for you (unless you're conducting some sort of survey of uses of the question mark in modern society, or maybe have a thing for slightly suggestivly shapped yellow things) it's looking in the helpfile, or reading and comprehending the helpfile that's really needed. (and that can be tough, I know.) "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Valik Posted May 20, 2004 Share Posted May 20, 2004 Looking at the help file is the first step to looking in the help file, though. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 20, 2004 Developers Share Posted May 20, 2004 emmanuel... Best. Avatar. Ever.Well anything was better than the previous one !!! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
emmanuel Posted May 20, 2004 Share Posted May 20, 2004 (edited) Well anything was better than the previous one !!! you're welcome, very glad to remove the pain of my visage. Edited May 20, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) 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