Old 02-28-2015, 06:37 PM   #1
SeanBlake
Human being with feelings
 
Join Date: Feb 2015
Posts: 3
Default How to make mixer window scroll to show selected track?

Hi,

I wrote a simple reascript that selects a track based on it's name. The idea is to have pre-assigned buttons on my controller to jump to certain tracks in order to more easily navigate the project: drum, bass, instrument, verse, hook and bridge.

I threw in RPR_Main_OnCommand(40913, 0) after selecting the track, which scrolls the track window vertically to show the currently selected track. Unfortunately, I can't find an equivalent for the mixer window.

My current workaround is to click on the track after it has been selected. Is there a way to build this into the reascript?

Here's my current script if anyone's interested:
Code:
trackCount = RPR_CountTracks(0)

for i in range(trackCount):
	trackId = RPR_GetTrack(0, i)
	trackName = str(RPR_GetSetMediaTrackInfo_String(trackId, "P_NAME", "", 0)[3])
	
	if "bass" in trackName:
		RPR_SetTrackSelected(trackId, 1)
		
	else:
		RPR_SetTrackSelected(trackId, 0) #if it isn't the track we want, de-select it
		
RPR_Main_OnCommand(40913, 0) #scroll track window vertically to show selected track
Thanks

Last edited by SeanBlake; 02-28-2015 at 06:43 PM. Reason: fixed a bug in the script
SeanBlake is offline   Reply With Quote
Old 02-28-2015, 07:11 PM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Hi,

can't help with scripting, but I thought maybe it's just a matter of activating this:



This menue comes up when clicking here:



At last the mixer tracks do scroll into view here when selected from the track window with this option activated.
nofish is offline   Reply With Quote
Old 02-28-2015, 08:56 PM   #3
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 10,272
Default

wow your first post is a script?? took me 5 years to grow the balls to try scripting. of course it wasn't nearly as scary as i though, but still...
__________________
foxyyymusic
foxAsteria is offline   Reply With Quote
Old 03-01-2015, 02:37 PM   #4
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

This works for me. I made max left/right versions for another user and he said there was a problem that didn't occur on my computer/monitors setup. IDK. It's eel.

Code:
//mixer scroll first selected

ct = CountTracks(0);
i = 0;
while(i < ct)(
  trk = GetTrack(0, i);
  IsTrackSelected(trk) ? (
    IsTrackVisible(trk, 1) ? (
      SetMixerScroll(trk);
      i = ct;
    );
  );
  i += 1;
);

Undo_OnStateChange("mixer scroll first selected");
FnA is offline   Reply With Quote
Old 03-02-2015, 07:57 PM   #5
SeanBlake
Human being with feelings
 
Join Date: Feb 2015
Posts: 3
Default

nofish: Thanks! That was the first thing I checked but it was already enabled.

PooFox: Yup! Scripting is a big part of what drew me to Reaper in the first place.

FnA: That script is awesome. It works like a charm.

Now I have a new problem. I can't call reascript commands from inside my script. I can call any other command in Reaper including my C++ extension's command but anything Reascript is a no-go.

As a workaround, I made a macro that executes my script, then FnA's. Good enough for my purposes.

Solved! Thanks
SeanBlake is offline   Reply With Quote
Old 03-03-2015, 01:59 PM   #6
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

I think that might be just python and eel mixtures. Maybe.
FnA is offline   Reply With Quote
Old 04-24-2015, 05:28 PM   #7
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default

Quote:
Originally Posted by FnA View Post
I think that might be just python and eel mixtures. Maybe.
Yes, the two can't interbreed.
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 04-24-2015, 06:08 PM   #8
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

:/



lol
FnA is offline   Reply With Quote
Old 04-16-2018, 03:32 AM   #9
Vampire TNA
Human being with feelings
 
Join Date: Nov 2009
Posts: 28
Default

Hi guys!
Any idea why both scripts don't work for me?

For SeanBlake's script i get:
Find Sends.lua:4: function arguments expected near '='

For FnA's script i get:
mixer scroll first selected.lua:4: ')' expected (to close '(' at line 3) near '='

Thanks in advance for any replies
Vampire TNA is offline   Reply With Quote
Old 04-16-2018, 05:19 AM   #10
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

SeanBlake's script is in the Python language. First you would need Python installed. You would save as:
ScriptName.py

Mine is in Eel. Does not require any install. Reaper is ready to use it. You would save it as:
ScriptName.eel

I would write it like this nowadays:

