Jump to content

Recommended Posts

Posted

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 use

thanks :rolleyes:

p.s: autoit owns, thanks a lot for this freeware guys, keep up the good work!

Posted

can someone please answer? its a like a noobie question, everyone whould know the answer, or at least tell me its not possible....

Posted (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 :rolleyes:

EDIT: actually he asked something completly else..... :x...see my post #6 :rambo:

Edited by i542

I can do signature me.

Posted

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

Posted (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 :rolleyes:

EDIT: added temp file deletion feature...

Edited by i542

I can do signature me.

  • Developers
Posted

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 :rolleyes:

EDIT: added temp file deletion feature...

Did you try it ?

It contains the linenumber not the line content i would think .....

:rambo:

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.
  :)

Posted (edited)

Did you try it ?

It contains the linenumber not the line content i would think .....

:rambo:

it is not tested... woopsie...i will edit it... :rolleyes:

edit: done

Edited by i542

I can do signature me.

  • Developers
Posted (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 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.
  :)

Posted (edited)

of course...they always use moderators examples :x okay.... but you have to admit...you used parts of my script.... :rolleyes:

EDIT: If you have two programs, you can transfer text between them using tempfile...just remove FileDelete line.... (yep now the advertising...:rambo:)

Edited by i542

I can do signature me.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...