I’m trying to open a finder alias (a thing with the black arrow in its icon) with an “open” command targeting SD, and that’s the message I get.
I would love it if SD could be smart, detect that it’s an alias and fetch the original…
Can I just confirm you’re only seeing this when trying to open a file via scripting?
Yes. I’m using a simple script Chris sent to ASUL a while ago:
-- from Christopher Stone listmeister@thestoneforge.com / AppleScript User List
tell application "Finder" to set fSel to selection as alias list
tell application "Script Debugger 7"
activate
repeat with i in fSel
open i
end repeat
end tell
and when the selection is a Finder alias then I get this message. In all honesty, I tried the same with TextEdit and although it did open the file, it opened the alias physical file and not the target, which was disappointing, but I have slightly higher expectations for SD
Opening a file by double-clicking it and by using a script are similar: they both send an open event to the app. The difference is that when you double-click, any aliases are resolved before the event is sent (same as an open
handler in a script), so it’s not unreasonable to expect the same will thing to be done by Cocoa scripting (and the fact that it doesn’t is arguably a bug).
Anyway, this should be fixed in the next drop.
I would use the following workaround while waiting for a fix.
tell application "Script Debugger"
activate
repeat with i in fSel
set tCMD to "open " & (i's POSIX path)'s quoted form
do shell script tCMD
end repeat
end tell
FYI, unless the script is only opening files, that’s not a good idea. The problem is that the do shell script
command will return as soon as the instruction to open is given, rather than once the file is open. So any subsequent instructions to the open document are likely to fail.