anyways Posted June 30, 2007 Share Posted June 30, 2007 hello,I was asking myself if there is a way to copy some random text line from a notepad to another. If so whats the function i should usethanks p.s: autoit owns, thanks a lot for this freeware guys, keep up the good work! Link to comment Share on other sites More sharing options...
anyways Posted June 30, 2007 Author Share Posted June 30, 2007 can someone please answer? its a like a noobie question, everyone whould know the answer, or at least tell me its not possible.... Link to comment Share on other sites More sharing options...
anyways Posted June 30, 2007 Author Share Posted June 30, 2007 help Link to comment Share on other sites More sharing options...
i542 Posted June 30, 2007 Share Posted June 30, 2007 (edited) can someone please answer? its a like a noobie question, everyone whould know the answer, or at least tell me its not possible.... well this is not TV. you should be patient.You should use Random to generate number, then associate numbers with messages using Switch (search for Excuse Generator in Example Scripts), and use Send and WinWaitActive to write it in notepad EDIT: actually he asked something completly else..... ...see my post #6 Edited June 30, 2007 by i542 I can do signature me. Link to comment Share on other sites More sharing options...
anyways Posted June 30, 2007 Author Share Posted June 30, 2007 can u gimme the code or at least an example of the code, i am more visual than anything else (and as i said i am a complete noob), thanks for reply btw Link to comment Share on other sites More sharing options...
i542 Posted June 30, 2007 Share Posted June 30, 2007 (edited) Ok I am done #include <File.au3> Opt("WinTitleMatchMode",2) $notepad=WinGetText("Notepad") FileWrite(@TempDir & "\AutoItTempFile.tmp",$notepad) $lines=_FileCountLines(@TempDir & "\AutoItTempFile.tmp") $randomline=Random(1,$lines,1) $randomline=FileReadLine(@TempDir & "\AutoItTempFile.tmp", $randomline) MsgBox(0,"The random line","The random line from temp file is:" & @CRLF & $randomline) FileDelete(@TempDir & "\AutoItTempFile.tmp") $randomline contains your line. Do whatever you want with it in rest of your script EDIT: added temp file deletion feature... Edited June 30, 2007 by i542 I can do signature me. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 30, 2007 Developers Share Posted June 30, 2007 Ok I am done #include <File.au3> Opt("WinTitleMatchMode",2) $notepad=WinGetText("Notepad") FileWrite(@TempDir & "\AutoItTempFile.tmp",$notepad) $lines=_FileCountLines(@TempDir & "\AutoItTempFile.tmp") $randomline=Random(1,$lines,1) MsgBox(0,"The random line","The random line from temp file is:" & @CRLF & $randomline) FileDelete(@TempDir & "\AutoItTempFile.tmp") $randomline contains your line. Do whatever you want with it in rest of your script EDIT: added temp file deletion feature...Did you try it ? It contains the linenumber not the line content i would think ..... 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...
i542 Posted June 30, 2007 Share Posted June 30, 2007 (edited) Did you try it ?It contains the linenumber not the line content i would think .....it is not tested... woopsie...i will edit it... edit: done Edited June 30, 2007 by i542 I can do signature me. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 30, 2007 Developers Share Posted June 30, 2007 (edited) here is an alternative: Opt("WinTitleMatchMode", 2) $notepad = WinGetText("Notepad") $lines = StringSplit($notepad,@crlf,1) $randomline = Random(1, $lines[0], 1) MsgBox(0, "The random line", "The random line from temp file is:" & @CRLF & $randomline & "-" & $lines[$randomline]) Edited June 30, 2007 by JdeB 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...
i542 Posted June 30, 2007 Share Posted June 30, 2007 (edited) of course...they always use moderators examples okay.... but you have to admit...you used parts of my script.... EDIT: If you have two programs, you can transfer text between them using tempfile...just remove FileDelete line.... (yep now the advertising...) Edited June 30, 2007 by i542 I can do signature me. Link to comment Share on other sites More sharing options...
anyways Posted June 30, 2007 Author Share Posted June 30, 2007 ok cool and now what function shall it use to copy that random line into another lets say a example.doc 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