Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 05-22-2019, 12:52 PM   #1
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,057
Default Copy selected item and past at mouse position without moving the edit cursor ?

hey guys

I want to use "middle click" in the arrange view to:

copy selected item and past at mouse position without moving the edit cursor.

possible?

I tried to make custom action with "sws - undo move edit cursor" but it doesn't work, the edit cursor moves 2 positions back instead of just undo the move after pasting the item.


please help

thanks
Reflected is offline   Reply With Quote
Old 05-22-2019, 01:15 PM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,795
Default

If you use 'SWS/BR: Save edit cursor position, slot x' / 'SWS/BR: Restore edit cursor position, slot x' instead of the 'sws - undo move edit cursor'? (didn't try myself)
nofish is offline   Reply With Quote
Old 05-22-2019, 01:27 PM   #3
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,057
Default

Quote:
Originally Posted by nofish View Post
If you use 'SWS/BR: Save edit cursor position, slot x' / 'SWS/BR: Restore edit cursor position, slot x' instead of the 'sws - undo move edit cursor'? (didn't try myself)
it doesn't work.
it saves the position of the edit cursor after clicking (even if I put the "save edit cursor" before the "copy item..") so nothing happens. :/

other ideas? scripts?
Reflected is offline   Reply With Quote
Old 05-22-2019, 01:45 PM   #4
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,414
Default

I do that in my script, but I wrote my own item functions for that
probably the easiest way would be via chunk

get all selected items chunk
addmediaitem to track
set that chunk to it
move it to mouse position via reaper.SetMediaItemPosition( item, position, refreshUI )
Sexan is offline   Reply With Quote
Old 05-22-2019, 01:59 PM   #5
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,806
Default

I havr a script to do that,
loook for Duplicate in key search :P
X-Raym is offline   Reply With Quote
Old 05-22-2019, 02:47 PM   #6
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,057
Default

Quote:
Originally Posted by X-Raym View Post
I havr a script to do that,
loook for Duplicate in key search :P
i use ur script
"Script: X-Raym_Copy selected items and paste at mouse position.lua"

the problem that the edit cursor still moves when I use it with mouse middle click.

have another script ?
Reflected is offline   Reply With Quote
Old 05-22-2019, 02:48 PM   #7
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,057
Default

Quote:
Originally Posted by Sexan View Post
I do that in my script, but I wrote my own item functions for that
probably the easiest way would be via chunk

get all selected items chunk
addmediaitem to track
set that chunk to it
move it to mouse position via reaper.SetMediaItemPosition( item, position, refreshUI )
script link?
Reflected is offline   Reply With Quote
Old 05-22-2019, 02:56 PM   #8
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 2,414
Default

I can write it for you,but if Rays script already do that it it can be modded to paste at mouse position
Sexan is offline   Reply With Quote
Old 05-22-2019, 03:21 PM   #9
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,806
Default

"Script: X-Raym_Copy selected items and paste at mouse position.lua"

Oh yes this is the one.

If you don't want it to move edit cursor, you can use it in a custom action with SWS actions to Save and Restore cursor position.It should works.
X-Raym is offline   Reply With Quote
Old 05-23-2019, 04:54 AM   #10
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,795
Default

Quote:
Originally Posted by Reflected View Post
the problem that the edit cursor still moves when I use it with mouse middle click.
Isn't that because of the option: 'Editing behaviour -> Move edit cursor when pasting/inserting items'?

If so, if you want to have it enabled generally maybe disable it temporarily in your script / custom action?
(I wouldn't know how though currently from top of head.)
nofish is offline   Reply With Quote
Old 05-23-2019, 05:20 AM   #11
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,057
Default

Quote:
Originally Posted by nofish View Post
Isn't that because of the option: 'Editing behaviour -> Move edit cursor when pasting/inserting items'?

i already turned off this option but still the same
Reflected is offline   Reply With Quote
Old 05-23-2019, 05:21 AM   #12
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,057
Default

Quote:
Originally Posted by Sexan View Post
I can write it for you,but if Rays script already do that it it can be modded to paste at mouse position

can you please?

X-Raym
can you give sexan the code for modding it?
Reflected is offline   Reply With Quote
Old 05-23-2019, 06:40 AM   #13
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,806
Default

@Reflected
This is one of my free scripts, code is already open source for anyone who want to look at it.


Also, there is nothing to correct in my script:





It's a setting issue on your side.
X-Raym is offline   Reply With Quote
Old 05-23-2019, 07:00 AM   #14
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,057
Default

Quote:
Originally Posted by X-Raym View Post
@Reflected
This is one of my free scripts, code is already open source for anyone who want to look at it.


Also, there is nothing to correct in my script:





It's a setting issue on your side.
did you configure it for use with mouse middle click ?

what could be the setting issue on my side ? :?
Reflected is offline   Reply With Quote
Old 05-23-2019, 07:21 AM   #15
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,806
Default

Middle click ! Oops no,
I just tried, and even with a custom action, and indeed in this case,
despite the script internally already save and restore cursor after paste,
despite the fact I wrapped it arround Restore and Save cursor positin action,
it doesnt work.
Middle click seems to always move cursor. And its impssoble to bypass that from the script or from a custom action.


I guess you need another mouse modifier for now.
X-Raym is offline   Reply With Quote
Old 05-23-2019, 10:49 AM   #16
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,057
Default

Quote:
Originally Posted by X-Raym View Post
I guess you need another mouse modifier for now.
which will work?
Reflected is offline   Reply With Quote
Old 05-23-2019, 11:06 AM   #17
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,806
Default

I personally use a keyboard shortcut. It is way more intuitive. You can also consider toolbar button.
X-Raym is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.