FastScripts

Latest

  • Use AppleScript to open current Safari URL in Google Chrome

    by 
    TJ Luoma
    TJ Luoma
    03.14.2011

    I've been using John Gruber's suggestions from Going Flash-Free on Mac OS X, and How to Cheat When You Need It to avoid installing Adobe Flash by using Google Chrome (which includes its own version of Flash) whenever I run into a page that has Flash I want to see. To make this easier, John suggested turning on the "Develop menu" in Safari's "Advanced" preferences, which includes a sub-menu to "Open Page With" and a sub-sub-menu that shows all of your installed browsers. John suggested using System Preferences to create a keyboard shortcut for "Google Chrome" or "Google Chrome.app" depending on which one you saw in the menu. Unfortunately, this failed for me quite often. Every time I launched Safari, the keyboard shortcut would not work until I had opened that menu manually using the mouse. I hate using the mouse. After opening the menu, the keyboard shortcut would work until I quit Safari again. That was mildly annoying, but things recently took a turn for the worse. Here's what the menu looks like for me now: Notice that the browser listings now include version numbers. This means that a keyboard shortcut would have to include the version number, which means it would break whenever the browser is updated. I asked a few folks, and it appears this changed in Safari 5.0.4. I haven't been able to find a way to revert to the old behavior, so I started looking for another way. Enter AppleScript Using AppleScript, you can send the current URL from Safari to Google Chrome. Here is the AppleScript that I am currently using: (Note: this article was updated on 2013–02–10 to include an updated and improved version of the AppleScript, as well as expanded instructions on how to use it.) This AppleScript will launch Google Chrome if it is not already running, and will not overwrite any existing tabs in Google Chrome. To use this AppleScript, you will need to download it from Github. Note that the download filename will be something ridiculously long which starts with 'gist4750810' (don't ask me why, it's a Github 'thing'). Find that file in your Downloads folder, double-click it, and Archive Utility will open it and show you a folder with a file named 'Open in Google Chrome.scpt' in it. Now you'll want to open a new Finder window so you can navigate to where that file needs to be installed, so choose File » New Finder Window and then move on to the next section. Installation To use 'Open in Google Chrome.scpt' in Safari, it needs to be installed to ~/Library/Scripts/Applications/Safari/ (where ~ is the path to your Home directory). If that folder does not exist, you will need to create it. The easiest way to do this is to go to the Finder and then choose the "Go to Folder..." option from the Go menu, as shown here: Once you have done that, a window will appear prompting you to enter the path that you want to go to. Enter ~/Library/Scripts/Applications/Safari/ and see if it opens the folder. (Aside: If it says "The folder can't be found" try going to ~/Library/Scripts/Applications/ instead, and then just create the 'Safari' folder using File » New Folder from the menu bar.) Once you are in the ~/Library/Scripts/Applications/Safari/ folder, simply drag the 'Open in Google Chrome.scpt' file to it from the other Finder window. Using 'Open in Google Chrome.scpt' From Safari Once 'Open in Google Chrome' is installed, there are two ways to use it from Safari. Option one is to use the "Scripts" menu extra from OS X. Option two is to use a program called FastScripts. I prefer FastScripts, but will explain how to use the standard OS X option first. To use that Scripts menu, launch the "AppleScript Editor.app" found in /Applications/Utilities/ and then go to Preferences and enable the option 'Show Script menu in menu bar' as shown here: Once the Script menu is enabled, you will see 'Open in Google Chrome' whenever you are in Safari. Just click on the Scripts icon in the menu bar and select it as shown here: But what if you want to use a keyboard shortcut instead of the mouse? For that you will need FastScripts, which gives you everything the standard 'Scripts' menu offers, plus the ability to assign keyboard shortcuts. To assign a keyboard shortcut, open FastScript's preferences and find the entry for 'Safari' under your home folder, then locate the 'Open in Google Chrome' entry. Click over in the 'Shortcut' column and assign it a keyboard shortcut. As you can see here, I have chosen ⌥ (Option) + G: FastScripts lets you assign up to 10 keyboard shortcuts for AppleScripts for free. If you want to use more than 10, you'll need to buy a license for US$15. As a keyboard-lovin' mouse-hater, I consider that a bargain. FastScripts offers a lot more than just keyboard shortcuts, so I would encourage you to check it out. "Flash Free" Now whenever I am in Safari and encounter a page which requires Flash, I press ⌥ + G and the page loads in Google Chrome. It's quick and easy, and doesn't require that I maintain a separate Flash installation. Adobe Flash continues to be a source of security problems. Using it in only Google Chrome is a good way to increase your browsing security, especially since Chrome is frequently updated. p.s. since I know there are many other Keyboard Maestro fans out there, I'll also add a quick link to my Keyboard Maestro macro for doing this same thing using Keyboard Maestro.

  • Apptivate 2.0 adds keystroke sequence shortcuts

    by 
    TJ Luoma
    TJ Luoma
    01.18.2011

    There are a plethora of "launcher" apps out there. I've used LaunchBar ($35) since it was released for NeXTStep; other folks seem fond of Alfred (free, with additional powerpack for £12, or about US$20), Butler ($20), Keyboard Maestro ($36) or Google Quick Search Box (free). The venerable but now mostly-dead QuickSilver (cue moment of silence followed by someone yelling out "I'm not dead yet") is being kept alive by a band of merry coders who hope to revive it. Heck, even FastScripts and OS X's own Spotlight can serve as launchers. I come not to replace your favorite launcher, but to supplement it, with an incredibly handy $3 app called Apptivate. Read on for details

  • Create keyboard shortcuts to jump to Safari 4 tabs directly

    by 
    TJ Luoma
    TJ Luoma
    05.13.2010

    My friend Steve (no, not that Steve) just solved a problem I've had for awhile now: how to jump to a specific tab in Safari using the keyboard. Turns out that it's possible, and it's free, and it works pretty well. What else could you ask for? The solution comes from Paul Kretek's website where he outlines how to use FastScripts to assign keyboard shortcuts to specific tabs. Paul and Steve both want to use Safari, but they like Firefox's method of numbering tabs 1-9 used together with the command (⌘) key . By default, Safari uses ⌘+[1-9] to jump to bookmarks on your bookmark bar, which I use all of the time so I'm planning to make keyboard shortcuts for tabs control+1-9 instead. (⌘+0 [zero] is used to set the zoom back to original size.) Who knows, I might change my mind. I had found myself trying to use ⌘+[1-9] for tab switching in Safari because I was already used to tab switching that way in iTerm. The only bookmark keyboard short I use with any frequency is ⌘+1 which I use to invoke Quix which I've written about previously and absolutely cannot work without. Paul's instructions are very thorough, and although they may look a little complicated, it's something you only need to setup once. Also note that FastScripts is free for up to 10 shortcuts, after that it's US$14.95 for unlimited use.

  • Twitter undo AppleScript

    by 
    David Chartier
    David Chartier
    07.31.2007

    If you use Twitter via the web, you can simply click the trash can next to that last tweet that had a typo or - *gasp* - you realized all too late shouldn't be public. If you use something like the TUAW favorite Twitterrific from the Iconfactory, however, you're at a loss, as it features no such trash can. Fortunately, Daniel Jalkut (of such fine Red Sweater Software products as MarsEdit, FlexTime and FastScripts) has posted enough embarrassing tweets to warrant the creation of a Twitter undo AppleScript that automates the deletion if your previous tweet, and he is provided it free of charge from the Red Sweater Blog. By default, all you need is Jalkut's excellent FastScripts product (either the commercial version or its free little brother), and you can simply follow his brief instructions to get set up with a Twitter safety net. Note that if you use external apps like Twitterrific you won't actually see the tweet disappear from your account. However, if you see the delete confirmation that Jalkut's script is designed to display upon successful operation, the tweet should actually have been deleted and you can check your actual Twitter.com account page to be sure.

  • An AppleScript for selecting the iChat menubar item

    by 
    David Chartier
    David Chartier
    07.11.2007

    I understand if this might sound kinda weird, but hear me out: As an iChat user, I love the flexibility of its UI and the clever menubar item that displays all available contacts. Since I've found myself flying without displaying the buddy list more and more often lately, I've been wishing for a way to select iChat's menubar item with a simple keyboard shortcut, giving me quick access for viewing who's online no matter what app I may be using at the moment. Thinking out loud this morning, I even posted this wish on Twitter - only to find Daniel Jalkut of Red Sweater Software (makers of MarsEdit, FastScripts and more) coming to my rescue moments later! Demonstrating the wonders of AppleScript, Daniel quickly whipped up a script that does exactly what I want. To make the script painlessly easy to use, it can be tied to a shortcut with his excellent FastScripts or a Quicksilver trigger, providing instant access that selects and displays the iChat menubar item and all available buddies. Easy breezy iChatting, without needing to keep my buddy list always visible.If you want the script, head over to Daniel's Twitter post that contains the tinyURL download link. Toss the script you download into your ~/Library/Scripts folder (or anywhere else you like to store them), and then point your favorite keyboard shortcut utility at it to make your iChat life a bit easier. Thanks Daniel!

  • AppleScript to view next unread message in Mail

    by 
    David Chartier
    David Chartier
    07.21.2006

    If you've ever wished for the ability to go to the next unread message in Mail, instead of having to shuffle through all the unread ones, some enterprising AppleScript.net forum members have put together a script that might go well with your favorite app/script launcher, such as FastScripts.I tried this out with my preferred everything-launcher, Quicksilver, and it worked like a charm. I saved the script in Script Editor, then simply added it as a Trigger in Quicksilver with a keyboard shortcut. This has the fortunate side effect of being accessible from anywhere in the OS, so when I press my hotkey, Mail comes to the front and moves to the next unread message in the selected mailbox. Here's hoping Apple's Mail engineering team is listening and has something a little more integrated cooked up for Leopard's Mail.[via Hawk Wings]