But I get an error like this:
execution error: Can’t get application "System Events" whose frontmost of it = true. Access not allowed. (-1723)
where I'm making mistake?