dimanche 25 janvier 2015

Customize Dictation to run AppleScript for Specific Monitor


I've enabled Dictation for command prompts via voice [got it from the OS shipped Chess application in Lion]. Decided to give it a go System Wide now in 2015 running Yosemite. I fancy it so far, certainly looks better and performs better as opposed to Lion (which should be the case) There are a few customizable options when you 'Enable Advanced Commands' like open file, run workflow, open application, paste text, paste data, & keyboard shortcut.


However, call me lazy but it's still something that matters to me, I frequent Netflix & Hulu and other websites at minimum 4 times a day. I would like to add a functional command that will automatically open a webpage correlating to that command. since open file is different than run file, i'm trying to autonomously open Safari + the name of the website in URL form with dictation? The good thing about this is it automatically makes whatever application you reference the front-most window. So coding should be minimal, and I really don't want to create a service for this [my services are growing, currently at +55 in total].


I am an Automator aficionado however, and well versed with it so I'm using the Dictation Command tool, but what i am not, is an AppleScript scholar. After reading through the applescript library for about 60 minutes i finally figured out how to open a new window of Safari, activate the application in case it was not open and launch the url:



tell application "Safari" to activate
tell application "Safari"
make new document with properties {URL:"http://netflix.com"}
end tell


Additionally, I have 3 monitors. I always have movies, tv etc played on Number 2! I tried putting Safari in the monitor 2 screen with applescript but don't even know how to go about it and am too embarrassed to share my code, it's sloppy. Can anyone lead me in the right direction? Or does anyone know a more simplified way around all of this? I really want this to work. I am in the military so our rooms aren't that big so my 2nd monitor (27") is my tv, so I have created an iPhone app for my needs only that strictly simulates the double fn press needed to activate Dictation so I can watch tv from my bed [don't have apple tv].





Aucun commentaire:

Enregistrer un commentaire