Is there any way to assign a macro to a mousewheel up or mousewheel down movement? Thanks.
Also, is there any command in MS to activate mousewheel up/down?
Mousewheel
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Macro Veteran
- Posts: 260
- Joined: Fri Apr 15, 2005 8:32 am
- CyberCitizen
- Automation Wizard
- Posts: 724
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Could that not be made as part of a trigger?
Code: Select all
Custom Trigger
·Allows you to create your own trigger using code by pointing to a script file. See below for details.
Macro Scheduler needs to be running for these triggers to be actioned.
More triggers can be implemented by building them into the script itself. Events and conditions can be coded into continuously looping macros so that they themselves detect conditions and act on them - e.g. screen changes, window changes, object caption changes, event log entries, ini file values, registry values, and almost anything you can think of.
Custom Triggers
Custom triggers allow you to define any kind of trigger imaginable by coding the trigger check yourself using MacroScript code. There are some rules:
A trigger script must have two subroutines as follows:
Trigger: This subroutine is executed periodically (less than once a second) by the scheduler and is used to determine whether or not the macro should fire. Set MACRO_RESULT to "TRUE" (upper case) to cause the trigger to fire (i.e. to run the macro). Setting MACRO_RESULT to anything else (or not setting it) will do nothing. So, the macro will not run until MACRO_RESULT is "TRUE" (upper case). The subroutine name is case sensitive.
Reset: Once Trigger returns "TRUE" the macro will run and thereupon the scheduler will no longer run the Trigger routine and instead will keep running Reset until it returns "TRUE" (upper case). Once Reset returns TRUE the scheduler will again run Trigger. Note, the subroutine name is case sensitive.
Since Trigger routines are run frequently on a very tight interval they should be kept as small as possible and should not be long running. Don't make Trigger scripts that perform too much complicated processing or include delays as this could cause resource issues.
Here's a small example trigger script which implements a simple Window Open trigger:
SRT>Trigger
IfWindowOpen>Calculator
Let>MACRO_RESULT=TRUE
Else
Let>MACRO_RESULT=FALSE
Endif
END>Trigger
SRT>Reset
IfWindowOpen>Calculator
Let>MACRO_RESULT=FALSE
Else
Let>MACRO_RESULT=TRUE
Endif
END>Reset
FIREFIGHTER
-
- Macro Veteran
- Posts: 260
- Joined: Fri Apr 15, 2005 8:32 am
Sounds good so far. How would I make mousewheel up/down be the trigger please (based on the code below)?
Code: Select all
SetFocus>firefox*
Let>MOUSEEVENTF_WHEEL=2048
LibFunc>user32,mouse_event,r,MOUSEEVENTF_WHEEL,0,0,-260,0
As far as I can tell "the code" will emulate a wheel scroll but does not detect one.
Typically, a mouse wheel scroll is detected by a specific window to act on that window. Macro Scheduler Dialogs have wheel scroll detection and you can create an event handler to work with wheel scrolls.
Here's an example where Dialog1 has dialog event handlers to detect wheel scroll and dialog 2 will display the result of a scroll. The downside is that dailog1 must have focus to detect the wheel scroll. I think you're going to run into that no matter what. I made dialog1 nearly "invisible" setting alphablend to 1 so the window is still selectable but is not visible.
Typically, a mouse wheel scroll is detected by a specific window to act on that window. Macro Scheduler Dialogs have wheel scroll detection and you can create an event handler to work with wheel scrolls.
Here's an example where Dialog1 has dialog event handlers to detect wheel scroll and dialog 2 will display the result of a scroll. The downside is that dailog1 must have focus to detect the wheel scroll. I think you're going to run into that no matter what. I made dialog1 nearly "invisible" setting alphablend to 1 so the window is still selectable but is not visible.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
AlphaBlend = True
AlphaBlendValue = 1
BorderStyle = bsNone
Caption = 'DetectMouseWheelScroll'
ClientHeight = 500
ClientWidth = 500
end
EndDialog>Dialog1
Dialog>Dialog2
object Dialog2: TForm
Caption = 'Mouse Wheel Message'
ClientHeight = 78
ClientWidth = 275
Position = poScreenCenter
object Label1: TLabel
Left = 48
Top = 32
Width = 32
Height = 13
Caption = ''
end
end
EndDialog>Dialog2
AddDialogHandler>Dialog1,,OnMouseEnter,FocusD1
AddDialogHandler>Dialog1,,OnMouseWheelUp,WheelUp
AddDialogHandler>Dialog1,,OnMouseWheelDown,WheelDown
AddDialogHandler>Dialog2,,OnClose,Quit
Show>Dialog1
Show>Dialog2
SetFocus>DetectMouseWheelScroll
Label>Loop
Wait>0.01
Goto>Loop
SRT>Quit
Exit>0
END>Quit
SRT>WheelUp
SetDialogProperty>Dialog2,label1,Caption,Mouse wheel scroll up
END>WheelUp
SRT>WheelDown
SetDialogProperty>Dialog2,label1,Caption,Mouse wheel scroll down
END>WheelDown
SRT>FocusD1
SetFocus>DetectMouseWheelScroll
END>FocusD1