Back to Mac Usenet

From: Gregory Weston <uce@splook.com>
To: All
Subject: Re: detect the default extensio
Date:Tue, July 29, 2008 11:28 PM


In article
<2429712a-6f0b-4bc4-9179-45d4e2a879fc@t54g2000hsg.googlegroups.com>,
Jo_y <jo_y@operamail.com> wrote:

> > You're going to have to restate your question. What do you mean by
> > 'detect the default extension?' What do you hope to accomplish? (What is
> > your *real* goal?)
>
> Hi, W.
> i'll try my best to explain the cause of my research,
> let's use the application "TextEdit" for example:
> if my front document contains only text, without format, i'll mean
> without bold, italic, bullets, ect. letters, then Textedit will save
> this document with the name extension ".txt", if the front doc.
> contains formatted text then the application will save it as ".rtf",
> else in the last case, if the text document contains pictures too,
> then the front doc. gots the name extension "rtfd".
>
> i know a other script, where puts folders or applications in the
> finder-dock, and uses the .plist-file to do this task, but it's not
> useful in this case. TextEdit uses a .plist- file (/Applications/
> TextEdit/Contents/Info.plist) to find the right extension of the front
> document.

No it doesn't. TextEdit uses the plist file, like every other document
handling application, to publish to the system and related services the
list of document types it's able to handle and the kind of processing
(view vs. edit) that it's able to perform on those files. It does *not*
use that list to "find the right extension of the front document."

It chooses text vs. rtf(d) based on whether the user has defined the
document to be plain text or rich text. It chooses rtf vs. rtfd based on
whether there are embedded images. You might notice that it's not just
picking a different default item from a menu - the whole format menu
changes and the default happens to be the first item in each possible
menu. The contents of those menus are built in code, on demand. It
decides which menu to build and show by examining a property of the
document which is not published in a way that AppleScript (or any other
mechanism) can query.

>
> you find the full-functional applescript, where will use this feature
> here:
> http://groups.google.com/group/alt.comp.lang.applescript/browse_thread/thread/
> 153b5854f070cb54#
>
> thanks for your attention.

--
"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
- Harry Potter and the Odor of the Phoenix


51


Running TeleFinder Server v5.7.
© Copyright Spider Island Software