Sign in to follow this  
Followers 0
verto

On mouse click?

10 posts in this topic

I want to set up a part of a script to run after I click my mouse down. And then stop when I release. Any ideas?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

while _IsPressed("01")

;do stuff

wend

Or, to make it work.

#Include <Misc.au3>
While 1
    Tooltip("")
    If _IsPressed(01) Then
        While _IsPressed(01)
            Tooltip("You're Holding the Mouse!")
            ;Do whatever
        Wend
    EndIf
WEnd
Edited by Paulie

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Pffft, who needs scripts that actually work? Not me, I'll tell you.

lol, dont worry, neither of em work. Might be somethin Im doin wrong lol

#include <Misc.au3>
HotKeySet("{esc}", "Quit")
$IniFile = @ScriptDir & "\Test.ini"
$mouse = MouseGetPos()
$x = 1
$y = 1
While 1
    If _IsPressed(01) Then
        While _IsPressed(01)
            Do
                IniWrite (@ScriptDir & "\MousePos.ini","Coords","x" & $x,$mouse[0])
                IniWrite (@ScriptDir & "\MousePos.ini","Coords","y" & $y,$mouse[1])
                $x = $x + 1
                $y = $y + 1
            Until  _IsPressed(01) = 0
        Wend
    EndIf
WEnd
Func Quit()
    Exit
EndFunc
Edited by verto

Share this post


Link to post
Share on other sites

#include <Misc.au3>
HotKeySet("{esc}", "Quit")
$IniFile = @ScriptDir & "\Test.ini"
$mouse = MouseGetPos()
$x = 1
$y = 1
While 1
    If _IsPressed(01) Then
        While _IsPressed(01)
                IniWrite (@ScriptDir & "\MousePos.ini","Coords","x" & $x,$mouse[0])
                IniWrite (@ScriptDir & "\MousePos.ini","Coords","y" & $y,$mouse[1])
                $x = $x + 1
                $y = $y + 1
        Wend
    EndIf
WEnd
Func Quit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

#include <Misc.au3>
HotKeySet("{esc}", "Quit")
$IniFile = @ScriptDir & "\Test.ini"
$mouse = MouseGetPos()
$x = 1
$y = 1
While 1
    If _IsPressed(01) Then
        While _IsPressed(01)
                IniWrite (@ScriptDir & "\MousePos.ini","Coords","x" & $x,$mouse[0])
                IniWrite (@ScriptDir & "\MousePos.ini","Coords","y" & $y,$mouse[1])
                $x = $x + 1
                $y = $y + 1
        Wend
    EndIf
WEnd
Func Quit()
    Exit
EndFunc
That still doesnt work the way I Need it to, I need it so that when I release the left click, then it will end that. Its part of a much bigger script and having esc. bound like that wont work for me, thats just there cause it was freakin out earlier and I needed a way out of it.

Share this post


Link to post
Share on other sites

That still doesnt work the way I Need it to, I need it so that when I release the left click, then it will end that. Its part of a much bigger script and having esc. bound like that wont work for me, thats just there cause it was freakin out earlier and I needed a way out of it.

Like this?

#include <Misc.au3>
HotKeySet("{esc}", "Quit")
$IniFile = @ScriptDir & "\Test.ini"
$mouse = MouseGetPos()
$x = 1
$y = 1
While 1
    If _IsPressed(01) Then
                IniWrite (@ScriptDir & "\MousePos.ini","Coords","x" & $x,$mouse[0])
                IniWrite (@ScriptDir & "\MousePos.ini","Coords","y" & $y,$mouse[1])
                $x = $x + 1
                $y = $y + 1
    EndIf
WEnd
Func Quit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

What exactly do you need this for? You know, instead of making people guess? Could you describe the "much bigger script"?


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

What exactly do you need this for? You know, instead of making people guess? Could you describe the "much bigger script"?

That will record the path of the mouse, as in the entire path, not just start/end point. And it will send it to a .ini to be read later. That is the purpose of it. And from there all kinds of junk will be done with the coordinates given to me by this bit.

The

$y = $y+1

$x = $x=1

part makes it so that the resulting file will have something along the lines of

mousex1 = coord

mousey1 = coord

mousex2 = coord

mousey2 = coord

mousex3 = coord

mousey3 = coord

and so on, for the entire length of the script.

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