Jump to content

Gestures


Recommended Posts

This is a little script that rips off of the Mozilla Firefox addon "Mouse Gestures"

Basically, you fill out an .ini file with your programs and labels, and you can simply middle-click and drag in the direction you want and it will execute that function.

The script works with the middle-click button at the moment, because middle click is the least used button I have, but you can change that.

Heres how the layouts are laid-out(sorry, its a bit mixed up but i was too lazy to fix the script)

Posted Image

And here is what the "functions.ini" would look like (this is the one I'm using):

The Gestures section should be filled with file paths, and the labels would be the label for them.(they'll show up on the screen to let you know what your about to execute)

[Gestures]
Function1 = C:\Program Files\Mozilla Firefox\firefox.exe
Function2 = C:\Program Files\Microsoft Office\Office12\WINWORD.EXE
Function3 = explorer.exe C:\Documents and Settings\Kyle\My Documents\
Function4 = gate.exe
Function5 = explorer.exe C:\Documents and Settings\Kyle\My Documents\AutoIt Stuff\
Function6 = explorer.exe G:\
Function7 = calc.exe
Function8 = C:\Program Files\Guild Wars\Gw.exe

[Label]
Function1 = Mozilla Firefox
Function2 = Microsoft Word
Function3 = My Documents
Function4 = Secret Folder
Function5 = Autoit Folder
Function6 = Flash Drive
Function7 = Calculator
Function8 = Guildwars

And last, the actual code:

#include <Misc.au3>

$dll = DllOpen("user32.dll")
$ini = "functions.ini"
$func1 = IniRead($ini,"Gestures","Function1",@WindowsDir&"\system32\calc.exe")
$func2 = IniRead($ini,"Gestures","Function2",@WindowsDir&"\system32\calc.exe")
$func3 = IniRead($ini,"Gestures","Function3",@WindowsDir&"\system32\calc.exe")
$func4 = IniRead($ini,"Gestures","Function4",@WindowsDir&"\system32\calc.exe")
$func5 = IniRead($ini,"Gestures","Function5",@WindowsDir&"\system32\calc.exe")
$func6 = IniRead($ini,"Gestures","Function6",@WindowsDir&"\system32\calc.exe")
$func7 = IniRead($ini,"Gestures","Function7",@WindowsDir&"\system32\calc.exe")
$func8 = IniRead($ini,"Gestures","Function8",@WindowsDir&"\system32\calc.exe")
$funcl1 = IniRead($ini,"Label","Function1",@WindowsDir&"\system32\calc.exe")
$funcl2 = IniRead($ini,"Label","Function2",@WindowsDir&"\system32\calc.exe")
$funcl3 = IniRead($ini,"Label","Function3",@WindowsDir&"\system32\calc.exe")
$funcl4 = IniRead($ini,"Label","Function4",@WindowsDir&"\system32\calc.exe")
$funcl5 = IniRead($ini,"Label","Function5",@WindowsDir&"\system32\calc.exe")
$funcl6 = IniRead($ini,"Label","Function6",@WindowsDir&"\system32\calc.exe")
$funcl7 = IniRead($ini,"Label","Function7",@WindowsDir&"\system32\calc.exe")
$funcl8 = IniRead($ini,"Label","Function8",@WindowsDir&"\system32\calc.exe")

While   1
    Sleep ( 500 )
    ToolTip("")
    If _IsPressed("04", $dll) Then ;you can change 04 to whatever button you want to use
        $ori = MouseGetPos()
            SplashImageOn("","gdot.bmp","30","30",$ori[0]-15,$ori[1]-15,1)
        Do
            Sleep(100)
        $cur = MouseGetPos()
        If $ori[0] - $cur[0] > 100 And  $ori[1] - $cur[1] > 100  Then
            ToolTip($funcl1)
        ElseIf $ori[0] - $cur[0] < -100 And  $ori[1] - $cur[1] > 100  Then
            ToolTip($funcl2)
        ElseIf $ori[0] - $cur[0] > 100 And  $ori[1] - $cur[1] < -100  Then
            ToolTip($funcl3)
        ElseIf $ori[0] - $cur[0] < -100 And  $ori[1] - $cur[1] < -100  Then
            ToolTip($funcl4)
        ElseIf $ori[0] - $cur[0] > 50 Then
            ToolTip($funcl5)
        ElseIf $ori[0] - $cur[0] < -50 Then
            ToolTip($funcl6)
        ElseIf $ori[1] - $cur[1] > 50 Then
            ToolTip($funcl7)
        ElseIf $ori[1] - $cur[1] < -50 Then
            ToolTip($funcl8)
        Else
            ToolTip("")
        EndIf
        Until Not(_IsPressed("04", $dll));you can change 04 to whatever button you want to use
        $cur = MouseGetPos()
        If $ori[0] - $cur[0] > 100 And  $ori[1] - $cur[1] > 100  Then
            Run($func1)
        ElseIf $ori[0] - $cur[0] < -100 And  $ori[1] - $cur[1] > 100  Then
            Run($func2)
        ElseIf $ori[0] - $cur[0] > 100 And  $ori[1] - $cur[1] < -100  Then
            Run($func3)
        ElseIf $ori[0] - $cur[0] < -100 And  $ori[1] - $cur[1] < -100  Then
            Run($func4)
        ElseIf $ori[0] - $cur[0] > 50 Then
            Run($func5)
        ElseIf $ori[0] - $cur[0] < -50 Then
            Run($func6)
        ElseIf $ori[1] - $cur[1] > 50 Then
            Run($func7)
        ElseIf $ori[1] - $cur[1] < -50 Then
            Run($func8)
        Else
            SplashTextOn("Gestures","No action","250","20","-1","-1",2,"","","")
            Sleep(500)
            SplashOff()
        EndIf
        SplashOff()
    EndIf
WEnd
DllClose($dll)

Also, download this image to the script directory, it shouws you your original mouse position. It helps!

gdot.bmp

Edited by VindicatorOmega

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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...