Problem with reserved characters

I apologize if this has been asked a hundred times before - I’m new to AS.

Why can a file name contain “(){}!'”, and the Finder will open it when you double click it, but the following tell to Finder fails?

tell application “Finder”
open (path to desktop folder as text) & “TEST!” – fails if name contains any of “(){}!'”
end tell

How do I handle file names with these characters in AS?

Thanks for the help

As soon as I posted the above I stopped getting an error opening files with these characters. Does anyone have a clue what happened? I moved over a thousand files and repeatedly, any file with those characters caused a Finder error. This is what I used …

tell application "Finder"
	move (path to desktop folder as text) & fileName & ".jpg" to (path to me as text) & "::Graphics:" with replace
end tell

But now a file with the suspect characters is opening fine.

Any ideas?

Thanks again.

Well for one, I found that Filemaker is producing a different apostrophe. It looks bolder. As soon as I retype it in TextEdit or the Script Editor, the file error ceases.

I’m trying to figure out how to get the proper apostrophe out of Filemaker and into the AS.

Any ideas?

Hi,

I strongly recommend to avoid those special characters in filenames, that’s the most reliable solution :wink: