Richard Goodman wrote: > > Alain wrote: > > There is a mistake in the Reference Manual it seems. No such > statements as ON TIMER END and ON TIMER OFF. > The correct statements are TIMER END and TIMER OFF. > > ---------------------------------- > > Alain: > > However, When I tried to use TIMER OFF, I got the following error message: > > Error: Variable 'OFF' has not been DIM'ed. > in file Sebastian:HOMMEL SOUND TUTOR.INCL at line 32 in STOPTHEMUSIC > *Timer off* > I think you're right. Not only the Reference manual is wrong but it seems that the statements are not even implemented. I have understood maybe wrongly that your problem revolves around the SndStartFilePlay function. You want to know when a sound has finished to play.Is that right? I'm not sure about this but there is an sync/async parameter in that call, maybe setting this flag to false your program will be locked until that time. Otherwise there is a completion procedure that can be installed, I suppose the proc is called when the sound stops playing. At last, perhaps you should consider installing a Time task as a replacement for the TIMER thingy. Here is an example : Begin Globals Dim gTimeTask As TMTask Dim gDummyCount As Long End Globals '~Functions /* Installs a Time task */ Local Fn InstallTimeTask gTimeTask.tmAddr = Proc "Time Task" #If CarbonLib gTimeTask.tmAddr = ¬ Fn NewTimerUPP([gTimeTask.tmAddr + _FBprocToProcPtrOffset]) #Endif // install the Time task in the queue InsTime( gTimeTask ) End Fn /* Dummy function called every one second */ Local Fn RepeatSomething gDummyCount++ : Print gDummyCount Flushwindowbuffer// for OS X (not tested) End Fn = ( gDummyCount < 11 ) '~Main program // notice no handleevents required Window 1 Fn InstallTimeTask'Install the Time task in the queue PrimeTime( gTimeTask, 1000 )'Start the task // wait until gDummycount equals 10 Do Until gDummyCount = 10 // remove the Time task #If CarbonLib DisposeTimerUPP( gTimeTask.tmAddr ) #Endif RmvTime( gTimeTask ) Print "Click to end" : Flushwindowbuffer Do Until Fn Button End '~Procedure "Time Task" Enterproc Fn TimeTaskProc Long If Fn RepeatSomething PrimeTime( gTimeTask, 1000 )'reschedule the task (in milliseconds) End If Exitproc -- Cheers, Alain