boiler wrote: ↑07 Apr 2024, 21:54
Try is not a valid part of an expression which you are trying to define as part of a fat arrow function. The syntax for that is
() => expr, where
expr is an expression.
Makes sense. Then, how should I stop playing audio there?
If I move
try SoundPlay('Nonexistent.mp3') outside the arrow function, the interpreter doesn't complain, but the audio keeps playing...
According to the documentation,
To stop a file that is currently playing, use SoundPlay on a nonexistent filename as in this example: try SoundPlay "Nonexistent.avi".
Code: Select all
CreateTimer() {
timeout := InputBox('Set timer interval (in minutes)', 'Timer').Value
if (!IsInteger(timeout))
Exit
SetTimer(() => (
SoundPlay('WakeUp.mp3')
MsgBox('Сработал таймер!', 'Таймер', 'Icon! OK')
), timeout * 60000)
try SoundPlay('Nonexistent.mp3') ; Doesn't complain, but keeps playing
}