Using a CFURLString to open a folder

So i have a CFURLString such as:

file://localhost/Users/Shared/Adobe%20PDF%206.0/

What i would love to do is use a pre-existing Finder command to open the folder specification without having to parse out the ‘%20’ or performing any other in-script text editing voodoo, AND preferably without having to activate another application such as Safari. Maybe some sort of shell script?

Since such strings appear in OS X .plist files i would hope that there would be some command the Finder could use to properly understand the string so that the folder could be opened. But that is because i lazy and don’t want to have to muck around with text delimiters and the like.

Note that pasting the path above directly into Safari will open the corresponding folder in the Finder, however I have been unable to write a script that will properly pass the string along to Safari.

Any thoughts?

The Finder (at least in 10.3) knows how to coerce a file URL to an alias:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

sadly, when i run the above script i get the following error:

Can’t make file 1 of application “Finder” whose URL = “file://localhost/Users/Shared/Adobe(null)DF2” into a alias.

to simplify the issue i’ve also tried using

“file://localhost/Applications/”

in the hopes that without the %20 character things would go more smoothly. No dice however.

I am running 10.3.4 with the latest security updates installed.

Thanks for the idea though, I would have never been able to come up with that syntax. I will keep playing around.

Ah, when I tested this, I tested on a local file and it worked and then I substituted your URL and didn’t really think about why mine worked. It worked because I was using a file on the Desktop so it was implied to the Finder where to look. When you use a URL to a file someplace else, you have to tell the Finder where to look for it. Also, so it will work for either files or folders, let’s change it to item 1 instead of file 1. So, it won’t be as helpful but it should give you someplace to start:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

OK, I must be missing something here.

What’s wrong with just:

open location "file://localhost/Applications/Address%20Book.app"

Since it’s a file:// URL, Launch Services will pass it to the Finder for processing.

That just opens the item, it doesn’t give you a reference to the item. I assumed the poster just wanted a reference to a path to the item.

Jon

actually ‘open location’ was just the command i was looking for but was unable to figure out on my own until this afternoon. :oops:
but thanks for the other suggestions