Re: choose file of type {}
Re: choose file of type {}
- Subject: Re: choose file of type {}
- From: KOENIG Yvan <email@hidden>
- Date: Fri, 24 Oct 2008 21:07:30 +0200
Le 24 oct. 2008 à 20:44, Christopher Nebel a écrit :
On Oct 23, 2008, at 6:33 PM, Philip Aker wrote:
On Oct 23, 2008, at 6:13 PM, Christopher Nebel wrote:
Bear in mind that just because a file contains XML data doesn't
mean that the UTI system knows that. File type identification is
based on a number of things, but file-content-sniffing isn't one
of them. There has to be a definition of the document type
somewhere, either in the built-in list (the quoted document has
it) or in some installed application.
That said, if it seems to be excluding something that does in
fact have a conforming definition, then that's a bug, so send it
along.
In my case, I have a test xml, xsl, and xsd suite (all previously
validated and tested XML with xmllint and xsltproc).
Running 'choose file of type {"public.xml"}' in Script Editor
doesn't even enable the .xml for choosing.
So I'd be curious as to how come Luther Fuller gets to say it
works perfectly.
I'm tending towards a bug because so far it's 2:1 not working v.s.
working.
Again, the contents of the file are irrelevant. If there's no app
that defines what a ".xsd" file is, then the system doesn't know
that it's XML (in UTI terms, "conforms to 'public.xml'"). You
could indeed argue that ".xsd" ought to be defined by the base
system (I'd tend to agree), but that's an enhancement, not a bug.
If a particular file type means that much to you, then you can
define the UTI yourself. Save your script as an application
bundle, and then follow the directions in the "Understanding UTIs"
document referenced earlier.
--Chris Nebel
AppleScript Engineering
I understand that Mr. Nebel but it doesn't explain why
choose file of type {"com.apple.iwork.numbers.numbers"}
fails under 10.5 on a system where Numbers is installed.
It behaves flawlessly under 10.4.11.
I am forced to use this ugly workaround:
--[SCRIPT]
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 "System Events"
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"}
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
--========
--[/SCRIPT]
Yvan KOENIG (from FRANCE vendredi 24 octobre 2008 21:03: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