1

I am using a simple applescript application to open different URL schemes in different Fluid Apps.

By setting this app as the default browser, I can effectively parse out the URL scheme and open the appropriate stand-alone Fluid App as the browser.

Everything works perfectly, except the "share this folder..." option in Dropbox. This opens a local URL - file:///var/folders/...

This simply does not work. The default_browser application launches and then immediately closes.

Does anyone know how to update this script so that local file links will work?

on open location this_URL

if this_URL contains "docs.google.com" then
    tell application "/Applications/Fluids/Google Drive.app"
        activate
        open location this_URL
    end tell
else if this_URL contains "drive.google.com" then
    tell application "/Applications/Fluids/Google Drive.app"
        activate
        open location this_URL
    end tell
else if this_URL contains "mail.google.com" then
    tell application "/Applications/Fluids/Gmail.app"
        activate
        open location this_URL
    end tell
else if this_URL contains "gmail.com" then
    tell application "/Applications/Fluids/Gmail.app"
        activate
        open location this_URL
    end tell
    -- default browser here
else
    tell application "/Applications/Google Chrome.app"
        activate
        open location this_URL
    end tell
end if
end open location

EDIT: to clarify - the Dropbox "share this folder..." option opens the default browser app (above), which then closes immediately.

  • 2
    I think the problem is that you're inside an on open location handler, while this_URL in the Dropbox-case would be recognized as a POSIX file, not a "location", though I'm not completely sure. Have you tried the above inside a on run event that checks whether this_URL contains file://? And what happens if you do a display dialog inside the on open location with a file-URL, does it even get catched by the event? – Asmus Jun 23 '14 at 17:20
  • You're right - display dialog doesn't even work within that event. Which leads back to my initial question which is 'how do I add local file URL handling to this app?' Any ideas? – timshutes Jun 24 '14 at 18:11
  • So after googling' around for a bit I'm quite certain that re-routing the file:// protocol is not possible. There's no LSHandlerURLScheme in ~/Library/Preferences/com.apple.LaunchServices.plist that maps this URL to the Finder - my guess is that the recognition of the file: protocol is deep inside the System resources and I wouldn't want to mess with that. What's the problem with the current handling of Dropbox's file URLs anyway? Where do you want to redirect this to? – Asmus Jun 24 '14 at 19:32
  • The issue is for this applescript to work with any URLs it needs to be set as the default browser. Nothing is wrong with the typical handling - that's what I'm trying to get back to. does that make sense? I updated the question with more info – timshutes Jun 25 '14 at 19:05

You must log in to answer this question.

Browse other questions tagged .