local interface = "INTERFACE NAME"
reaper.Main_OnCommand(1016, 0) -- Transport: Stop
reaper.Main_OnCommand(40099, 0) -- Open audio device preferences
local window = reaper.JS_Window_Find("REAPER Preferences", true)

if window ~= nil then
  local arr = reaper.new_array({}, 255)
  local count = reaper.JS_Window_ArrayAllChild(window, arr)
  local adr = arr.table()

  for j = 1, #adr do
    local hwnd = reaper.JS_Window_HandleFromAddress(adr[j])
    local title = reaper.JS_Window_GetTitle(hwnd)
    local id = reaper.JS_Window_GetLong(hwnd, "ID")
    if id == 1044 then -- Allow use of different input and output
      reaper.JS_WindowMessage_Send(hwnd, "BM_SETCHECK", 0, 0, 0, 0)
    end
  end
  
  for j = 1, #adr do
    local hwnd = reaper.JS_Window_HandleFromAddress(adr[j])
    local title = reaper.JS_Window_GetTitle(hwnd)
    local id = reaper.JS_Window_GetLong(hwnd, "ID")
    if id == 1000 then
      reaper.JS_Window_SetTitle(hwnd, interface)
    end
  end
  
  reaper.JS_WindowMessage_Send(window, "WM_COMMAND", 1144, 0, 0, 0) -- Apply
  reaper.JS_Window_Destroy(window) -- Close window
 end