Sign in to follow this  
Followers 0
anyways

Copying random test forma window to another

11 posts in this topic

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!

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

help

Share this post


Link to post
Share on other sites

#4 ·  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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  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.

Share this post


Link to post
Share on other sites

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:


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  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.

Share this post


Link to post
Share on other sites

#9 ·  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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#10 ·  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.

Share this post


Link to post
Share on other sites

ok cool and now what function shall it use to copy that random line into another lets say a example.doc

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0