Jump to content

MouseOnEvent UDF!


MrCreatoR
 Share

Recommended Posts

It requires Beta.

Well, actualy those introduced in 3.2.10.0 :).

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Hi first of all i want to say that u`ve made a good think doing this udf...and second i wanned to ask if there`s a way to integrate this udf with the hover udf to create the 3rd state of a button (pressed) thta would be very userfull

Link to comment
Share on other sites

  • 4 weeks later...

N!ce.

Any way of getting it to detect the scrollwheel, scrolled up or down?

__________

Test12

Yes:

#include <MouseSetOnEvent_UDF.au3>

_MouseSetOnEvent($MOUSE_WHELLSCROLL_EVENT, "Scroll_Event")

Sleep(3000)

_MouseSetOnEvent($MOUSE_WHELLSCROLL_EVENT) ;Unset


Func Scroll_Event()
    ConsoleWrite("Scroll Event Fired" & @LF)
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

No sorry, like in :

#include <MouseSetOnEvent_UDF.au3>
$hGUI = WinGetHandle("Blaaaa")

_MouseSetOnEvent($MOUSE_WHELLSCROLL_EVENT_UP, "MOUSE_WHELLSCROLL_UP", "", "", $hGUI)
_MouseSetOnEvent($MOUSE_WHELLSCROLL_EVENT_DOWN, "MOUSE_WHELLSCROLL_DOWN", "", "", $hGUI)

While 1
    Sleep(100)
WEnd

Exit

Func MOUSE_WHELLSCROLL_UP()
    ConsoleWrite("UP" & @CR)
EndFunc

Func MOUSE_WHELLSCROLL_DOWN()
    ConsoleWrite("DOWN" & @CR)
EndFunc

_____________________

Test12

Edited by test12
Link to comment
Share on other sites

$MOUSE_WHELLSCROLL_EVENT_UP

No, there is no event that can handle scroll down/up, but perhaps there is need to check some param, but i don't know what exactly to check...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

@MrCreator

About the mouse wheel, I found some C# code with google codesearch: MouseHookProc

Line 651

MouseLLHookStruct mouseHookStruct = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct));

                //detect button clicked
                MouseButtons button = MouseButtons.None;
                short mouseDelta = 0;
                switch (wParam)
                {
                    case WM_LBUTTONDOWN:
                        //case WM_LBUTTONUP:
                        //case WM_LBUTTONDBLCLK:
                        button = MouseButtons.Left;
                        break;
                    case WM_RBUTTONDOWN:
                        //case WM_RBUTTONUP:
                        //case WM_RBUTTONDBLCLK:
                        button = MouseButtons.Right;
                        break;
                    case WM_MOUSEWHEEL:
                        //If the message is WM_MOUSEWHEEL, the high-order word of mouseData member is the wheel delta.
                        //One wheel click is defined as WHEEL_DELTA, which is 120.
                        //(value >> 16) & 0xffff; retrieves the high-order word from the given 32-bit value
                        mouseDelta = (short)((mouseHookStruct.mouseData >> 16) & 0xffff);
                        //TODO: X BUTTONS (I havent them so was unable to test)
                        //If the message is WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP,
                        //or WM_NCXBUTTONDBLCLK, the high-order word specifies which X button was pressed or released,
                        //and the low-order word is reserved. This value can be one or more of the following values.
                        //Otherwise, mouseData is not used.
                        break;
                }

What ever I try I can't seem to translate this to AutoIt, probably due to my limited knolledge.

Would you be willing to enlighten me?

__________

Test12

Link to comment
Share on other sites

Would you be willing to enlighten me?

Well, my knowledge is very limited as well in C# :)

I supose we need to call somehow the GET_WHEEL_DELTA_WPARAM macro, but how, it's a really question for me... i read info about it on MSDN, but can't figure it out...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 3 weeks later...

Awesome job:-), MrCreatoR!

Is it possible to implement Larry's hook.dll in AutoIt script? Such as adding a _KeySetOnEvent() function to your UDFs. I heard that HotKeySet() has some limitations on both the keys and the number of keys.

I'm really expecting that! :)

Link to comment
Share on other sites

  • 3 weeks later...

