tag:blogger.com,1999:blog-1000315451233282197.post2103132787259983282..comments2023-07-22T02:54:17.315-05:00Comments on operator: Open links from external applications in a new window in Google Chrome on Mac OS XMike Hardyhttp://www.blogger.com/profile/01942604571555687523noreply@blogger.comBlogger34125tag:blogger.com,1999:blog-1000315451233282197.post-74225927741545596532020-09-03T10:02:21.361-05:002020-09-03T10:02:21.361-05:00Jim Ratliff! You are the hero we all needed and di...Jim Ratliff! You are the hero we all needed and didn't know it. Seriously thanks, this still bugs me and I had no solution since RCDefaultApp went down. CheersMike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-15250342161383808682020-09-03T01:01:23.149-05:002020-09-03T01:01:23.149-05:00RCDefaultApp appears to be defunct. A successor, w...RCDefaultApp appears to be defunct. A successor, which worked great for me, written in Swift, is SwiftDefaultApps. https://github.com/Lord-Kamina/SwiftDefaultApps Just grab and install the preference pane, "SwiftDefaultApps.prefpane, from within the current release. Then assign your AppleScript app to be the default browser.Jim Ratliffhttps://www.blogger.com/profile/06706823399737156623noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-19996731302783984482018-07-30T16:23:01.086-05:002018-07-30T16:23:01.086-05:00I can't believe I'm still updating this po...I can't believe I'm still updating this post I made in 2011 but here we go :-)<br /><br />As discussed above, Mac OS X has some sort of prevention now for setting arbitrary applications to handle URLs. If you have an old plist file from long ago with this AppleScript app set to open URLs, you're fine and won't notice (this was me up until yesterday).<br /><br />The plist file in question is ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist and you can look at the contents with /usr/libexec/PlistBuddy -c "Print" "/Users/$USER/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist" (though this may require the free XCode developer stuff installed)<br /><br />The problem is if you are setting up a new machine, you either have to copy that old plist file or your are out of luck, or you have to use the Lincastor browser thing above (which works but does an annoying notification each time).<br /><br />I wanted the pure script working again so I looked at how to edit the PList file manually and discovered <a href="https://github.com/primalcurve/macsupportpub/blob/master/scripts/setGoogleChromeAsDefaultBrowser_Scrubbed.sh" rel="nofollow">this wonderful script</a> for setting default browsers programmatically.<br /><br />I modified it to reference the package name of OUR wonderful script, and it works for me when run from the command line - you can <a href="http://mikehardy.net/setOpenURLInNewChromeWindowScriptDefaultBrowser.sh" rel="nofollow">fetch it from my site here</a>Mike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-38201692651878008542016-10-03T14:47:48.258-05:002016-10-03T14:47:48.258-05:00Thanks Justin. LinCastor Browser is a bit easier t...Thanks Justin. LinCastor Browser is a bit easier to set up and doesn't have the annoying Growl notification for every link clicked. I like it. :)<br /><br />For anyone new to this thread here are the exact steps (if you want what I want: every clicked link opens in a new Chrome Window automatically):<br />1. Get Lincastor Browser from the app store.<br />2. Launch it. OSX pops up a dialog asking about your default browser changing, click 'Use LinCastor Browser'<br />3. In the setup window that opens select Default in step 1, Remove any browsers listed in step 2.<br />4. Now click the plugin button. I had trouble "Registering New Script" but you can try that, or choose "Open Plugins Folder", which is where you have to create an applescript:<br />filename: OpenLinkInNewChromeWindow.scpt (you can run the Script Editor app to create this file)<br />File contents: <br />on handle_url(args)<br />tell application "/Applications/Google Chrome.app"<br />make new window<br />activate<br />set URL of active tab of first window to |URL| of args<br />end tell<br />return 1<br />end handle_url<br />5. One the applescript is created, back in LinCastor Browser click the Plugin button again and you'll see your new script file listed as an Available Plugin; just select it.<br />6. Click "advanced options..." at the top, and check the box for "if matching menu contains one single action, execute it without showing the menu"<br /><br />Quit LinCastor Browser. <br />Click a link and watch it pass through LinCastor Browser and open in a new Chrome window per the applescript. https works too!<br />Darren Cookhttps://www.blogger.com/profile/08628512618268957756noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-24422826888539498012016-09-19T17:30:52.074-05:002016-09-19T17:30:52.074-05:00Thanks, Darren! Used the script with Lincastor Br...Thanks, Darren! Used the script with Lincastor Browser (seemingly a newer app from the same developer as Lincastor, but available on the Apple Mac App Store, and featuring some additional useful features, like picking between browsers for each link clicked).Anonymoushttps://www.blogger.com/profile/02021518820551909671noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-53179056107602011562016-02-24T23:10:53.416-05:002016-02-24T23:10:53.416-05:00Darren - that looks pretty complicated (and the or...Darren - that looks pretty complicated (and the original solution is still working for me? But I installed it early in the 10.x series...) but if this works for other people great! I can see how it would work, sure. Thanks for sharingMike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-29458035483000961332016-02-24T15:11:45.609-05:002016-02-24T15:11:45.609-05:00This has been bugging me for a while under 10.10 a...This has been bugging me for a while under 10.10 and now 10.11 El Capitan. In particular because Chrome defaults to Add New Tab behavior, which it needs an existing window for, so if you're using desktop switching it will switch to the last used desktop with a Chrome window; very annoying.<br /><br />I did some research based on the thought that apps must be able to register for the System Preferences > General > Default web browser dropdown. I didn't find out how to register the applescript app for this dropdown (there is probably a way) before I found this instead: an app to let you register custom url schemes. <br />https://onflapp.wordpress.com/lincastor/ <br />It turns out this app can also modify the defaults for http and https!<br /><br />For our particular purposes (Chrome in a new window), here are the steps:<br />1. Download Lincastor, throw it in your app directory, right-click > Open to launch it. Click the Setup button.<br />2. Click the "add new scheme" button. <br /> title: OpenHTTPInNewWindow<br /> scheme: http<br /> handler: AppleScript<br />3. Here's the Applescript to paste in, based on this thread:<br />on handle_url(args)<br /> tell application "/Applications/Google Chrome.app"<br /> make new window<br /> activate<br /> set URL of active tab of first window to |URL| of args<br /> end tell<br /> return 1<br />end handle_url<br />4. Repeating step 2 but for https: <br />Click the "add new scheme" button again.<br /> title: OpenHTTPSInNewWindow<br /> scheme: https<br /> handler: AppleScript<br />Paste in the same AppleScript from step 3<br />5. Click Save and Activate.<br />OSX Should pop up a dialog after a few seconds about your default browser changing, click 'Use LinCastor'<br /><br />Tada! Links now open in a new Chrome window on your current desktop. At least as far as I have tested it (clicking links from Mail).<br /><br />Here are some more notes for those interested:<br />- The "default web browser" setting is stored in ~/library/preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist . (If you have XCode installed, double-clicking this file from the finder opens it nicely.)<br />- I previously had Chrome as my default browser, and saw it assigned to a few entries in the plist file. After the above setup, LinCastor became the registered app for the http and https entries, but not the others. So there may be situations where Chrome is still the default.<br />- System Preferences doesn't register the change: it still shows Chrome as my default. This seems fine as long as you don't change it (which will replace the entries in the plist file, causing you to need to open LinCastor again and click Save and Activate to fix it.)<br />- FYI the google search that led me to find this solution was "OSX change the URL handler for http: in Launch Services"<br /><br />Hope this helps some other folks!Darren Cookhttps://www.blogger.com/profile/08628512618268957756noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-86602084479749008662015-04-22T19:39:04.715-05:002015-04-22T19:39:04.715-05:00Dang - I wonder if this just happened - I've n...Dang - I wonder if this just happened - I've noticed since the most recent OS X update (I received one just a few days ago) I've had to reset security preferences a lot, perhaps something about the security model (and what apps to trust) has changed fundamentally, while leaving previous preference changes intact. Any more information you dig up would be greatly appreciated - Hopefully you figure something out - this script probably executes 100 times a day for me, would be very sad if it stopped working!Mike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-63402272644754744162015-04-22T19:10:12.062-05:002015-04-22T19:10:12.062-05:00Almost...I installed the pane, but when I choose t...Almost...I installed the pane, but when I choose the applescript it flips right back to the system default. The pane hasn't been updated since 2009 so I don't have much hope it will be fixed.<br /><br />I've sent an email to the developer of OnyX to see if he can expose the default browser preference there.Darren Cookhttps://www.blogger.com/profile/08628512618268957756noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-24154491979926124452015-04-22T09:23:31.717-05:002015-04-22T09:23:31.717-05:00Hey Darren - It looks using the "RCDefaultApp...Hey Darren - It looks using the "RCDefaultApp" 3rd Party preference pane will allow you to manage default apps including allowing you to specify an "Other..." app. I believe that's what I've used to set it - http://www.rubicode.com/Software/RCDefaultApp/ - hope that helps!Mike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-25332264453309225442015-04-21T13:59:30.973-05:002015-04-21T13:59:30.973-05:00The last comment to use xattr -rc [path to script]...The last comment to use xattr -rc [path to script] did fix the "damaged" error message. However when I double-click it it launches and closes, but does not register with safari. This is on 10.10.x....both Safari > Preferences General and System Preferences > General > Default Web Browser have locked down app selection, so you can only use apps that register as a browser, apparently. My Sys Prefs > General > Default Web Browser show Safari, Chrome, Firefox, Evernote, And VLC, but not the applescript. Any ideas how to solve this one?Darren Cookhttps://www.blogger.com/profile/08628512618268957756noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-59506626406675858392015-03-20T12:07:32.074-05:002015-03-20T12:07:32.074-05:00@Fatsquatch
That worked like a charm. Thanks!@Fatsquatch<br /><br />That worked like a charm. Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-55631804944415277302015-03-20T10:57:10.947-05:002015-03-20T10:57:10.947-05:00Hey Mike - I think this is related to the .app bun...Hey Mike - I think this is related to the .app bundle not being signed. It appears you have two options assuming that is the case - either go to security preferences and allow apps from anywhere (this should work but I'll quickly note it is potentially less safe) or specifically allow that app using a Terminal command similar to the one listed here: http://apple.stackexchange.com/questions/58050/damaged-and-cant-be-open-app-error-message<br /><br />I hope this helps! If it doesn't or anyone knows a more elegant way, please enlighten us.Mike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-65878031424203575662015-03-20T10:31:26.518-05:002015-03-20T10:31:26.518-05:00Thanks for this contribution, however, when I try ...Thanks for this contribution, however, when I try to open the script, I am getting an error: "OpenURLInNewChromeWindow" is damaged and can't be opened. You should move it to the Trash. http://screencast.com/t/CCvuFjtnJz<br /><br />on Mac OS 10.9.5Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-72093555867552386242014-12-07T19:46:49.199-05:002014-12-07T19:46:49.199-05:00I just recently upgraded to Yosemite (OS X 10.10),...I just recently upgraded to Yosemite (OS X 10.10), and I was having trouble setting the default browser to OpenURLInNewChromeWindow. I used RCDefaultApp, but on the "browser" tab, every time I tried to set another browser, the pull-down menu would snap back to whatever the current setting was.<br /><br />I ended up going to the "apps" tab, and from there I could choose the new browser and check the HTTP and HTTPS checkboxes and checking "set as default". That worked.<br /><br />I just wanted to pass along the tip, in case others are trying to set their default using RCDefaultApp.<br /><br />AlanAnonymoushttps://www.blogger.com/profile/05071951033717810000noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-22282831396087539012014-10-19T21:54:29.894-05:002014-10-19T21:54:29.894-05:00Fastsquatch, it worked, thanks!Fastsquatch, it worked, thanks!lithboyhttps://www.blogger.com/profile/12694220020549415755noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-11490748106219453972014-10-19T21:44:13.153-05:002014-10-19T21:44:13.153-05:00Hi lithboy - I've had success on Yosemite (I j...Hi lithboy - I've had success on Yosemite (I just moved to it a couple days ago and tried this actually) by using the "Default Apps" preference pane. You can set it by going in there and altering the behavior for http and https protocols, and it seems to stick for me? RCDefaultApp is the official name, from the wonderful folks at Rubicode: http://www.rubicode.com/Software/RCDefaultApp/<br /><br />Hope this helps, would love to hear if it succeedsMike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-82533916736879566872014-10-19T21:08:41.080-05:002014-10-19T21:08:41.080-05:00As of OS X Yosemite, there's no longer an abil...As of OS X Yosemite, there's no longer an ability to select an arbitrary application as your default browser. Safari only lets you choose Safari or Chrome, not this helper app.lithboyhttps://www.blogger.com/profile/12694220020549415755noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-11938594544526602242014-05-21T05:46:40.016-05:002014-05-21T05:46:40.016-05:00Any way to open this in Incognito mode? I can'...Any way to open this in Incognito mode? I can't seem to find a way to tell Chrome by Applescript to open anything in Incognito. It's easy to launch Chrome in Incognito just by --args --incognito in the first place, but if it's already running, how do I open anything new in Incognito? I would like to have this script open an URL form Safari's Develop menu in Chrome Incognito. Thanks for help.Frank Webbhttps://www.blogger.com/profile/05272211833051654631noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-9140179696272242332014-05-21T05:46:12.593-05:002014-05-21T05:46:12.593-05:00Any way to open this in Incognito mode? I can'...Any way to open this in Incognito mode? I can't seem to find a way to tell Chrome by Applescript to open anything in Incognito. It's easy to launch Chrome in Incognito just by --args --incognito in the first place, but if it's already running, how do I open anything new in Incognito? I would like to have this script open an URL form Safari's Develop menu in Chrome Incognito. Thanks for help.Frank Webbhttps://www.blogger.com/profile/05272211833051654631noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-60665432797617736962014-01-24T16:53:32.531-05:002014-01-24T16:53:32.531-05:00@Simon Katz - glad to hear a second success report...@Simon Katz - glad to hear a second success report on Mavericks. I can't believe this silly script is necessary but I'd go crazy without it I think so I'll keep it updated and working... CheersMike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-15341733276645770932014-01-24T16:50:50.484-05:002014-01-24T16:50:50.484-05:00I commented before that the script didn't work...I commented before that the script didn't work for me on 10.8.4.<br /><br />Just wanted to say that all is ok again now I've upgraded to Mavericks 10.9.1.Anonymoushttps://www.blogger.com/profile/11545497530244871840noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-68424774473434564552014-01-07T18:24:33.994-05:002014-01-07T18:24:33.994-05:00@Mike Eng - you are correct as entropy struck me a...@Mike Eng - you are correct as entropy struck me again - be on the lookout for a post shortly entitled "'yum update' on a stock RHEL Amazon Web Services Free Tier server won't boot'<br /><br />I just moved my stuff to the cloud and silly me for thinking yum update was safe. AWS runs custom kernels to boot off their cloud storage, and yum update pulls in a stock kernel. Hilarity ensues. So my servers were down.<br /><br />I just revived them, and the download link works again<br /><br />Possibly worth noting the script continues to work like the champion hack it is after an upgrade by me to Mavericks over the weekend.<br /><br />Cheers!Mike Hardyhttps://www.blogger.com/profile/12368648851858425928noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-39468003818545154882014-01-07T14:08:53.492-05:002014-01-07T14:08:53.492-05:00Looks like a broken link to the script bundle. htt...Looks like a broken link to the script bundle. http://screencast.com/t/010joFrRu5Mike Enghttps://www.blogger.com/profile/12524072780071996571noreply@blogger.comtag:blogger.com,1999:blog-1000315451233282197.post-65774970215421995832013-08-31T19:08:48.254-05:002013-08-31T19:08:48.254-05:00Sorry, wrong URL in my previous comment. It should...Sorry, wrong URL in my previous comment. It should be http://macscripter.net/viewtopic.php?pid=166461#p166461Anonymoushttps://www.blogger.com/profile/11545497530244871840noreply@blogger.com