Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

morbus

macrumors newbie
Original poster
Nov 14, 2014
14
0
I use Chrome on my Mac, and sometimes videos don't load - but in Safari they always load.

It would be nice to have a shortcut like this: whenever I double click the address bar in Chrome while holding the apple key, I will send that address to Safari, Safari will load the page in a new tab and I will see the video.

Does applescript have all the right APIs to make such a shortcut? If so, what are the key functions I should research?
 
b) it does not teach me anything new

If this is your goal, why are you here instead of poking through the Safari and Chrome dictionaries in Script Editor? :)

e.g., from the Safari dictionary: "URL (text) : The current URL of the document"

so something like:
Code:
tell application Safari to set MyURL to URL of front document

In order to invoke it from a keyboard shortcut, you may need to make it a service using Automator (which also has a helpful function called "Get Current Web Page from Safari" :)

If you are new to Applescript then I recommend playing around with Automator to get your feet wet.

Some more AppleScript examples:

https://gist.github.com/vitorgalvao/5392178

A.
 
Yep. I agree that a fairly simple AppleScript should be able to do the job for you.

As other posters have commented, if you're looking for a learning experience then have a rummage through the scripting dictionaries of both Chrome and Safari using Script Editor. The info you need is probably in there. If you run into problems, show us your code and we'll help.

Once you have your code sorted out then it's a question of how to trigger it. I'd suggest an Automator based service might be a cool way of doing it. Info on how to do that here:

http://blog.fosketts.net/2010/08/09/assign-keyboard-shortcut-applescript-automator-service/

Good luck, and feel free to ask questions once you've got some of the way!
 
Yep. I agree that a fairly simple AppleScript should be able to do the job for you.

As other posters have commented, if you're looking for a learning experience then have a rummage through the scripting dictionaries of both Chrome and Safari using Script Editor. The info you need is probably in there. If you run into problems, show us your code and we'll help.

Once you have your code sorted out then it's a question of how to trigger it. I'd suggest an Automator based service might be a cool way of doing it. Info on how to do that here:

http://blog.fosketts.net/2010/08/09/assign-keyboard-shortcut-applescript-automator-service/

Good luck, and feel free to ask questions once you've got some of the way!

Great - thanks guys, I've got enough info now to go to work on this. Good to a) know that it possible and not too complex and b) have some resources to start.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.