[Solved] Problem to create a function for close empty note_columns

Maybe it has something wrong in this function?

Very quickly looking Raul I would say that there is :slight_smile:

[Edit:] Something a bit more like:

function vslowscanner(song, sti)
  song = renoise.song()
  sti = song.selected_track_index

  for nc = 12, 2, -1 do  
    for ptt = 1, #song.sequencer.pattern_sequence do
      for lns = 1, song.patterns[ptt].number_of_lines do
        if song.patterns[ptt].tracks[sti].lines[lns].note_columns[nc].is_empty == false then         
          song.tracks[sti].visible_note_columns = nc
          return     
        end
      end
    end
  end
  song.tracks[sti].visible_note_columns = 1
end

(going to be awful slow (prepare for the infamous ‘terminate script’ dialog roughly every 10 seconds!))

Just a thought: Didn’t Ledger/Joule have a similar idea here? → https://forum.renoise.com/t/new-tool-2-7-3-1-set-track-width-to-active-columns/31078