Jump to content

Ini is not writing down correct values...


Recommended Posts

This seems to work just fine for me...

While $x=true
        
        Do
            
            If _IsPressed("01") Then
                $timer=TimerInit()
                $pos=MouseGetPos()
                tooltip( $timer & "  " & $pos[ 0 ] & "  " & $pos[ 1 ] )
                $tick += 1
                IniWrite( "Coords.ini" , "Coords" , "x: " & $tick , $pos[ 0 ] )
                IniWrite( "Coords.ini" , "Coords" , "y: " & $tick , $pos[ 1 ] )
                $kill=TimerDiff($timer)
                IniWrite( "Coords.ini" , "Coords" , "time: " & $tick , $kill )
            EndIf
            
            Do
            ;nothing
            Until NOT _isPressed("01")
            
        Until _IsPressed("53")
    
    Wend
Link to comment
Share on other sites

This seems to work just fine for me...

While $x=true
        
        Do
            
            If _IsPressed("01") Then
                $timer=TimerInit()
                $pos=MouseGetPos()
                tooltip( $timer & "  " & $pos[ 0 ] & "  " & $pos[ 1 ] )
                $tick += 1
                IniWrite( "Coords.ini" , "Coords" , "x: " & $tick , $pos[ 0 ] )
                IniWrite( "Coords.ini" , "Coords" , "y: " & $tick , $pos[ 1 ] )
                $kill=TimerDiff($timer)
                IniWrite( "Coords.ini" , "Coords" , "time: " & $tick , $kill )
            EndIf
            
            Do
        ;nothing
            Until NOT _isPressed("01")
            
        Until _IsPressed("53")
    
    Wend
What that will do is when Left click is pressed it will get the coords and write them down... And right after that (a few milliseconds) it stops the timer and writes down the time... there is no room in there for the timer to actually let the user to record there time, its just plain stopping it...

Anyone else? :)

Link to comment
Share on other sites

is this what u want?

#include <misc.au3>
HotKeySet("{F11}", "start_recording")
HotKeySet("{F10}", "stop_recording")
HotKeySet("{F9}", "display_recorded")
HotKeySet("{ESC}", "_quit")
Global $recording = 0, $tick = 0, $time, $timer, $text = "", $temp_text = "", $Display_time
TrayTip("", "Press F11 for start recording," & @CRLF & "then Mouse Left click to detect" & @CRLF _
            & "Press F10 to stop recording" & @CRLF & "Press F9 to see recorded" & @CRLF & "press ESC to quit", 30)
While 1
    if $recording Then
        if _IsPressed("01") then
            $time = TimerDiff($timer)
            $pos=MouseGetPos()
            $tick += 1
            $Display_time = Round(TimerDiff($timer), 2)
            $temp_text = ">==========" & @CRLF & "Section: Coords" & @CRLF & "key: x" & $tick & " = " & $pos[0] _
                        & @CRLF & "key: y" & $tick & " = " & $pos[1] _
                        & @CRLF & "key: time" & $tick & " = " & $Display_time & @CRLF & ">==========" & @CRLF
            $text &= ">==========" & @CRLF & "Section: Coords" & @CRLF & "key: x" & $tick & " = " & $pos[0] _
                        & @CRLF & "key: y" & $tick & " = " & $pos[1] _
                        & @CRLF & "key: time" & $tick & " = " & $Display_time & @CRLF & ">==========" & @CRLF
            ConsoleWrite($temp_text)
            Do              ;put this Do Until bellow _IsPressed (line 11) if you wanna detect when user release the
            Until NOT _IsPressed("01")  ;left click, or let it stay here if you wanna detect the moment user hit the left click
        EndIf
    EndIf
WEnd
func display_recorded()
    MsgBox(0, "recorded text:", $text)
EndFunc
func start_recording()
    if NOT $recording Then
        $timer=TimerInit()
        $recording = 1
        ConsoleWrite(">=====" & @CRLF & "Recording Started" & @CRLF & ">=====" & @CRLF)
    EndIf
EndFunc
func stop_recording()
    if $recording Then
        $recording = 0
        ConsoleWrite(">=====" & @CRLF & "Recording Stopped" & @CRLF & ">=====" & @CRLF)
    EndIf
EndFunc
func _quit()
    Exit
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...