View Single Post
Old 08-13-2019, 06:09 AM   #508
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Hi,

an idea would be to have a dedicated project open in a tab which monitors for active project change in a background script.
Something like this:

Code:
function msg(m)
  reaper.ShowConsoleMsg(tostring(m) .. "\n")
end

lastReaProj = reaper.EnumProjects(-1, "")
function main()
  activeReaProj =  reaper.EnumProjects(-1, "")
  if activeReaProj ~= lastReaProj then
    -- do something...
    msg("project changed!")
  end
  lastReaProj = activeReaProj
  reaper.defer(main)
end

main()


It also triggers when opening a new project in a new tab.
A drawback for live use may be if you (accidently) close the monitoring project you'd loose the trigger of course, hm..
Maybe someone comes up with a more clever idea.

In which language are you doing this by the way?
If in C++ (doing a Reaper extension) we can use callbacks from Reaper which aren't available for scripting.
nofish is offline   Reply With Quote