I am having a heck of a time updating the currently playing record with field updates that I want to make during playback. If I put the functions in the section if( IsPlaying(), expression goes here, ) they constantly calculate based upon (1) some scanning cycle (2) changes made to the queue during playback. I do not know how to get them to calculate only once.
If I put the functions in the If( IsPlaying(), , expression goes here ) then only the first variable I update gets updated and all the other fields end up in the next playing song.
I need to somehow either (1) stop the constant recalculation or (2) halt the execution until all the expressions have executed (something like a return code if( IsEqual( ReturnCode(), 1) then continue to the next song, else wait for the return code to change )
After playback expression doesn't seem to work either as the functions can't complete executing before the next song starts playing.
Help, thoughts, anything? Here is my code. I've verified that the calculations work. Just that they never end up in the right fields.
If( And( IsPlaying(), IsEqual( [GVWorkCounter], 0, 2) ),
>>>>
/# Save( Math( [GVWorkCounter] + 1 ), GVWorkCounter ) #/
Save( 1, GVWorkCounter )
SetField( WorkString, CTR: [GVWorkCounter] )
Save( [FileName], GVFileName )
Save( FormatDate( Now(), Date), GVNow )
/# SetField( WorkString, Load( GVNow ) ) #/
If( IsEmpty( [WorkList1x] ), Save( NO, GVWorkList2x ), Save( [WorkList1x] , GVWorkList2x ) )
/# SetField( WorkString, Load( GVNow) - Load( GVWorkList2x ) ) #/
If( IsEmpty( [SmartList] ), Save( NO, GVWorkList1x ), Save( [SmartList] , GVWorkList1x ) )
/# SetField( WorkString, Load( GVNow) - Load( GVWorkList2x ) - Load( GVWorkList1x ) ) #/
If( IsEmpty( [Last Played] ), Save( NO, GVLastPlayed ), Save( FormatDate( [Last Played,0], dd MM yyyy ), GVLastPlayed ) )
/# SetField( WorkString, Load( GVNow) - Load( GVWorkList2x ) - Load( GVWorkList1x ) - Load( GVLastPlayed) ) #/
If( IsEmpty( [WorkDate1x] ), Save( NO, GVWorkDate2x ), Save( FormatDate( ConvertDate( [WorkDate1x] ), dd MM yyyy ), GVWorkDate2x ) )
/# SetField( WorkString, Load( GVNow) - Load( GVWorkList2x ) - Load( GVWorkList1x ) - Load( GVLastPlayed ) - Load( GVWorkDate2x ) ) #/
If( IsEmpty( [Last Played] ), Save( NO, GVWorkDate1x ), Save( FormatDate( [Last Played,0], dd MM yyyy ), GVWorkDate1x ) )
/# SetField( WorkString, Load( GVNow) - Load( GVWorkList2x ) - Load( GVWorkList1x ) - Load( GVLastPlayed ) - Load( GVWorkDate2x ) - Load( GVWorkDate1x ) ) #/
/# Hold everything from here on #/
/# If( IsEmpty( [GVWorkList2x] ), SetField( WorkList2x, No ), SetField( WorkList2x, Load( GVWorkList2x ) ) ) #/
/# SetField( WorkString, Now: Load( GVNow) LP: Load( GVLastPlayed ) GVWD1: Load( GVWorkDate1x ) GVWD2: Load( GVWorkDate2x ) GVWL2: Load( GVWorkList2x ) WL2: [WorkList2x] GVWL1: Load( GVWorkList1x ) ) #/
/# If( IsEmpty( [SmartList] ), SetField( WorkList1x, NoWL1x ), SetField( WorkList1x, [SmartList] ) ) #/
/# SetField( WorkString, Now: Load( GVNow) LP: Load( GVLastPlayed ) GVWD1: Load( GVWorkDate1x ) GVWD2: Load( GVWorkDate2x ) GVWL2: Load( GVWorkList2x ) WL2: [WorkList2x] GVWL1: Load( GVWorkList1x ) WL1: [WorkList1x] ) #/
/# If( IsEmpty( [GVWorkDate2x] ), SetField( WorkDate2x, NoWD2x ), SetField( WorkDate2x, FormatDate( ConvertDate( Load( GVWorkDate2x) ), MM//dd//yyyy ) ) ) #/
/# SetField( WorkString, Now: Load( GVNow) LP: Load( GVLastPlayed ) GVWD1: Load( GVWorkDate1x ) GVWD2: Load( GVWorkDate2x ) WD2: [WorkDate2x] GVWL2: Load( GVWorkList2x ) WL2: [WorkList2x] GVWL1: Load( GVWorkList1x ) WL1: [WorkList1x] ) #/
/# If( IsEmpty( [Last Played] ), SetField( WorkDate1x, NoWD1x ), SetField( WorkDate1x, FormatDate( [Last Played,0] , MM//dd//yyyy ) ) ) #/
/# SetField( WorkString, Now: Load( GVNow) LP: Load( GVLastPlayed ) GVWD1: Load( GVWorkDate1x ) WD1: [WorkDate1x] GVWD2: Load( GVWorkDate2x ) WD2: [WorkDate2x] GVWL2: Load( GVWorkList2x ) WL2: [WorkList2x] GVWL1: Load( GVWorkList1x ) WL1: [WorkList1x] ) #/
/# If( Or( And( IsEmpty( [WorkDate1x] ), IsEmpty( [Last Played] ) ), IsEmpty( [WorkDate1x] ) ),
Save( , GVWorkDays1x ),
Save( FormatNumber( Extract(2, CompareDates( ConvertDate( [WorkDate1x] ), Now(), d ), days), 0 ), GVWorkDays1x ) ) #/
/# SetField( WorkString, Now: Load( GVNow) LP: Load( GVLastPlayed ) Days: Load( GVWorkDays ) GVWD1: Load( GVWorkDate1x ) WD1: [WorkDate1x] GVWD2: Load( GVWorkDate2x ) WD2: [WorkDate2x] GVWL2: Load( GVWorkList2x ) WL2: [WorkList2x] GVWL1: Load( GVWorkList1x ) WL1: [WorkList1x] ) #/
/# If( Or( And( IsEmpty( [WorkDate2x] ), IsEmpty( [WorkDate1x] )), IsEmpty( [WorkDate2x] ) ),
Save( ,GVWorkDays2x ),
Save( formatnumber(Extract(2, CompareDates( ConvertDate( [WorkDate2x] ), ConvertDate( [WorkDate1x] ), d), days ), 0 ), GVWorkDays2x ) ) #/
/# SetField( WorkString, Now: Load( GVNow) LP: Load( GVLastPlayed ) Day1: Load( GVWorkDays ) GVWD1: Load( GVWorkDate1x ) WD1: [WorkDate1x] Day2: Load( GVWorkDays2x ) GVWD2: Load( GVWorkDate2x ) WD2: [WorkDate2x] GVWL2: Load( GVWorkList2x ) WL2: [WorkList2x] GVWL1: Load( GVWorkList1x ) WL1: [WorkList1x] ) #/
/# SetField( WorkDays1x, Load( GVWorkDays1x ) ) #/
/# SetField( WorkDays2x, Load( GVWorkDays2x ) ) #/
/# SetField( WorkString, Now: Load( GVNow) LP: FormatDate( ConvertDate( Load( GVLastPlayed ) ) MM//dd//yyyy ) GDays1: Load( GVWorkDays ) GVWD1: FormatDate( ConvertDate( Load( GVWorkDate1x ) ) MM//dd//yyyy ) WD1: FormatDate( ConvertDate( [WorkDate1x] ) MM//dd//yyyy ) GDays2: Load( GVWorkDays2x ) GVWD2: FormatDate( ConvertDate( Load( GVWorkDate2x ) ) MM//dd//yyyy ) WD2: FormatDate( ConvertDate( [WorkDate2x] ) MM//dd//yyyy ) GVWL2: Load( GVWorkList2x ) WL2: [WorkList2x] GVWL1: Load( GVWorkList1x ) WL1: [WorkList1x] ) #/
,
If( Not(IsPlaying()),
FormatDate( Now(), hh:mm:ss )
SetField( WorkString, CTR: Load( GVWorkCounter ) )
Save( 0, GVWorkCounter )
SetField( WorkString, Ctr: [GVWorkCounter] )
If( IsEmpty( [SmartList] ), SetField( WorkList1x, NoWL1x ), SetField( WorkList1x, [SmartList] ) )
If( IsEmpty( [GVWorkList2x] ), SetField( WorkList2x, No ), SetField( WorkList2x, Load( GVWorkList2x ) ) ), )
)