Basic Scripting question

DVG
New Contributor III

I'm tinkering and trying to make life easier with scripts. One that would help is the ability to use SHIFT+COMMAND and a keystroke. For my COMMAND only scripts, I'm using something like this:

osascript -e 'tell application "System Events" to key code {13} using command down'

How can I incorporate the SHIFT key into this script?

Thanks--DVG

Dusty VanGilder
1 ACCEPTED SOLUTION

jarednichols
Honored Contributor
osascript -e 'tell application "System Events" to key code {13} using command down, shift down'

This may help you out: http://dougscripts.com/itunes/itinfo/keycodes.php

View solution in original post

5 REPLIES 5

jarednichols
Honored Contributor
osascript -e 'tell application "System Events" to key code {13} using command down, shift down'

This may help you out: http://dougscripts.com/itunes/itinfo/keycodes.php

rockpapergoat
Contributor III

using gui scripting is fragile. avoid.

mm2270
Legendary Contributor III

Yeah, I'd be interested in seeing the larger scale of what you're trying to do with this script. 90% of the time things can be done with bash or perl, etc. Using AS to press keys or click buttons and menus is crude and prone to break.

DVG
New Contributor III

Jared, I had to add curly braces to your code, but it worked. I appreciate it!

I'd love to get more in-depth with Perl/Bash, I just need to sit down with someone for a bit and test a few things out to get it straight in my head, then I can put it to good use.

Thanks for the replies! DVG

Dusty VanGilder

jarednichols
Honored Contributor

If you've got questions on shell scripts (help with syntax and ideas etc) feel free to hit me off-list.