Sign in to follow this  
Followers 0
gamerman2360

Mouse Stuff

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try adding a Sleep(1) in the main loop.

Edit: Actually make that the loop with FileWriteLine()

Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
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.

Share this post


Link to post
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

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
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...).

Share this post


Link to post
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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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
Sign in to follow this  
Followers 0