Code:
//mixer scroll first selected.eel

cst = CountSelectedTracks(0);
i = 0;
while(i < cst)(
  trk = GetSelectedTrack(0, i);
  IsTrackVisible(trk, 1) ? (
    SetMixerScroll(trk);
    i = cst;
  );
  i += 1;
);

function noundo() (abs(0));
defer("noundo()");
FnA is offline   Reply With Quote
Old 04-16-2018, 06:02 AM   #11
Vampire TNA
Human being with feelings
 
Join Date: Nov 2009
Posts: 28
Default

Thanks for the reply FnA!
I managed to run those at last...
Vampire TNA is offline   Reply With Quote
Old 10-23-2018, 03:24 PM   #12
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,185
Default

Quote:
Originally Posted by FnA View Post
I would write it like this nowadays:
Is it also possible to make the selected track scroll to the center of the mixer view (rather than the left or right edge) ?
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 10-25-2018, 02:37 PM   #13
FnA
Human being with feelings
 
FnA's Avatar
 
Join Date: Jun 2012
Posts: 2,173
Default

As far as I know, there is
GetMixerScroll, which can tell you the leftmost track,
and
SetMixerScroll, which takes a track as an argument and tries to put that in the leftmost position.

Those are the only two dedicated functions as far as I know. There has been some recent development of new window handling functions by juliansader that may have some ability in the way you mention, but I personally don’t have them mastered to the extent to know that for sure.
FnA is offline   Reply With Quote
Old 10-26-2018, 02:24 AM   #14
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,185
Default

Ok thank you.
I guess I was hoping there was a way of adding a number to the code to modify "left" to "middle" (trying to sound like i vaguely know how to code). Normally there's another unselected track near the selected one that gets put just out of view if it's on the left.
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 10-26-2018, 05:46 AM   #15
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Quote:
Originally Posted by FnA View Post
There has been some recent development of new window handling functions by juliansader that may have some ability in the way you mention, but I personally don’t have them mastered to the extent to know that for sure.
Yes, there are, I toyed around with them successfully, and if I remember, it's the functions JS_Window_GetScrollInfo and JS_Window_SetScrollPos.

See in this thread for the extension: https://forum.cockos.com/showthread.php?t=212174
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 10-25-2019, 06:21 PM   #16
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by Triode View Post
Is it also possible to make the selected track scroll to the center of the mixer view (rather than the left or right edge) ?
Mine is still showing selected track at right.
Is it possible to make it center now ?
todoublez is offline   Reply With Quote
Old 11-02-2019, 07:11 AM   #17
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default

Yes, it would be wonderful to have a set of scripts for:

Scroll mixer to first selected track, left aligned
Scroll mixer to first selected track, centre aligned
Scroll mixer to first selected track, right aligned

The centre aligned version (and maybe right aligned?) would require the user to write the 'width' of their mixer into the script. For example, with my default layout on my secondary monitor, I have 24 tracks visible. The script would then be able to calculate that the track minus 12 (half of total tracks visible) should be the left-most track displayed in the mixer.
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 11-18-2019, 05:28 PM   #18
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 855
Default

Quote:
Originally Posted by daxliniere View Post
Yes, it would be wonderful to have a set of scripts for:

Scroll mixer to first selected track, left aligned
Scroll mixer to first selected track, centre aligned
Scroll mixer to first selected track, right aligned

The centre aligned version (and maybe right aligned?) would require the user to write the 'width' of their mixer into the script. For example, with my default layout on my secondary monitor, I have 24 tracks visible. The script would then be able to calculate that the track minus 12 (half of total tracks visible) should be the left-most track displayed in the mixer.
+1 on this. Would be nice. Although it would still be nice to have it as a preferences option too, so that whenever the mixer auto-scrolls to a selected track it always places it in the centre. Perhaps a constantly running script could 'intercept' this function and correct the track position in the mixer whenever it auto-scrolls - I don't know.
Joe90 is offline   Reply With Quote
Old 01-25-2020, 05:54 PM   #19
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default

Quote:
Originally Posted by daxliniere View Post
Yes, it would be wonderful to have a set of scripts for:

Scroll mixer to first selected track, left aligned
Scroll mixer to first selected track, centre aligned
Scroll mixer to first selected track, right aligned

The centre aligned version (and maybe right aligned?) would require the user to write the 'width' of their mixer into the script. For example, with my default layout on my secondary monitor, I have 24 tracks visible. The script would then be able to calculate that the track minus 12 (half of total tracks visible) should be the left-most track displayed in the mixer.
Bump?
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 01-27-2020, 12:54 PM   #20
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,185
Default