is it possible to detect clicks / cords while mouse input is being blocked? (ie what button and where would have been clicked even though it didn't)

something like.... but this isn't working

#include <Misc.au3>
#include <MouseSetOnEvent_UDF.au3>

$dll = DllOpen("user32.dll")


While 1
    Select
    Case _IsPressed("C0", $dll) ; ` (tilde) Key
        While _IsPressed("C0", $dll)
            _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "__Dummy")
            _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "__Dummy")
            _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "__Dummy")
            _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT, "__Dummy")
            Sleep(10)
            ; Display Clicks
            If _IsPressed("01", $dll) Then 
                While _IsPressed("01", $dll)
                    ; do nothing 
                WEnd
                $pos = MouseGetPos()
                MsgBox(0, "Had this click not been blocked... Mouse x,y:", $pos[0] & "," & $pos[1])
            EndIf 
        WEnd
        _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT)
        _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT)
        _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT)
        _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT)
    Case Else
        sleep (10)
    EndSelect

WEndoÝ÷ Ø@ÈMg¥Øb²H§u¬(®K ¶[[ºÖÛh£¥Z%~Z(vËazÇ+yéðØfº[b¦W¦²èÇlr¥vÇ­j»§¢w~V nëm«lyé¬i¸­­¶®¶­sb6æ6ÇVFRfÇC´Ö62æS2fwC°¢6æ6ÇVFRfÇC´Ö÷W6U6WDöäWfVçEõTDbæS2fwC° ¢b33c¶FÆÂÒFÆÄ÷VâgV÷C·W6W#3"æFÆÂgV÷C²  ¥vÆR 6VÆV7@ 66Rô5&W76VBgV÷C´3gV÷C²Âb33c¶FƲb3c²FÆFR¶W vÆRô5&W76VBgV÷C´3gV÷C²Âb33c¶FÆ ôÖ÷W6U6WDöäWfVçBb33c´ÔõU4Uõ$Ô%DõtåôUdTåBÂgV÷Cµ&V6÷&BgV÷C² ²ôÖ÷W6U6WDöäWfVçBb33c´ÔõU4Uõ4T4ôäD%UôUdTåBÂgV÷Cµ&V6÷&BgV÷C² ²ôÖ÷W6U6WDöäWfVçBb33c´ÔõU4Uõ4T4ôäD%DõtåôUdTåBÂgV÷Cµ&V6÷&BgV÷C² 6ÆVW tVæ@¢ôÖ÷W6U6WDöäWfVçBb33c´ÔõU4Uõ$Ô%DõtåôUdTåB 66RVÇ6P 6ÆVW VæE6VÆV7@ ¥tVæ@ ¤gVæ2&V6÷&B b33c·÷2ÒÖ÷W6TvWE÷2 ×6t&÷ÂgV÷C´BF26Æ6²æ÷B&VVâ&Æö6¶VBâââÖ÷W6RÇ¢gV÷C²Âb33c·÷5³ÒfײgV÷C²ÂgV÷C²fײb33c·÷5³Ò¤VæDgVæ0
Edited by zhenyalix

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

getting somewhat closer...

this seemingly works but i get a error in the UDF and it crashes... note the udf doesn't bug if i just disable mouse clickse with a __Dummy >.<

error is:

C:\Program Files\AutoIt3\Include\MouseSetOnEvent_UDF.au3 (82) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

If $aMouse_Events[$i][0] = $iEvent Then

If ^ ERROR

->06:53:07 AutoIT3.exe ended.rc:1

#include <Misc.au3>
#include <MouseSetOnEvent_UDF.au3>

$dll = DllOpen("user32.dll")

While 1
    Select
        Case _IsPressed("C0", $dll) ; ` (tilde) Key
            ToolTip('MouseClicks is disabled tilde down....')
        While _IsPressed("C0", $dll)
            ; _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "__Dummy")
            _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "MousePrimaryDown_Event")
            ; _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT, "MouseSecondaryDown_Event")
            Sleep(10)
        WEnd
        ToolTip('MouseClicks is ENABLED tilde up....')
        _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT)
        ; _MouseSetOnEvent($MOUSE_SECONDARYDOWN_EVENT)
    Case Else
        sleep (10)
    EndSelect

WEnd

Func MouseSecondaryDown_Event()
        Local $pos  
        $pos = MouseGetPos()
        ToolTip("Had This RIGHT click not been blocked... Mouse x,y:" & $pos[0] & "," & $pos[1])
EndFunc

