andrewhl Posted September 8, 2015 Share Posted September 8, 2015 Is it possible to open up an application like IA Writer PRO (or Pages) and trigger cmd+n from within that application? Link to comment
rice.shawn Posted September 22, 2015 Share Posted September 22, 2015 (edited) Yes it is. You can just use osascript from the command line: osascript -e "activate application \"Pages\"" -e "delay 1" -e "tell application \"System Events\" to keystroke \"n\" using command down" That script will open Pages, wait one second, and then send the keystrokes. You can change out "Pages" with the other app names, but make sure that you get them perfect because AppleScript is sensitive. You can remove the delay, but then keystrokes might be sent before the application is open. Edited September 22, 2015 by Shawn Rice Link to comment
deanishe Posted September 25, 2015 Share Posted September 25, 2015 (edited) Tidied up a little bit: osascript -e 'activate application "Pages"' -e "delay 1" -e 'tell application "System Events" to keystroke "n" using command down'Also, you might need to increase the delay for the case that Pages isn't running and your computer is as slow as mine. Edited September 25, 2015 by deanishe Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now