Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode broke my script



On 12/26/03 2:58 AM, "Takaaki Naganoya" <email@hidden> wrote:

> I am on the way to switch from ProjectBuilder to Xcode.
>
> But I found that Xcode broke my script.
>
> --original
> tell application "Finder"
> set aPath to choose file
> set aPath to aPath as unicode text
> set curFile to info for file aPath
> set a to file type of curFile
> end tell
> ---
>
> ---Project Builder Accepts this pattern
> tell all "Finder"
> set aPath to choose file
> set aPath to aPath as unicode text
> end tell
>
> set curFile to info for file aPath
> set a to file type of curFile
> ---
>
>
> Xcode changes "file type" to "file kind" when I compiled it.
>
> Project Builder never change like this.
>
> I think it is a bug.

NONE of your statements should be in a Finder tell block. What's any of have
to do with the Finder?

set aPath to choose file
set aPath to aPath as unicode text
set curFile to info for file aPath
set a to file type of curFile

probably works. But better would be simply:

set anAlias to choose file
--set aPath to aPath as unicode text -- if you need it elsewhere only
set curFile to info for anAlias
set a to file type of curFile


or, alternatively:

set anAlias to choose file
tell app "Finder" to set a to file type of anAlias

Both 'info for' and the Finder have a 'file type' property. In OS 10.3,
there are problems with using the Finder's 'file' object with a file path -
it seems to be some sort of Finder bug. It's best avoided. The Finder
understands the 'alias' keyword with filepaths and will coerce to Finder
file and folder objects just fine. But it seems to get confused now with
'file filePath' - it only like its own 'file' object in constructions such
as 'file a of folder b of folder c of folder d of disk e".

Until that bug is fixed, avoid 'file' in a Finder block - or just avoid
Finder blocks when you don't need them.

--
Paul Berkowitz
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.

References: 
 >Xcode broke my script (From: Takaaki Naganoya <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.