I have a routine runned in idle mode
With period of 1 min it checks if frontmost application name changed and if so, it remembers this name and do some work and and all the process repeated.
property PrevAppName: {""}
on idle
if name of CurrApp ≠item 1 of PrevAppName
....
set PrevAppName to {name of CurrApp}
end if
end idle
The problem is each time idle loop performed, value stored in first line {PrevAppName} is rewritten – however it is outside of on idle bounds.
How to fix it?