Jump to content

Converting from AHK


Go to solution Solved by Malkey,

Recommended Posts

Posted

Welcome to AutoIt and the forum!

I assume this could be translated to AutoIt like this:

Func MButton()
    Send("^!c") ; Send Ctrl-ALT-c
    Return
EndFunc

My UDFs and Tutorials:

  Reveal hidden contents

 

  • Solution
Posted

I am totally guessing when the AHK script is run, when the middle mouse button is pressed Ctrl-ALT-c keys are send to the active window.
On this basis, this example is a modified copy of the example in the help file under the _IsPressed() function.
Note: When the Esc key is pressed, the script exits.

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $hDLL = DllOpen("user32.dll")

While 1
    If _IsPressed("4", $hDLL) Then ; Middle mouse button
        ; Wait until key is released.
        While _IsPressed("10", $hDLL)
            Sleep(250)
        WEnd
        Send("^!c") ; Send Ctrl-ALT-c
    ElseIf _IsPressed("1B", $hDLL) Then ; Esc key
        MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore the application will close in 4 seconds.", 4)
        ExitLoop
    EndIf
    Sleep(250)
WEnd

DllClose($hDLL)
Posted

Jos, I did do some digging before I posted. In general I don't ask, I it figure out.  I guess I should have asked where in the docs/wiki/help would be clues on how to do this. I checked all of them, looking for a "re-mapping" kind of thing.

Jimbo...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...