Re: Weird Finder bug - or not?
Re: Weird Finder bug - or not?
- Subject: Re: Weird Finder bug - or not?
- From: John Delacour <email@hidden>
- Date: Tue, 19 Aug 2003 09:24:20 +0100
At 6:45 pm -0700 18/8/03, Paul Berkowitz wrote:
"Finder got an
error: descriptor mismatch".
I tried it myself in OS 10.2.6, and sure enough replicated the same error.
It boiled down to these lines:
on open (theSelection)
set fp to item 1 of theSelection as string
tell application "Finder" to set fileName to file fp's name
end open
'file fp' in the second line was highlighted.
In puce if you drop a folder or a disk, I bet!
Besides, if you want things to work on different systems, the last
term you ever want to rely on is 'file', as I've said on this list as
nauseam.
If I changed the first line to 'as Unicode text' instead of 'as string' all
was well. But this script has to work in OS 10.1 as well as 10.2, and alias
'as Unicode text' wasn't introduced until OS 10.1.5 or thereabouts. (AS
1.8.3 I think.)
Are you sure? It works fine in Mac OS 9.2.2 and I guess it would
work in 8.6. Are you saying they omitted it just for 10.1? I have
SE 1.8.3 installed in 9.2.2 and this works fine with any selection:
on open _droppedfiles
try
set _pathname to first item of _droppedfiles as Unicode text
tell app "Finder" to set _filename to name of (_pathname as alias)
display dialog _filename
on error e
display dialog e
end try
end open
I haven't tried this in Mac OS X yet but I don't expect any problem.
JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.