top Posted April 11, 2006 Share Posted April 11, 2006 wrong code? #include <file.au3> $file = "random.txt" FileOpen($file, 0) $linecount = _FileCountLines($file) $num = Random(1,$linecount,1) $line = FileReadLine($file, $num) opt("WinTitleMatchMode", 4) HotKeySet("{ENTER}", "ff") Run("notepad.exe") While 1 sleep(300) WEnd Func ff() HotKeySet("{ENTER}") $bb=WinGetHandle("classname=Notepad") ControlSetText("Untitled -", "", "Edit1", $line ) send("{ENTER}") HotKeySet("{ENTER}", "ff") EndFunc FileClose($file) Link to comment Share on other sites More sharing options...
GaryFrost Posted April 11, 2006 Share Posted April 11, 2006 ? #include <file.au3> $file = "random.txt" FileOpen($file, 0) $linecount = _FileCountLines($file) Opt("WinTitleMatchMode", 4) HotKeySet("{ENTER}", "ff") HotKeySet("{ESC}","_Terminate") Run("notepad.exe") While 1 Sleep(300) WEnd FileClose($file) Func _Terminate() Exit EndFunc Func ff() HotKeySet("{ENTER}") $bb = WinGetHandle("classname=Notepad") $num = Random(1, $linecount, 1) $line = FileReadLine($file, $num) ControlSetText("Untitled -", "", "Edit1", $line) Send("{ENTER}") HotKeySet("{ENTER}", "ff") EndFunc ;==>ff SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted April 11, 2006 Share Posted April 11, 2006 (edited) maybe #include <file.au3> opt("WinTitleMatchMode", 4) HotKeySet("{ENTER}", "ff") Run("notepad.exe") While 1 sleep(300) WEnd Func ff() HotKeySet("{ENTER}") $file = "lang.lng" FileOpen($file, 0) $linecount = _FileCountLines($file) $num = Random(1,$linecount,1) $line = FileReadLine($file, $num) FileClose($file) $bb=WinGetHandle("classname=Notepad") ControlSend("Untitled -", "", "Edit1", $line ) send("{ENTER}") HotKeySet("{ENTER}", "ff") EndFunc 8) phone rang... Edited April 11, 2006 by Valuater Link to comment Share on other sites More sharing options...
Valuater Posted April 11, 2006 Share Posted April 11, 2006 notice i used ControlSend("Untitled -", "", "Edit1", $line ) to "add" the text to the notepad 8) 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