Re: Weird Finder bug - or not?
Re: Weird Finder bug - or not?
- Subject: Re: Weird Finder bug - or not?
- From: email@hidden
- Date: Thu, 04 Sep 2003 12:29:06 -0400
- Priority: normal
Paul,
I have seen this strange behavior too. I was working on OS
10.2.6 with AS 1.9.1 and I couldn't get a script to compile
while I was using the word 'Folder'. If I recall right, it
highlighted the text after 'Folder' and gave an error
message of something like 'Expected end of line but found
identifier'.
But when I changed 'Folder' to 'Alias' it worked fine. The
next day when I started up my machine, I tried to compile it
with 'Folder' again and it worked fine. Very strange
stuff.
Jay
----- Original Message Follows -----
>
Paul Berkowitz wrote:
>
>
>I seem to have found a "floating" bug in Finder scripting
>
in OS 10.2.6. Now >you see it, now you don't.
>
>
>
>A user of one of my scripts that has been available for a
>
very long time >wrote me that the script was erroring
>
immediately with a "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.
>
>
>
>
I tried it here (french OS 10.2.6, AS 1.9, no extraneous
>
OSAXen). I didn't encounter no problems, either with the
>
'as string' version or with the 'as Unicode text' one.
>
I tried changing the name(s) of dropped file(s),
>
introducing some non-ASCII characters.
>
>
>
>
>
>
>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.) >
>
>Changing the second line to 'alias fp' instead of 'file
>
fp' with 'as string' >in the first line also worked, I
>
think. (I know I could just parse the >filepath to get the
>
file name, but later in the script I really do need the
>
>Finder to set file type, creator type and to rename the
>
file.) >I wanted to double-check 'alias' today
>
>
>
>But here's the weird part: today I get no error with the
>
original script! >Both 'as string' and 'file fp' work just
>
fine together. >
>
>So now I can't test it and I can't figure out what's
>
going on. All I did >between yesterday and today was to
>
restart my computer. How could that >matter? Has anyone
>
else seen anything like this in OS 10.2.6? >
>
As I said above, no.
>
I'm surely asking the obvious, but are you sure not to
>
have used at one moment some addition that could perform
>
unwanted coercions?
>
>
Apropos coercions. While reading your code snippet, I
>
immediately wondered wether such successive coercions
>
were really needed, and why something like this wouln't
>
be sufficient:
>
>
on open listOfAliases
>
set firstAlias to item 1 of listOfAliases
>
tell application "Finder" to set fileName to
>
firstAlias's name
>
tell application "Finder" to set firstAlias's name
>
to (fileName & "01")
>
end open
>
>
Unless I'm wrong, the Finder has always been happy with
>
aliases and able to act upon corresponding items. This
>
could thus be a more portable approach, as one lets the
>
Finder perform the coercions it needs without
>
interference. But you must be thinking of situations where
>
such a 'pure alias' solution could/would fail.
>
>
Axel
>
_______________________________________________
>
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.
_______________________________________________
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.