Clever1mba Posted June 15, 2005 Posted June 15, 2005 (edited) hello littile problem in this code i need to change randomly text in file.txtfile.txt contain name like this asimadilakberali john james now every 3 sec i want to change name in GUICtrlCreateInput randomlyi hope u get my point #include <GUIConstants.au3>GUICreate("gui") $fHandle1 = FileOpen(@SystemDir & "\myfile.txt", 0)$char = FileRead($fHandle1, 99999999)FileClose($fHandle1)$service = StringSplit($char, @CRLF)For $i = 1 to $service[0]$input2 = GUICtrlCreateInput($service[$i],70,40,250,20)GUISetState ()NextWhile 1$msg = GUIGetMsg()If $msg = $GUI_EVENT_CLOSE Then ExitLoopWend Edited June 15, 2005 by asimzameer
MSLx Fanboy Posted June 15, 2005 Posted June 15, 2005 (edited) #include<file.au3> _FileReadToArray(@SystemDir & "\myfile.txt", $array) $line = Rand(1, $array[0], 1) GuiCtrlSetData($input2, $array[$line]) should work. Edited June 15, 2005 by MSLx Fanboy Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
MSLx Fanboy Posted June 16, 2005 Posted June 16, 2005 You want to go in an actual order? #include<file.au3> _FileReadToArray(@SystemDir & "\myfile.txt", $array) For $line = 1 to $array[0] GuiCtrlSetData($input2, $array[$line]) Sleep(1000*3) Next If you want to continue looping through those indefinately then... #include<file.au3> _FileReadToArray(@SystemDir & "\myfile.txt", $array) For $line = 0 to $array[0] GuiCtrlSetData($input2, $array[$line]) Sleep(1000*3) If $line = $array[0] Then $line = 0 Next I didn't test the code...but it should work Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
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