Hey Dax, I switch the window set to get to the mixer (on the same monitor)

I have this switching via a cycle action that includes "SWS save current track selection" and then four "go to next track" commands followed by"restore saved track selection" in the same macro. This puts selected tracks in the last third to the right on the mixer if there are enough tracks to fill the screen. It's a kludge but it works

I did this as I was finding that if I have a number of tracks selected only the first selected track was visible on the switch to mixer with the usual "scroll to view when tracks activated" set to on.
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 01-27-2020, 02:46 PM   #21
daxliniere
Human being with feelings
 
daxliniere's Avatar
 
Join Date: Nov 2008
Location: London, UK
Posts: 2,583
Default

Hey Triode! Thanks for the suggestion. As you mentioned, it's a kludge, but I guess it'll do the trick until we manage to get this to work. (I still don't understand what's so hard about it. I mean, hell, we've got scripts that directly edit WAV files and others that generate complex GUIs, but scroll to selected track?? It's kinda funny. )
__________________
Puzzle Factory Sound Studios, London [Website] [Instagram]
[AMD 5800X, 32Gb RAM, Win10x64, NVidia GTX1080ti, UAD2-OCTO, FireFaceUCX, REAPER x64]
[Feature request: More details in Undo History]
daxliniere is offline   Reply With Quote
Old 01-27-2020, 08:00 PM   #22
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,185
Default

Yeah I managed to write a script the other day using JulianSader's API that scrolls the arrange to selected track when you fit tracks vertically (only if they don't all fit in)

With the mixer there is no native command that scrolls by a track's width so even if it's possible to measure the mixer window in pixels with the API that's still only halfway there and the actual scroll would need doing by the script too. Who knows - maybe it's possible!
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 01-28-2020, 03:23 AM   #23
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by Edgemeal View Post
You can get window/client sizes with Julian's extension, GetRect , GetClientRect.

Was just playing around, really have no use for anything like this, but maybe it'll give ya some ideas, or what not to do!

Code:
-- Center selected track in Mixer
-- Requires: REAPER v6.x, js_ReaScriptAPI and Multiple rows disabled in Mixer.

function Main()
  local sel_track = reaper.GetSelectedTrack(0,0)
  if sel_track ~= nil then
    local track_number = reaper.CSurf_TrackToID(sel_track, true)
    local mixer = reaper.JS_Window_Find("Mixer", true)
    if mixer then
      local retval, list = reaper.JS_Window_ListAllChild(mixer)
      for adr in list:gmatch("[^,]+") do -- get child with no title (not 'master').
        local hwnd = reaper.JS_Window_HandleFromAddress(adr)
        if reaper.JS_Window_GetTitle(hwnd) == '' then container = hwnd break end
      end
      if container then
        local track_width = reaper.GetMediaTrackInfo_Value(sel_track, 'I_MCPW')
        local _,left,_,right,_ = reaper.JS_Window_GetClientRect(container)
        local mixer_width = (right-left)
        local _, pos = reaper.JS_Window_GetScrollInfo(container, "SB_HORZ")
        local hVal = (track_width * (track_number-1)) - (mixer_width / 2)
        if pos < hVal then newpos = pos + (hVal - pos) else newpos = pos - (pos - hVal) end
        if newpos < 0 then newpos = 0 end
        reaper.JS_Window_SetScrollPos(container, "SB_HORZ", math.floor(newpos))
      end
    end
  end
end

Main()
reaper.defer(function () end)

Just tried the code on my Mac,
it didnt work :/
but it makes selected track from right to left.
todoublez is offline   Reply With Quote
Old 01-28-2020, 03:30 AM   #24
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,185
Default

Thanks very much for this, Edge
I tried it and I’m also on Mac (High Sierra) and it worked for me.
Toduublez, you need the JS API installed via reapack. Have you got that?
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 01-28-2020, 05:08 AM   #25
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 855
Default

Working for me too, Edgemeal to the rescue once again... thanks!

Anyway know of a convenient way to make this centering function intercept the normal mixer scroll to selected track, so that this script forces the mixer to ALWAYS center on the selected track automatically?
Joe90 is offline   Reply With Quote
Old 01-28-2020, 05:14 AM   #26
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,185
Default

Quote:
Originally Posted by Joe90 View Post
Working for me too, Edgemeal to the rescue once again... thanks!

