Jump to content

Help with Mouse button commands.


King
 Share

Recommended Posts

I'm looking to make a script so that when I press mouse button 4 it sends the letter A one time, and when I press mouse button 5 it sends the letter B one time.

Can anyone lead me in a direction to make this script (sorry I am new at this)

Thanks in advance.

Link to comment
Share on other sites

This should help you out a bit: >MouseOnEvent UDF

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

I have read that like 5 times. This can't be that hard of a concept. I guess I just don't know how to start it. Maybe if I used F1,F2,F3,F4 keys.

What I want to look like is

Func 4MouseDown()
Send ( "keys" [, flag = 01] ) Phrase 1, Phrase 2.

EndFunc

or

Func  {F1}Down()
Send ( "keys" [, flag = 01] ) Phrase 1, Phrase 2.

Endfunc

To bad neither of those work.. LOL

Edited by King
Link to comment
Share on other sites

Maybe...

#include <MsgBoxConstants.au3>

; Press Esc to terminate script, Pause/Break to "pause"

Global $g_bPaused = False

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d

While 1
    Sleep(100)
WEnd

Func TogglePause()
    $g_bPaused = Not $g_bPaused
    While $g_bPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
EndFunc   ;==>ShowMessage

NEWHeader1.png

Link to comment
Share on other sites

I'm not looking to do a message box. I just want it to type the message out. When I press F1 it types the message wherever the curser is. For instance if I Pressed F1 it would type the message in this forum box because my curser is there.

Link to comment
Share on other sites

  • Moderators

What is the application you're typing the message into? You may be able to use control commands much more easily.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Ok so what I got it.

 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate("")

HotKeySet("{F2}", "sendit")

While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()

Func sendit()
    Send ("{ENTER}Text here")
EndFun

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate("")

HotKeySet("{F1}", "sendit")

While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()

Func sendit()
    Send ("Phrase 1")
EndFunc

HotKeySet("{F2}", "sendit")

While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()

Func sendit()
    Send ("Phrase 2")
EndFunc

HotKeySet("{F3}", "sendit")

While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()

Func sendit()
    Send ("Phrase 3")
EndFunc

HotKeySet("{F4}", "sendit")

While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()

Func sendit()
    Send ("Phrase 4")
EndFunc

This is what I want. But it doesn't work. It works if I just leave F1... but if I add 2 3 and 4 it doesn't work.

Link to comment
Share on other sites

Ok I got it.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate("")

HotKeySet("{F1}", "sendit1")
HotKeySet("{F2}", "sendit2")
HotKeySet("{F3}", "sendit3")
HotKeySet("{F4}", "sendit4")

While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()

Func sendit1()
    Send ("Phrase 1")
    EndFunc
Func sendit2()
    Send ("Phrase 2")
    EndFunc
Func sendit3()
    Send ("Phrase 3")
    EndFunc
Func sendit4()
    Send ("Phrase 4")
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...