James,
Hmm, I thought I'd read you'd been advised to test if the screen was
locked, and you reported that it wasn't. Must have misread that.
Mark brings up a very good point. In your case, if it just so happened that
the were a couple of incremented lock screen, let's say 3, then a single
unlock screen would not have resolved your problem. A test of 'if the
lockscreen is true then beep' would have immediately led you in the right
direction.
For my own stacks, which typically don't need incremented lock screens, but
I lock the screen regularly, I use the simple:
if (lockscreen = false) then
lock screen
end if