Anyway know of a convenient way to make this centering function intercept the normal mixer scroll to selected track, so that this script forces the mixer to ALWAYS center on the selected track automatically?
How do you normally switch to the mixer view? Have you tried putting it in a macro along with that?
Or a toggle macro via the cycle editor?
(I think it already overrides the normal mixer scroll)
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 01-28-2020, 05:16 AM   #27
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 855
Default

Quote:
Originally Posted by Triode View Post
How do you normally switch to the mixer view? Have you tried putting it in a macro along with that?
Or a toggle macro via the cycle editor?
(I think it already overrides the normal mixer scroll)
I have the mixer permanently open in a second monitor, so I guess I would need a script that is running constantly, and intercepts mixer scrolling whenever I select a track.
Joe90 is offline   Reply With Quote
Old 01-28-2020, 05:22 AM   #28
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,185
Default

Quote:
Originally Posted by Joe90 View Post
I have the mixer permanently open in a second monitor, so I guess I would need a script that is running constantly, and intercepts mixer scrolling whenever I select a track.
I see.
Another option would be add it to whatever you have the mouse modifier set to for "track" single click. Then when you click a blank space on a track in the arrange window you could trigger it that way.
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 01-28-2020, 05:42 AM   #29
Joe90
Human being with feelings
 
Join Date: Aug 2019
Posts: 855
Default

Quote:
Originally Posted by Triode View Post
I see.
Another option would be add it to whatever you have the mouse modifier set to for "track" single click. Then when you click a blank space on a track in the arrange window you could trigger it that way.
That would work... smart idea. I guess I could also attach it to my up/down arrows, which I use to select next/previous track. It would be still be nice if there were a way to intercept the normal mixer scrolling to selected track though, and just make it center the track instead.

The problem is, if it's sometimes appearing centered and sometimes not (like when I just select the TCP) then it's probably only going to add to the confusion, and the whole point of this centering function (For me at least) was to make sure the selected track always falls in the same place on the mixer, so your eye is not always searching at opposite ends checking where it is.

