Add_Menu_Entry Pattern Matrix - How To Read Selected_Track Numbers For

Hi, I was working on a bypass/enabler for all_efx_on_atrack and when got it working (it makes destructive changes to the pattern effect number_strings and amount_strings to effect a max 8 effect bypass and enable…
But then realized that since I put it in the pattern matrix, it would be splendid to be able to read selected amount of tracks from patternmatrix and utilize that to write the bypasses to say every selected track in the pattern_matrix, automatically…

Here’s what I have thus far:

  
renoise.tool():add_menu_entry {  
name = "Pattern Matrix:Bypass EFX",  
invoke = function() effectbypass()   
end  
}  
renoise.tool():add_menu_entry {  
name = "Pattern Matrix:Enable EFX",  
invoke = function() effectenable()   
end   
}  
renoise.tool():add_menu_entry {  
name = "Pattern Matrix:Bypass EFX (Write to Pattern)",  
invoke = function() effectbypasspattern()   
end  
}  
renoise.tool():add_menu_entry {  
name = "Pattern Matrix:Enable EFX (Write to Pattern)",  
invoke = function() effectenablepattern()   
end   
}  
  
function effectbypass()  
local number = (table.count(renoise.song().selected_track.devices))  
 for i=2,number do   
 renoise.song().selected_track.devices[i].is_active=false  
 end  
end  
  
function effectbypasspattern()  
local currTrak = renoise.song().selected_track_index  
local number = (table.count(renoise.song().selected_track.devices))  
local tablee={"1F","2F","3F","4F","5F","6F","7F","8F"}  
 for i=2,number do   
 --renoise.song().selected_track.devices[i].is_active=false  
 renoise.song().selected_track.visible_effect_columns=(table.count(renoise.song().selected_track.devices)-1)  
--This would be (1-8F)  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[1].number_string="1F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[2].number_string="2F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[3].number_string="3F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[4].number_string="4F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[5].number_string="5F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[6].number_string="6F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[7].number_string="7F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[8].number_string="8F"  
--this would be 01 for enabling  
local ooh=(i-1)  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[ooh].amount_string="00"  
 end  
end  
  
function effectenable()  
local number = (table.count(renoise.song().selected_track.devices))  
for i=2,number do   
renoise.song().selected_track.devices[i].is_active=true  
end  
end  
  
  
function effectenablepattern()  
local currTrak = renoise.song().selected_track_index  
local number = (table.count(renoise.song().selected_track.devices))  
for i=2,number do   
--enable all plugins on selected track right now  
--renoise.song().selected_track.devices[i].is_active=true  
--display max visible effects  
local helper=(table.count(renoise.song().selected_track.devices)-1)  
renoise.song().selected_track.visible_effect_columns=helper  
--This would be (1-8F)  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[1].number_string="1F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[2].number_string="2F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[3].number_string="3F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[4].number_string="4F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[5].number_string="5F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[6].number_string="6F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[7].number_string="7F"  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[8].number_string="8F"  
  
--this would be 01 for enabling  
local ooh=(i-1)  
renoise.song().patterns[renoise.song().selected_pattern_index].tracks[currTrak].lines[1].effect_columns[ooh].amount_string="01"  
end  
end  
  
  
  

As far as I know, there is no way to query the Pattern Matrix for selected tracks.

Pattern Matrix, or at least the slots, falls under renoise.PatternSequencer, e.g.

  
oprint(renoise.song().sequencer)  
  

Only thing available in the API, at the time of this writing, is mute slots.