def _itunes_playpause(): cmd = """ tell application "iTunes" playpause end tell """ % locals() utils.execute_as(cmd)
def _open_app(app_name): cmd = """ tell application "%(app_name)s" activate end tell """ % locals() utils.execute_as(cmd)
def _quit_app(app_name): cmd = """ if application "%(app_name)s" is running tell application "%(app_name)s" to quit end if """ % locals() utils.execute_as(cmd)
def _open_url_in_safari(url): width, height = utils.screen_size() cmd = """ tell application "Safari" open location "%(url)s" activate end tell """ % locals() utils.execute_as(cmd)
def _open_dvdplayer(): cmd = """ tell application "DVD Player" activate set viewer full screen to true play dvd end tell """ utils.execute_as(cmd)
def _escape_key(): if not utils.is_running("Safari"): return cmd = """ tell application "Safari" activate tell application "System Events" to key code 53 end tell """ % locals() utils.execute_as(cmd)
def _safari_reload(): if not utils.is_running("Safari"): return cmd = """ tell application "Safari" activate tell application "System Events" to (keystroke "r" using {command down}) end tell """ % locals() utils.execute_as(cmd)