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: 3,295
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: 12,107
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: 3,295
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: 4,682
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: 9,900
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: 3,295
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: 3,295
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: 4,682
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: 9,900
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: 12,107
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: 3,295
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: 3,295
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: 9,900
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: 3,295
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: 9,900
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: 3,295
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: 9,900
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
Old 06-07-2020, 05:52 PM   #18
Intek
Human being with feelings
 
Intek's Avatar
 
Join Date: Dec 2015
Location: Russia
Posts: 36
Default

Sadly it dont work for mouse(
__________________
:: iTool ::
Intek is offline   Reply With Quote
Old 12-15-2021, 01:37 PM   #19
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 3,295
Default

no matter what I do, when I assign this script to left click action it moves the edit cursor :/
Reflected is offline   Reply With Quote
Old 12-15-2021, 02:41 PM   #20
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Reflected
Check mouse modifier / Reaper settings. This is issue is not related to this script as it has save and restor edit cur pos internally, so cursor change happen before or after the script run basef on another setting.
X-Raym is offline   Reply With Quote
Old 12-15-2021, 03:06 PM   #21
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 3,295
Default

Quote:
Originally Posted by X-Raym View Post
@Reflected
Check mouse modifier / Reaper settings. This is issue is not related to this script as it has save and restor edit cur pos internally, so cursor change happen before or after the script run basef on another setting.
but if I set the modifier to "no action" it doesn't move the edit cursor


this is my setup, can you check this on your side?


Reflected is offline   Reply With Quote
Old 12-15-2021, 04:50 PM   #22
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Reflected
Map it to an keyboard shortcut and you will see if doesn't move the mouse cursor, revealing it is a user setting or reaper default behavior somewhere else which move the cursor.


To answer your feature request you sent in private forum, and as I don't think it can impact current users of this action, I have updated the script so that it select the new copied items by default.
X-Raym is offline   Reply With Quote
Old 12-17-2021, 03:54 AM   #23
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 3,295
Default

Quote:
Originally Posted by X-Raym View Post
@Reflected
Map it to an keyboard shortcut and you will see if doesn't move the mouse cursor, revealing it is a user setting or reaper default behavior somewhere else which move the cursor.


To answer your feature request you sent in private forum, and as I don't think it can impact current users of this action, I have updated the script so that it select the new copied items by default.
can you check this on your side? (with the mouse modifier)
is this a reaper bug ?
Reflected is offline   Reply With Quote
Old 12-17-2021, 04:18 AM   #24
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 3,295
Default

okayyy I found something...

please tell me you can fix this

it can be an issue within the script itself..

1. I used a shortcut (shift +alt + x)
2. I selected an item
3. keep the shortcut pressed (hold) and move the mouse
4. see the edit cursor does moves and get back

not seeing it all the time because it's probably too fast, but you can see it happens in the gif.

here:
Reflected is offline   Reply With Quote
Old 12-17-2021, 05:01 AM   #25
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Reflected
Internaly, the script move the edit cursor to mouse position, run the paste action, and restore edit cursor position. Restore is built-in inside the script already. That is why I think that if it stays at a different place than before, the cursor may have move either before or after the script run.


A PreventUIRefresh call in the script make cursor moving and view transparent, but according to your screenshots this might a bit of troubles when run several time in very short interval.
Anyway, the important part of your screenshot is that it do end successfully everytime by restoring the initial edit pos.
X-Raym is offline   Reply With Quote
Old 12-17-2021, 05:03 AM   #26
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 3,295
Default

Quote:
Originally Posted by X-Raym View Post
Anyway, the important part of your screenshot is that it do end successfully everytime by restoring the initial edit pos.
can you test it with the mouse modifier on your side to solve this problem?

Track - Alt+ Left mouse click

see if it happens in your side
Reflected is offline   Reply With Quote
Old 12-17-2021, 05:55 AM   #27
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Reflected
It does the same as you noticed,
The Edit cursor position is updated before the script execution,
so it is definitely something which cannot be fixed inside the script cause it happen outside it. 😕
X-Raym is offline   Reply With Quote
Old 12-17-2021, 06:55 AM   #28
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 3,295
Default

I've created a bug report (even though I'm not sure this is a bug), but it make no sense that without a script it doesn't move and with a script it does move...

here
https://forum.cockos.com/showthread.php?t=260808
Reflected 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 02:54 AM.


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