View Single Post
Old 12-17-2019, 12:34 PM   #3
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

reaper.BR_GetCurrentTheme still not working (SWS v2.11.0.0 pre-release 2019-12-07).

Do you guys just read the REAPER.INI (lastthemefn5=) to get this info?

EDIT Never mind, reading the ini did the trick, reason I needed it was so when I start REAPER the theme is set depending on time of day it is, used in my "__startup.lua" on Win10, ...

Code:
function GetFilename(filepath)
  local lastpos = (filepath:reverse()):find('\\')
  return (filepath:sub(-lastpos+1))
end

-- Set theme depending on hour of the day.
function SetTheme() 
  local fn = reaper.GetResourcePath()
  local _, curTheme = reaper.BR_Win32_GetPrivateProfileString('REAPER', 'lastthemefn5', '', fn .. '/REAPER.ini')
  
  local tm = (os.time())
  if tonumber(os.date("%H", tm)) < 17 then  -- Before 5pm use light theme
    fn = fn .."\\ColorThemes\\Eds_5.01_AGYR.ReaperThemeZip"
  else  -- after 5pm use dark theme
    fn = fn .."\\ColorThemes\\Eds_6.0.ReaperThemeZip" 
  end  
  -- load theme if not the current theme
  if GetFilename(curTheme) ~= GetFilename(fn) then
    reaper.OpenColorThemeFile(fn)
  end
end

Last edited by Edgemeal; 12-17-2019 at 01:14 PM.
Edgemeal is offline   Reply With Quote