Professional Web Applications Themes

lauch services versus internet config - Mac Programming

apple's docs seem to indicate that you should use launch services these days, and that internet config is dead in the water. but there's several things i'd like to do that don't seem to be possible with launch services. for example, mapping a mime type to its preferred application and an icon. it's useful for e-mail and usenet apps. say i encounter an rfc822 message, which includes e-mail messages and usenet articles, with a mime attachment. i want to put up a picture button that has the file type's icon on it that, when pressed, writes the attachment out to ...

  1. #1

    Default lauch services versus internet config

    apple's docs seem to indicate that you should use launch services these
    days, and that internet config is dead in the water. but there's
    several things i'd like to do that don't seem to be possible with launch
    services. for example, mapping a mime type to its preferred application
    and an icon. it's useful for e-mail and usenet apps.

    say i encounter an rfc822 message, which includes e-mail messages and
    usenet articles, with a mime attachment. i want to put up a picture
    button that has the file type's icon on it that, when pressed, writes
    the attachment out to a file and launches it in the preferred app. so
    the first step is mapping a mime type string, such as "text/plain" or
    "image/jpeg", to an icon, which i want to do before ever writing the
    attachment to disk.

    i get the feeling that this is possible with internet config, but man,
    the docs sure are lousy, and all the examples are in pascal, which i
    can't read very well. can anybody point me to example code? i've been
    digging through google for hours without finding anything very useful.
    if this is possible with launch services, i'd rather use that.

    i have a vague memory that the only way the end-user can poke through
    the internet config mappings is by using the mac version of msie.
    correct? i can't test this for myself, because the first thing i do
    whenever i install macosx is put msie in the trash. are there any other
    apps that let you browse internet config mappings? apple's docs make
    mention of such a thing, but i can't find it.
    Jhnny Guest

  2. #2

    Default Re: lauch services versus internet config

    On Mon, 23 Feb 2004, =?ISO-8859-1?Q?J=F8hnny_F=E4v=F2r=EDt=EA_=28it_means_=22halo= 2C_then_resonate=22=29?= wrote:
     

    AFAIK you can't do this with launch services. There isn't a call in IC
    that directly maps mime types to creator codes or whatever (only
    filenames/extensions to type/creator), although you
    can always get the table of all mappings lke this:

    ICAttr attributes=0;
    Handle entriesHandle=NewHandle(0);

    ICFindPrefHandle(myInsance,kICMapping,&attributes, entriesHandle);
    and then iterate through it with ICGetIndMapEntry.
     
    There is no builtin thingy for doing this, although there are some 3rd
    party apps to do this (eg
    http://www.monkeyfood.com/software/moreInternet/).
    I don't know how this interacts with the fact that applications can
    specify mime types they can handle in their plist.

    Fred

    Frederick Guest

  3. #3

    Default Re: lauch services versus internet config

    Frederick Cheung wrote: 

    dang. why hasn't pine been updated to deal with RFC2047-encoded
    headers? the standard has been around for, oh, eight years or so.
     

    yeah, that's the solution i have been slowly convincing myself will be
    the only way i can do this. thanks for the confirmation.
     

    i am clearly no expert on this, but i think that's irrelevant to the
    problem at hand. it looks like the internet config database just
    creates associations between mime strings and type/creator and file
    extensions. i guess i'll start with a mime string and convert that to
    an extension or type/creator, whichever feels more promising, then ask
    launch services to convert that to an iconref and a preferred app, and
    that's going to go through the desktop database (or whatever the macosx
    equivalent is to that macos9 concept), and it should have the up-to-date
    info on all apps that have been registered to deal with files of that
    type.

    if anybody can punch holes in my "logic," feel free.
    Jhnny Guest

  4. #4

    Default Re: lauch services versus internet config

    Frederick Cheung <DUH.ucam.org> wrote:
     
    >
    > AFAIK you can't do this with launch services. There isn't a call in IC
    > that directly maps mime types to creator codes or whatever (only
    > filenames/extensions to type/creator), although you
    > can always get the table of all mappings lke this:
    >
    > ICAttr attributes=0;
    > Handle entriesHandle=NewHandle(0);
    >
    > ICFindPrefHandle(myInsance,kICMapping,&attributes, entriesHandle);
    > and then iterate through it with ICGetIndMapEntry.[/ref]

    There actually *are* a couple of high- and mid-level functions that let
    you map filename and type/creator to an IC mapping entry.

    That said, these functions might not be as good at guessing as you'd
    hope (since there's no limit on the number of entries that could match,
    but they only return one entry), and they don't map from MIME-type to
    entry. So Johnny will have to search through the mapping database, as
    you say.

    <http://developer.apple.com/doentation/Carbon/Reference/Internet_Conf
    ig/internet_config_ref/FunctionGroupIndex.html> ...has the specifics.
    Paul Guest

  5. #5

    Default Re: lauch services versus internet config

    In article <nashville.comcast.net>,
    Jhnny Fvrt (it means "halo, then resonate") <com>
    wrote:
     

    In Jaguar and later, you can use LSCopyApplicationForMIMEType() in
    Launch Services to get the application for a corresponding MIME type.
    That won't give you a doent icon, but without an extension you
    wouldn't know what kind of doent you have anyway. You can probably
    use the application's icon and the file's kind string (which you can
    also get from Launch Services) to come up with a sufficiently good
    visual identifier for the file.

    Hope this helps,
    Eric

    --
    Eric Albert stanford.edu
    http://rescomp.stanford.edu/~ejalbert/
    Eric Guest

Similar Threads

  1. Internet Config
    By Earle in forum Mac Applications & Software
    Replies: 3
    Last Post: August 11th, 09:50 PM
  2. Search Engines versus Internet Security
    By GeoBear in forum Macromedia Dreamweaver
    Replies: 2
    Last Post: August 2nd, 07:06 AM
  3. Microsoft VPN and Norton Internet Security 2003 Config
    By Mark Swift [MSFT] in forum Windows Networking
    Replies: 0
    Last Post: June 30th, 08:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139