As mentioned, you'll have to select the project.
Since project is selected I used the normal commands and it works here,..
Code:
function DisarmAllProjects()
for p = 0, 1000 do
local proj = reaper.EnumProjects(p, 0)
if not proj then
break
else
reaper.SelectProjectInstance(proj)
reaper.Main_OnCommand(40491, 0) -- Track: Unarm all tracks for recording
reaper.Main_OnCommand(1007, 0) -- Transport: Play
end
end
end
If you need to restore the originally selected project tab look in ReaPack, theres a few scripts to save and restore selected tab.
EDIT Saving and restoring proj tab seems simple enough,....
Code:
function DisarmAllProjects()
-- save current selected proj tab
local cur_proj = reaper.EnumProjects(-1, 0)
for p = 0, 1000 do
local proj = reaper.EnumProjects(p, 0)
if not proj then
break
else
reaper.SelectProjectInstance(proj)
reaper.Main_OnCommand(40491, 0) -- Track: Unarm all tracks for recording
reaper.Main_OnCommand(1007, 0) -- Transport: Play
end
end
-- restore original selected proj tab
if cur_proj then reaper.SelectProjectInstance(cur_proj) end
end