I’ve hated the fact that I have to use the alt key to cmd+tab to hidden windows ever since I switched to MAC.
I know there are apps ( like witch ) that replace the cmd+tab function but I like the current interface I don’t want to change that. besides that I just want to build the apple script for it 🙂
So here is what I want to create:
when I press cmd+tap -> keydown alt
Then when I then release cmd it should release the alt key.
The result would be I never have to press the alt key again when switching to ‘hidden’ windows. Much like other OS systems.
But it looks to me like all apple scripts start with tell application
It isn’t posible to detect key presses by the user in applescript. You can press keys programmatically though. To solve your problem of holding down a key use the “key down” command and issue the “key up” command when you need to release it. That will work in any application. Here’s an example.
NOTE: you could also use the “keystroke” command if you wanted to sequentially press and release some keys. For example to press command-s you could do the following: