automator safari to chrome

I find that Flash degrades my Safari experience, so I have it disabled. However, several sites (e.g. NPR or even NYT) use Flash to display content. Since Chrome enables Flash by default and doesn't use the standard plugins, it's easier to listen or view Flash in Chrome. So I usually copy the URL and display it in Chrome. But it takes several steps, all which can be automated.

One would think Automator was a simple Macro program, but, even when using "get Safari current page" and passing it to Chrome, the script always fails. I've used the built-in steps for Safari and the Finder to get to Chrome, but, when trying to pass the URL to Chrome, I ALWAYS fail, no matter how I construct the passage (whether it's keyboard input for command-V, return, or using the menu commands).

I'm frustrated with Automator. I think back and have never remembered a time when I could create a macro or action successfully. I'm not a novice user and have extensive experience in scripting, but have found Automator both unreceptive and totally mystifying.

Intel 3.06 core Duo, Mac OS X (10.6.5), 4 GB RAM

Posted on Nov 24, 2010 4:32 PM

Reply
14 replies

Nov 24, 2010 5:51 PM in response to JohnMM

Sounds like something you should be asking at the Chrome website, since it won't accept Safari's URL. As for Flash, every site I've visited works well with it, including those at NPR. You might want to uninstall the Player and reinstall. 10.1.102.64 is the latest version. BTW, you might get more traction at the Automator forum: http://discussions.apple.com/forum.jspa?forumID=1261

Nov 24, 2010 7:22 PM in response to JohnMM

Automator actions aren't macros, each action is a short program (that can be written with a variety of languages) that performs a specific task with the data items that are generated and/or passed to it from previous actions.

How exactly are you passing the URL to Chrome? A URL should be a URL regardless of the application, since that data type is fairly well defined. The *Display Webpages* action is supposed to use the default browser, which is set in the Safari preferences.

Nov 24, 2010 8:34 PM in response to JohnMM

I don't know about Automator - I never use it, but this is trivial to do in 'pure' AppleScript (which can, incidentally, be run as an automator action...

tell application "Safari"
set theURL to URL of current tab of window 1
end tell

tell application "Google Chrome"
set myTab to make new tab at end of tabs of window 1
set URL of myTab to theURL
end tell


I think the code is pretty self-explanatory, but shout if you need help.

Nov 24, 2010 10:04 PM in response to baltwo

you miss my point: I don't want to run Flash in Safari, and I simply want to pass a URL to Chrome. Despite the reputed simplicity of Automator, it can't follow a simple action of taking a URL and passing it to Chrome. Doesn't seem to be a Chrome problem (automator action --> get Safari URL; Finder -->launch Chrome, etc.).

Nov 24, 2010 10:13 PM in response to red_menace

your point is technical. If I create a workflow (or any other form) in Automator, I start with the action "get current webpage in Safari" and follow it with "Launch application Google Chrome"; I then ask Automator to follow my actions, and I create a new tab and paste the URL in the address bar. It always fails on the latter, with no specific error message. I'd love to learn how to use Automator successfully and create scriptable workflows, apps, or whatever, but this failure is typical of all my failures with Automator.

Nov 24, 2010 10:21 PM in response to Camelot

that's more like it. simple, direct, quick, low overhead. It doesn't answer the Automator question directly, but the solution is more elegant and parsimonious. I'm still interested in Automator solutions.

I get hung up on things like "make new tab at end of tabs of window 1" where the language is simple, but the syntax is very specific. How can I learn these things about AppleScript?

Nov 24, 2010 10:46 PM in response to JohnMM

If you are using the *Watch Me Do* action, that is notoriously unreliable - especially when using mouse movements. It is a little bit better with menu items, but the locations of all of the objects on the screen have to be exactly then same as when recorded. You would think that it should work better than it does, but just a few pixels off and the position errors accumulate pretty fast.

Automator works best when you can use actions that are specifically designed to perform a part of your workflow, and in this case a *Run AppleScript* action (or just an AppleScript) that passes the URL to Chrome via its scripting terminology would probably be the way to go.

Nov 25, 2010 12:29 AM in response to JohnMM

I'm still interested in Automator solutions


Use the 'Run AppleScript' action and paste my code in 😉

In all seriousness, Automator is pretty good at driving workflows when there are clear Actions that meet your needs (like the "Get Current Webpage from Safari" action). As soon as you step out of that comfort zone into areas where there isn't a specific Action (e.g. "open this URL in Chrome"), Automator loses a lot of its appeal. The closest you can get is opening a URL in the default browser, which is likely to be Safari in your scenario.
Unfortunately, creating new actions is beyond the scope of most users, and therein lies the problem.

I get hung up on things like "make new tab at end of tabs of window 1" where the language is simple, but the syntax is very specific. How can I learn these things about AppleScript?


A lot of this comes from practice and experience. 😟
The dictionary does a fair job of telling you what commands/objects the application understands, but developers rarely include practical examples of how to use them.

In this case, even though I've never scripted Chrome before, I knew that 'make new tab' was probably not going to work - it needs a location as to where to make it. Since tabs are elements of a window (at least as far as Chrome is concerned) I knew that it had to be associated with a window somehow, and since a window already has a list of tabs it just seems easier/more logical to add the new tab at the end of the current tabs.
So it's largely a logical progression once you understand how the basic components fit together, but that understanding only comes with time and practice (and asking other people, too, I guess 🙂 )

Dec 4, 2010 5:17 AM in response to JohnMM

Hi, not an answer to your specific Q but the easiest way to go where you want to go:

Enable the Develop menu in Safari
There's an Open Page With -> Google Chrome item there
In the Keyboard prefs for Safari, assign a shortcut (e.g. [cmd]-[shift]-[G]) to the string "Google Chrome"
Done!

Now, if you're at a page with Flash you do want to view simply press [cmd]-[shift]-[G] . I use this same set-up.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

automator safari to chrome

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.