Jump to content

Open URL in OS X

This topic is 6426 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hey folks,

I have a solution written originally in OS 9, testing it out on OS X. Working fine except for the Open URL script step. I have a script that opens a GIF in the browser by passing ["file:///" & FilePathCalc] to the Open URL script step (FilePathCalc is a text calculation that takes care of spaces ":" vs "/", etc in a FilePath field; obviously I set a global equal to the above then open the URL with it). Has worked great in 9. In X however, rather than opening it in the default browser, it launches Photoshop.

I tried dragging the Photoshop app to the trash and the script just doesn't open anything. No error, it just skips the step. I thought it might be that photoshop did something to the system when being installed that would throw everything off, but one machine I tried it on has FileMaker running in X and Photoshop running in 9 and I got the same result. Somehow the Open URL script is looking somewhere in addition to or instead of the default browser to process URLs. Normal urls (http://) work fine from filemaker.

Anyway, when I open a file from within Safari, it displays the GIF in Safari just as it should which leads me to believe the issue is on the Filemaker side.

Anyone ever deal with anything like this?



Link to comment
Share on other sites

First of all, make sure the file name ends in an extension, in this case .gif.

What happens when you double-click the file?

Try this: get info on the file, click Open With... and select Safari, then click Change All.

Link to comment
Share on other sites

Removing a "/" didn't work, thanks though.

As for changing the default app for .gif files, I want to keep them as photoshop documents. In os 9, double-clicking a gif opens it in photoshop, yet using open url to point the browser to the file opens the file in the browser as expected. For some reason though, OS X (in which double-clicking also opens photoshop as expected) decides it's going to launch photoshop rather than display it in the browser when issuing an Open URL command.

Link to comment
Share on other sites

It's probably that OS X has a different default app associated with the extension; and apparently the "file://" is now longer autmatically associated with a browser, but can be other apps instead.

In OS X there's a pretty complex system for associating files with apps, as it has the older "type and creator codes" as well as the Windows-like "file extension" (more meaningful that in OS 9).

One also has the ability to say "Open all files of this type with this app," by holding the Option key when you Get Info. God knows what/where exactly this change is made.

I would think that the easiest fix is forget the OpenURL and use AppleScript. Then it's easy enough to tell Safari to open the file.

Just for fun, open Script Editor, paste in the following, and navigate to one of your files:

get info for (choose file)

You'll see several pieces of info. Notice "default application," and that it is a full filepath. Example of a .gif file of mine:

default application:alias "Macintosh_HD:Applications:Preview.app:"

When I use OpenURL using "file://web type path" to above it opens in Preview app, which I would expect.

To open the chosen file with Safari (requires a Mac filepath).

tell application "Safari"


open file "Macintosh_HD:Users:fej:Documents:Documents_ll:Downloads:zMisc:CatsDogsBlog.gif"

end tell

If you want to use the same URL path:

tell application "Safari"

Link to comment
Share on other sites

This topic is 6426 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.