Func MousePrimaryDown_Event()
        Local $pos
        $pos = MouseGetPos()
        ToolTip("Had this LEFT click not been blocked... Mouse x,y:" & $pos[0] & "," & $pos[1])
EndFunc

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

i get a error in the UDF and it crashes

That's strange, i got no errors with this example...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Detect clicks / cords while mouse input is being blocked:

Here is a solution I came up with. I am still new to AutoIT, so it may be a little crude.

Using the UDF from this post and the UDF from LxP's post of "_ControlGetHandleByPos" here.

#include <_ControlGetHandleByPos.au3>
#include <MouseSetOnEvent_UDF.au3>
AutoItSetOption("TrayIconDebug", 1)

HotKeySet("{PAUSE}", "Terminate")
$winSiS = "LabCorp SIS"
_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "LeftMouseDown");Set LeftMouseClick Event
Dim $pos[2]
$pos[0] = 0
$pos[1] = 0
$intMC = 0
$ctrlInfo = "Not found or Exit before found."

While 1
    Sleep(100)
    If $intMC = 1 Then
        $intMC = 0
        _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "LeftMouseDown");Re-enable LeftMouseClick Event
    EndIf
WEnd

Func LeftMouseDown()
    _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT);Enable mouse button back.
    MouseClick("left");Left Click were mouse is at to get data
    $pos = MouseGetPos()
    $ctrlHndl = _ControlGetHandleByPos($winSiS, "", $pos[0], $pos[1])
    $curData = ControlGetText($winSiS, "", $ctrlHndl)
    If StringLen($curData) > 12 Then $curData = StringLeft($curData, 12)
    $handle = ControlGetHandle($winSiS, "", $ctrlHndl)
    $intMC = 1
    $ctrlInfo = "Control Handle: " & $handle & " Data: " & $curData
    ToolTip($ctrlInfo)
EndFunc

Func Terminate()
    MsgBox(0, "Control Info", $ctrlInfo)
;ClipPut('MouseClick("left",' & $pos[0] & ',' & $pos[1] & ',1,1); wrt Client')
    Exit
EndFunc ;==>Terminate
Link to comment
Share on other sites

  • 1 month later...

Example for a custom context menu using this UDF -

http://www.autoitscript.com/forum/index.ph...st&p=556093

My Error is this...

C:\Program Files\AutoIt3\Include\MouseSetOnEvent_UDF.au3 (3) : ==> Can not redeclare a constant.:

Global Const $WH_MOUSE_LL = 14

Global Const ^ ERROR

Help?

it works with

#include <MouseSetOnEvent_UDF.au3>
_MouseSetOnEvent($MOUSE_EXTRABUTTONDOWN_EVENT, "cont")
$wait = True
HotKeySet("{HOME}", "cont")
While $wait = True
    Sleep(100)
WEnd
MsgBox(0, "IT WORKS", "...")
ExitƒoÝŠ÷ Ø[§qÊ'·MúÁ¨­

I took out everything but what was making the error...

and that is #include <ScreenCature.au3>

your going to have to make it compatible :)

Edit:

NVM, i did it my self,

if anyone else has the problem then do a replace all with

$WH_MOUSE_LL

to $WH_MOUSE_LL_EVENT

works great >_< Thanks MrCreatoR

Edited by APPLEEATER
Link to comment
Share on other sites

  • 1 month later...

So I am trying to code when the mouse wheel is clicked, it launches itunes play/pause command. I got it to work by hotkey, but not by mouse. It seems not to be able to find itunes app when the mouse hotkey tries to use it, but the keyboard works fine.

iTunesUDF.au3 (68) : ==> The requested action with this object has failed.:

$iTunesApp.PlayPause

$iTunesApp.PlayPause^ ERROR

CODE
#include <MouseSetOnEvent_UDF.au3>

#include <iTunesUDF.au3>

_iTunes_Start()

HotKeySet("{Esc}", "quit")

HotKeySet("{MEDIA_PLAY_PAUSE}", "PausePlay")

HotKeySet("{MEDIA_NEXT}","trackNext")

_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT , "PausePlay")

while 1

sleep (1000)

WEnd

Func PausePlay()

_iTunes_Play_Pause()

EndFunc

Func trackNext()

_iTunes_Next()

EndFunc

Func quit()

_iTunes_Quit()

_MouseSetOnEvent($MOUSE_WHELLDOWN_EVENT)

Exit(0)

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

×
×
  • Create New...