|
|
|
09-05-2017, 09:27 AM
|
#1
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
|
Get/SetMouseModifier() questions
Documentation for these is below, I don't fully understand it though.
What I actually want to do in my script:
1 At script start store what action is currently assigned to say "Media item left drag, Default action" in Mouse modifiers.
2. Modify this assignment during script execution. This part is covered with "Set default mouse modifier action..." in action list.
3. At script exit, restore the original assigment from step 1.
Is this possible with these functions ?
Quote:
C: void GetMouseModifier(const char* context, int modifier_flag, char* action, int action_sz)
EEL: GetMouseModifier("context", int modifier_flag, #action)
Lua: string action = reaper.GetMouseModifier(string context, integer modifier_flag, string action)
Python: (String context, Int modifier_flag, String action, Int action_sz) = RPR_GetMouseModifier(context, modifier_flag, action, action_sz)
Get the current mouse modifier assignment for a specific modifier key assignment, in a specific context.
action will be filled in with the command ID number for a built-in mouse modifier
or built-in REAPER command ID, or the custom action ID string.
See SetMouseModifier for more information.
|
and
Quote:
C: void SetMouseModifier(const char* context, int modifier_flag, const char* action)
EEL: SetMouseModifier("context", int modifier_flag, "action")
Lua: reaper.SetMouseModifier(string context, integer modifier_flag, string action)
Python: RPR_SetMouseModifier(String context, Int modifier_flag, String action)
Set the mouse modifier assignment for a specific modifier key assignment, in a specific context.
Context is a string like "MM_CTX_ITEM". Find these strings by modifying an assignment in
Preferences/Editing/Mouse Modifiers, then looking in reaper-mouse.ini.
Modifier flag is a number from 0 to 15: add 1 for shift, 2 for control, 4 for alt, 8 for win.
(macOS: add 1 for shift, 2 for command, 4 for opt, 8 for control.)
For left-click and double-click contexts, the action can be any built-in command ID number
or any custom action ID string. Find built-in command IDs in the REAPER actions window
(enable "show action IDs" in the context menu), and find custom action ID strings in reaper-kb.ini.
For built-in mouse modifier behaviors, find action IDs (which will be low numbers)
by modifying an assignment in Preferences/Editing/Mouse Modifiers, then looking in reaper-mouse.ini.
Assigning an action of -1 will reset that mouse modifier behavior to factory default.
See GetMouseModifier.
|
|
|
|
09-13-2017, 08:31 PM
|
#2
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
This was always a tempting little nugget, but I never messed with it until now. This seems to work after very little testing, but I'm not sure if it's the right thing to do or anything...
Code:
#context = "MM_CTX_ITEM_CLK";
function altclickmediaitem()(runloop("altclickmediaitem()"));
function exit()(SetMouseModifier(#context, 4, #action));
GetMouseModifier(#context, 4, #action);
SetMouseModifier(#context, 4, "41299");//move pos to edit curs
altclickmediaitem();
atexit("exit()");
Say I have
40746 Item: Split item under mouse cursor
on Alt click media item
I have that script on Alt Win G (arbitrary)
altclick-split, altclick-split, altwin+G, altclick-move item pos to cursor, altclick-move item pos to cursor, altwin+G, altclick-split, altclick-split,etc...
I suppose I should say you might be able to avoid the background part with extstate or something.
Last edited by FnA; 09-13-2017 at 09:46 PM.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:46 AM.
|