this seems to work for a version with user input. i'm pretty sure there must be something screwy with the coding, though, as i have little idea at all what i'm doing. it does seem to work, though:
Code:
-- GET USER INPUT
retval, search = reaper.GetUserInputs("Find and Go", 1, "Search (% for escape char)", "")
if retval then -- if user complete the fields
if search ~= nil and search ~= "" then
reaper.PreventUIRefresh(1)
-----------------------------------------------------------------------------
local function No_Undo()end; local function no_undo()reaper.defer(No_Undo)end
-----------------------------------------------------------------------------
local SelTrack = reaper.GetSelectedTrack( 0, 0 )
if not SelTrack then no_undo() return end
local CountTrItem = reaper.CountTrackMediaItems( SelTrack )
if CountTrItem > 0 then
--local Name = "test"
for i = 1,CountTrItem do
local Tr_item = reaper.GetTrackMediaItem( SelTrack, i-1 )
local Take = reaper.GetActiveTake( Tr_item )
if Take ~= nil then
local Take_Name = reaper.GetTakeName( Take )
if Take_Name == search then
reaper.SelectAllMediaItems( 0, 0 )
reaper.SetMediaItemSelected( Tr_item, 1 )
undo = 1
break
end
end
end
end
if undo == 1 then
reaper.Undo_BeginBlock()
reaper.Undo_EndBlock( [[Select first item from cursor
position in first selected track]],-1)
else
no_undo()
end
--reaper.UpdateArrange()
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange() -- Update the arrangement (often needed)
end
end
the input part is from something by xraym (thankyou very much) and the rest is my modified Archie script.
thanks,
babag