Matthy Posted November 28, 2007 Share Posted November 28, 2007 Hi i am making a script to test the reaction time of a person to test this i had the idea to make a popup and when the popup shows they should press as fast as they can on the enter button (or an other button doenst really mind) $time = 0 ;GUICreate("My GUICtrlRead") ; will create a dialog box that when displayed is centered GuiCreate("Reactieman", 300, 100,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_17 = GuiCtrlCreateButton("GO", 100, 50, 100, 30) GUISetState () ; will display an empty dialog box ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() Sleep(15) $time = $time + 20 if $msg = $Button_17 then MsgBox(4096, "Test", $time, 10) $msg = $GUI_EVENT_CLOSE EndIf Until $msg = $GUI_EVENT_CLOSE i had made this (the popup fuctions isnt build in yet only the'stopwatch') but the values in seconds are not rigth after 15 seconds it has 7600 and sometimes 11430 or something this is probarly because of te time it needs to do '$msg = GUIGetMsg()' ect. and so i was wondering if there was a way to make this work probarly and more presise. in the 1000th second or something. i was thinking about making 2 scripts 1 popup script and 1 stopwatch script but dont know if that is precise ether. any other ideas? Cheers Matthy Link to comment Share on other sites More sharing options...
Matthy Posted November 28, 2007 Author Share Posted November 28, 2007 $destination = @Systemdir & "\oobe\images\mslogo.jpg" $i = 0 $x = 0 HotKeySet("{SPACE}", "Varit") func Varit () $x = 1 EndFunc SplashImageOn("Splash Screen", $destination,250,50) do $i = $i + 10 Sleep(10) Until $x = 1 SplashOff() MsgBox(0,"test",$i) i now got this anyway to make it more precise Cheers Matthy Link to comment Share on other sites More sharing options...
DW1 Posted November 28, 2007 Share Posted November 28, 2007 Try using the built in timer... it works wonders: #include<GUIConstants.au3> Opt("GUIOnEventMode", 1) GuiCreate("Reactieman", 300, 100,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $Button_17 = GuiCtrlCreateButton("GO", 100, 50, 100, 30) GUICtrlSetOnEvent( -1, "leave" ) $label = GUICtrlCreateLabel( "", 140, 25, 100 ) GUISetState () $timer = TimerInit() While WinExists( "Reactieman" ) Sleep(10) GUICtrlSetData( $label, Int(TimerDiff( $timer ))) WEnd Func leave() MsgBox(4096, "Test", Int(TimerDiff( $timer )) & " Miliseconds", 10) Exit EndFunc AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Jex Posted November 28, 2007 Share Posted November 28, 2007 (edited) #include <GUIConstants.au3> Global $Pressed = 0 While 1 Sleep(Random(1000, 5000, 1)) $Gui = GUICreate("Reactieman", 300, 100) $Button = GUICtrlCreateButton("GO", 0, 0, 300, 100) GUISetState() $Timer = TimerInit() Do If GUIGetMsg() = $Button Then $Pressed = 1 Until $Pressed = 1 GUIDelete($Gui) MsgBox(4096, "Test", Round(TimerDiff($Timer), 0) & "ms", 10) $Pressed = 0 WEnd I'm created that but before me danwilli gave example Edited November 28, 2007 by Jex My scripts : Immediate Window , My Web Browser , Travian , Text Effect , Characters & Words per minute or second , Image Editor (ImageMagick) , Matrix style background effect ( Screensaver ) , Mail Sender , Protectlinks decoder and Rapidshare links checker , Fonts Fetcher , Region determine , Compare pictures , Gradient color box , Mouse Coordinates, Colors, Pixel Search things , Encrypt/Decrypt and embeding file in jpeg thing , Hard disk space monitor , Reflex game , Multiplayer Tic Tac Toe , WLM ( MSN ) personal message changer Link to comment Share on other sites More sharing options...
Matthy Posted November 28, 2007 Author Share Posted November 28, 2007 woooooooooooooooooooooooooooooooow you can say that thx Link to comment Share on other sites More sharing options...
DW1 Posted November 28, 2007 Share Posted November 28, 2007 the more the merrier AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Matthy Posted November 28, 2007 Author Share Posted November 28, 2007 thanx for all the help the random works fine first was trying to do it by using a much harder way Link to comment Share on other sites More sharing options...
AlmarM Posted November 28, 2007 Share Posted November 28, 2007 #include <GUIConstants.au3> Global $Pressed = 0 While 1 Sleep(Random(1000, 5000, 1)) $Gui = GUICreate("Reactieman", 300, 100) $Button = GUICtrlCreateButton("GO", 0, 0, 300, 100) GUISetState() $Timer = TimerInit() Do If GUIGetMsg() = $Button Then $Pressed = 1 Until $Pressed = 1 GUIDelete($Gui) MsgBox(4096, "Test", Round(TimerDiff($Timer), 0) & "ms", 10) $Pressed = 0 WEndoÝ÷ ØýÊÞj׶në[yú+zgj|"X j÷Å©©ïêº^N¼ºÚ"µÍÙÐÞ M ][ÝÕÝ ][ÝËÝ[ [YY ÌÍÕ[YHÈLJH [È ][ÝÛÉ][ÝËL Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
DW1 Posted November 28, 2007 Share Posted November 28, 2007 #include <GUIConstants.au3> Global $Pressed = 0 While 1 Sleep(Random(1000, 5000, 1)) $Gui = GUICreate("Reactieman", 300, 100) $Button = GUICtrlCreateButton("GO", 0, 0, 300, 100) GUISetState() $Timer = TimerInit() Do If GUIGetMsg() = $Button Then $Pressed = 1 Until $Pressed = 1 GUIDelete($Gui) MsgBox(4096, "Test", Round(TimerDiff($Timer), 0) & "ms", 10) $Pressed = 0 WEndoÝ÷ Ù:òjëh×6MsgBox(4096, "Test", Round(TimerDiff($Timer) / 1000, 1) & "ms", 10)That would not work... it worked fine as it was... with this change, the seconds are mislabeled as miliseconds AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Matthy Posted November 28, 2007 Author Share Posted November 28, 2007 i now have... #include<GUIConstants.au3> Opt("GUIOnEventMode", 1) $test_var = 0 For $countvar = 0 to 20 ;Step 1 Sleep(Random(5000, 10000, 1)) GuiCreate("Reactieman", 300, 100,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $Button_17 = GuiCtrlCreateButton("GO", 100, 50, 100, 30) GUICtrlSetOnEvent( -1, "leave" ) $label = GUICtrlCreateLabel( "", 140, 25, 100 ) GUISetState () $timer = TimerInit() While WinExists( "Reactieman" ) Sleep(10) GUICtrlSetData( $label, Int(TimerDiff( $timer ))) WEnd Next Func leave() $test_time = Int(TimerDiff( $timer )) MsgBox(4096, "Test", Int(TimerDiff( $timer )) & " Miliseconds", 10) $test_var = $test_var + 1 $sMsg = 'Test' & $test_var & ': ' & $test_time & 'Ms' & @CRLF $file = FileOpen("Results.txt", 1) FileWrite($file, $sMsg) FileClose($file) ;Exit EndFunc $timer = TimerInit(0) ; gave errir $timer = 0 ; did not do anything and for the GUI i tried ti put in the script GUIClose($GUI) but that doesnt exits any ideas exept for rerunning the program because that would be to bad Cheers Matthy 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