Having said all that, my most common method of track selection is by either selecting an item (I have lokasenna's 'track selection follows item selection' running all the time) or by ctrl-clicking on the empty track space. Both of these actions I can attach the script to, so your suggestion is still very helpful. Thanks.
Joe90 is offline   Reply With Quote
Old 01-28-2020, 10:06 AM   #30
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by Triode View Post
Thanks very much for this, Edge
I tried it and I’m also on Mac (High Sierra) and it worked for me.
Toduublez, you need the JS API installed via reapack. Have you got that?
Yes, my Js API version is v0.998
Assigned the script to a hot key: cmd opt ctrl + x
I select a track from TCP 1st
Then I call out the MCP
It’s at right edge of the MCP which is normal by default.
And then I activate the script via hot key I assigned.
It didn’t make the selected track scroll to center,
But it scroll the track to the left edge of the MCP.

And then the script seemed start working in background,
Whenever I select a track in MCP , it scrolls to the left automatically.
Is it normal ? I think I missed something here :/
todoublez is offline   Reply With Quote
Old 01-28-2020, 12:55 PM   #31
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

This seems to work too:

(Note: better window detection and error handling code should be added)
Code:
function scroll_to_track(track_id, relative_x_pos)
  relative_x_pos = relative_x_pos or 0 -- 0=left, 0.5=center, 1=right etc.
  if not reaper.IsTrackVisible(track_id, true) then
    return
  end
  local mcp_x = reaper.GetMediaTrackInfo_Value(track_id, "I_MCPX")
  local mcp_w = reaper.GetMediaTrackInfo_Value(track_id, "I_MCPW")
  local mixer_id, is_docked = reaper.BR_Win32_GetMixerHwnd()
  local mcp_id = reaper.JS_Window_FindChild(mixer_id, "", true)
  local ok, pos, page, min, max, trackPos = reaper.JS_Window_GetScrollInfo(mcp_id, "h")
  if ok then
    ok = reaper.JS_Window_SetScrollPos(mcp_id, "h", mcp_x + pos - math.floor(relative_x_pos*(page-mcp_w) + 0.5))
  end
end


local tr = reaper.GetSelectedTrack(0, 0)
if tr then
  scroll_to_track(tr, 1) -- 0=left, 0.5=center, 1=right etc.
end
spk77 is offline   Reply With Quote
Old 01-28-2020, 01:18 PM   #32
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by spk77 View Post
This seems to work too:
Awesome! Only tried center but seems to work perfect!
I delete my crappy code!
Edgemeal is offline   Reply With Quote
Old 01-28-2020, 01:18 PM   #33
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,185
Default

Don't forget often there are a number of tracks selected and to get them all in the centre I added a small change to Edgemeaal's code shown below.
Edge, your first script got a perfectly centred result for me. The second version is off centre by one extra track on the right here.

Thanks again everyone for looking in to this

Code:
-- Center selected track in Mixer
-- Requires: REAPER v6.x, js_ReaScriptAPI, Multiple rows disabled in Mixer.

function Main()

local NumberOfTracks = reaper.CountSelectedTracks(0) / 2 -- gets added later

  local sel_track = reaper.GetSelectedTrack(0,0)
  if sel_track == nil then return end
  if not reaper.IsTrackVisible(sel_track, true) then return end
  local mixer = reaper.JS_Window_Find("Mixer", true)
  if not mixer then return end
  local retval, list = reaper.JS_Window_ListAllChild(mixer)
  for adr in list:gmatch("[^,]+") do -- get child with horiz scrollbar.
    local hwnd = reaper.JS_Window_HandleFromAddress(adr)
    local retval = reaper.JS_Window_GetScrollInfo(hwnd, "SB_HORZ") 
    if retval then container = hwnd break end
  end
  if container then
    local _,left,_,right,_ = reaper.JS_Window_GetClientRect(container)
    local mixer_width = (right-left) 
    local track_width = reaper.GetMediaTrackInfo_Value(sel_track, 'I_MCPW')
    local track_number = reaper.CSurf_TrackToID(sel_track, true)
    local _, pos = reaper.JS_Window_GetScrollInfo(container, "SB_HORZ")
    local hVal = (track_width * (track_number+NumberOfTracks-1)) - (mixer_width / 2 - (track_width / 2))
    if pos < hVal then newpos = pos + (hVal - pos) else newpos = pos - (pos - hVal) end
    if newpos < 0 then newpos = 0 end
    reaper.JS_Window_SetScrollPos(container, "SB_HORZ", math.floor(newpos))
  end
end

Main()
reaper.defer(function () end)
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 01-28-2020, 01:23 PM   #34
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by Triode View Post
Edge, your first script got a perfectly centred result for me. The second version is off centre by one extra track on the right here.
I think spk77 has it covered , bowing out, have fun!
Edgemeal is offline   Reply With Quote
Old 01-28-2020, 09:35 PM   #35
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by spk77 View Post
Hi SPK77,
this code wrks perfect for me
to me ,0.6 is center in my case, maybe it's becuz I don't show Master track in MCP.
thank u very much !!!

I just noticed that the position parameter 0,0.5,1 if u want to make it center (0.5)
it might need to be adjust to 0.6 or 0.7 to make it center.
it depends on what theme u use.
I'm using Albert-C's protoolsX on my mac, it needs to be configure to 0.6 to make it perfect center which is at the bottom of the code here.

Code:
local tr = reaper.GetSelectedTrack(0, 0)
if tr then
  scroll_to_track(tr, 0.6) -- 0=left, 0.5=center, 1=right etc.
end

Last edited by todoublez; 02-02-2020 at 01:36 AM.
todoublez is offline   Reply With Quote
Old 03-08-2020, 08:38 PM   #36
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 376
Default

Hey everyone--I'm new to scripts. Can anyone tell me where I import this script into Reaper? I'm not sure how to do that yet.
Miscreant is offline   Reply With Quote
Old 02-06-2021, 09:24 PM   #37
Sound asleep
Human being with feelings
 
Sound asleep's Avatar
 
Join Date: Nov 2009
Location: Montreal, Canada
Posts: 9,073
Default

Quote:
Originally Posted by FnA View Post
SeanBlake's script is in the Python language. First you would need Python installed. You would save as:
ScriptName.py

Mine is in Eel. Does not require any install. Reaper is ready to use it. You would save it as:
ScriptName.eel

I would write it like this nowadays:

Code:
//mixer scroll first selected.eel

cst = CountSelectedTracks(0);
i = 0;
while(i < cst)(
  trk = GetSelectedTrack(0, i);
  IsTrackVisible(trk, 1) ? (
    SetMixerScroll(trk);
    i = cst;
  );
  i += 1;
);

function noundo() (abs(0));
defer("noundo()");
Thank you, this was useful to me for my inspector setup.
__________________
Slava Ukraini
Sound asleep 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:16 PM.


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