• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MacOS 10.5 odditie
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MacOS 10.5 odditie


  • Subject: Re: MacOS 10.5 odditie
  • From: KOENIG Yvan <email@hidden>
  • Date: Sat, 23 Aug 2008 12:42:48 +0200


Le 22 août 2008 à 18:26, KOENIG Yvan a écrit :


Le 22 août 2008 à 14:30, KOENIG Yvan a écrit :


Le 21 août 2008 à 12:45, KOENIG Yvan a écrit :

Hello

When we try to run:

choose file of type {"com.apple.iwork.numbers.numbers", "com.apple.iwork.pages.pages", "com.apple.iwork.keynote.key"}

under 10.4.11, it works flawlessly.
Under 10.5, the iWork's files remain greyed.

My guess is that Standard Addition is comparing some "old fashioned strings" to "unicode ones".

Is this oddity already reported?



At this time, I uses this workaround:

set permitted to {"com.apple.iwork.numbers.numbers", "com.apple.iwork.pages.pages", "com.apple.iwork.keynote.key", "com.apple.iwork.numbers.template", "com.apple.iwork.pages.template", "com.apple.keynote.kth"}
tell application "Finder"
if my quelOS() < "1050" then
set leDoc to choose file with prompt "Choose an iWork’s document" of type permitted
else
set leDoc to choose file with prompt "Choose an iWork’s document" of type {"com.apple.package"}
tell application "System Events" to if type identifier of leDoc is not in permitted then error "“" & (leDoc as Unicode text) & "” is not an iWork’s document!"
end if
end tell


--========

on quelOS()
local hexData, hexString
set the hexData to system attribute "sysv"
set hexString to {}
repeat 4 times
set hexString to ((hexData mod 16) as string) & hexString
set hexData to hexData div 16
end repeat
return hexString as string
end quelOS

--========

About the oddity with AddressBook archives file, I received:

OK, I took a look at AddressBook and iCal archives, and there does seem to be an error with the type - the property says it is com.apple.bundle, but it is really com.apple.package. As for using the UTI's, a file needs to have them set in the ContentTypeTree in order for them to be found - both AddressBook and iCal backups only have "com.apple.package", "public.directory", and "public.item" defined, so normally those are the only types that you will be able to use in the of type parameter.

All is not lost however - you can usually use the ContentType, but you need to know what to look for (I'm going to go around this the long way, because there is a bit of conflicting data and I can't explain these things very well).  For the previous AddressBook and iCal backup examples, info for returns a type identifier of "BNDL", System Events returns a type identifier of something like "dyn.age80c2xcsy", and the Finder doesn't have a type identifier property at all.  System Events is the clue here - a file's metadata has a kMDItemContentType entry with something like "dyn.ah62d4qmuhk2x44pdqm4u".  This is the value you can use, even though it doesn't match what System Events gives you - for example:

choose file of type {"dyn.ah62d4qmuhk2x42pcqm4u"}

This UTI is dynamic, so it is most likely different for each machine.  For my user account all of the AddressBook backups have the same type, so you should be able to look up that metadata item for your files (without a set UTI) and use it for all items of that type.  For scripting other machines, you can get the metadata item at runtime (also note that the ContentType is usually one of the types in the ContentTypeTree).


I don't know the way to grab the kMDItemContentType value.

Yvan KOENIG (from FRANCE samedi 23 août 2008 12:40:07)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >MacOS 10.5 odditie (From: KOENIG Yvan <email@hidden>)
 >Re: MacOS 10.5 odditie (From: KOENIG Yvan <email@hidden>)
 >Re: MacOS 10.5 odditie (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Re. Hdiutil broken for me
  • Next by Date: Re: INDESGN CS3: Still AfterOpen Event Problem
  • Previous by thread: Re: MacOS 10.5 odditie
  • Next by thread: do shell script timeout too long
  • Index(es):
    • Date
    • Thread