Jump to content

Mouse Stuff


Recommended Posts

First my script:

#include <GUIConstants.au3>
GUICreate("MouseRecorder")
HotKeySet("{ESC}", "Terminate")
$file = FileOpen("C:\Documents and Settings\Administrator\Desktop\New Text document.txt", 2)
Global $time

While 1
    While 1
        $i = GUIGetCursorInfo()
        If $i[2] = 1 Then
            $dif = TimerDiff($time)
            FileWriteLine($file, $dif);needs to not write the first time
            ExitLoop
        EndIf
    WEnd
    
    While 1
        $i = GUIGetCursorInfo()
        If $i[2] = 0 Then
            $time = TimerInit()
            ExitLoop
        EndIf
    WEnd
WEnd

Func Terminate()
    FileClose($file)
    Sleep(3000)
    Run("C:\Documents and Settings\Administrator\Desktop\New Text document.txt");I can't get the run to work.
    Exit
EndFunc  ;==>Terminate

Now my problem, is there a way to make it not take away all the CPU? If I run it in a lower priorty it works but i dont know if it affects the results.

Edited by gamerman2360
Link to comment
Share on other sites

#include <GUIConstants.au3>
GUICreate("MouseRecorder")
HotKeySet("{ESC}", "Terminate")
$file = FileOpen("C:\Documents and Settings\Administrator\Desktop\New Text document.txt", 2)
Global $time

While 1
    While 1
        $i = GUIGetCursorInfo()
        If $i[2] = 1 Then
            $dif = TimerDiff($time)
            ExitLoop
        EndIf
    WEnd
    
    While 1
        $i = GUIGetCursorInfo()
        If $i[2] = 0 Then
            $time = TimerInit()
            ExitLoop
        EndIf
    WEnd
    Sleep(1)
    FileWriteLine($file, $dif);needs to not write the first time
WEnd

Func Terminate()
    FileClose($file)
    Sleep(3000)
    Run("C:\Documents and Settings\Administrator\Desktop\New Text document.txt");I can't get the run to work.
    Exit
EndFunc ;==>Terminate

So this? I don't see how the FileWriteLine() change helps.

Link to comment
Share on other sites

I mean move the Sleep(1) not FileWriteLine() lol, like this...

#include <GUIConstants.au3>
GUICreate("MouseRecorder")
HotKeySet("{ESC}", "Terminate")
$file = FileOpen("C:\Documents and Settings\Administrator\Desktop\New Text document.txt", 2)
Global $time

While 1
    While 1
        $i = GUIGetCursorInfo()
        If $i[2] = 1 Then
            $dif = TimerDiff($time)
            FileWriteLine($file, $dif);needs to not write the first time
            ExitLoop
        EndIf
        Sleep(1)
    WEnd
    While 1
        $i = GUIGetCursorInfo()
        If $i[2] = 0 Then
            $time = TimerInit()
            ExitLoop
        EndIf
    WEnd
WEnd

qq

Link to comment
Share on other sites

You mat find that a larger Sleep() value may help to further lower CPU usage (from recent posts it appears that Sleep(1) can be as bad as no Sleep() at all...).

Link to comment
Share on other sites

You mat find that a larger Sleep() value may help to further lower CPU usage (from recent posts it appears that Sleep(1) can be as bad as no Sleep() at all...).

<{POST_SNAPBACK}>

Actually i think the most recent stuff on sleep says that sleep(1) = sleep(15) rather than no sleep at all
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...