Professional Web Applications Themes

Starting a Carbon application at user login - Mac Programming

Hello, I have recently written some post about how to run daemons in Mac OS X. I have a Carbon application (using CarbonLib) which tracks application usage and writes the information to log files. As Eric Albert told me in a recent post (thank you again Eric), this application cannot be a daemon because it connects to the window server ... Well, I found information in apple website to create a login script (LoginHook), this is at: [url]http://developer.apple.com/doentation/MacOSX/Conceptual/SystemOverview/BootingLogin/chapter_4_section_4.html[/url] I have tried this and finally I was able to create a small script which launches my Carbon application at user login, ...

  1. #1

    Default Starting a Carbon application at user login

    Hello,

    I have recently written some post about how to run daemons in Mac OS
    X. I have a Carbon application (using CarbonLib) which tracks
    application usage and writes the information to log files. As Eric
    Albert told me in a recent post (thank you again Eric), this
    application cannot be a daemon because it connects to the window
    server ...

    Well, I found information in apple website to create a login script
    (LoginHook), this is at:

    [url]http://developer.apple.com/doentation/MacOSX/Conceptual/SystemOverview/BootingLogin/chapter_4_section_4.html[/url]

    I have tried this and finally I was able to create a small script
    which launches my Carbon application at user login, and everything
    works fine. Now, my question is how can I create an installation
    process to install my application? The installation process includes
    to login as root, to create folders, to copy files, to modify the
    /etc/ttys file, to assign permissions and other steps ...

    Any suggestions to install my app? ...
    Thanks in advance!
    Jorge Guest

  2. #2

    Default Re: Starting a Carbon application at user login

    In article <4beb34a4.0309191156.24534c00posting.google.com >,
    [email]rgasparini29[/email] (Jorge) wrote:
    > I have tried this and finally I was able to create a small script
    > which launches my Carbon application at user login, and everything
    > works fine.
    That's all wrong. Just add your application to user's login items, after asking
    the user for permission. You can do so using a simple AppleScript, which I have
    previously posted here and don't feel like looking up since you can find it on
    groups.google.com

    hth

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Jurisic Guest

  3. #3

    Default Re: Starting a Carbon application at user login

    In article <4beb34a4.0309191156.24534c00posting.google.com >,
    [email]rgasparini29[/email] (Jorge) wrote:
    > Well, I found information in apple website to create a login script
    > (LoginHook), this is at:
    >
    > [url]http://developer.apple.com/doentation/MacOSX/Conceptual/SystemOverview/Boot[/url]
    > ingLogin/chapter_4_section_4.html
    Wow...I can't believe that's doented. Please don't do that. It's
    really not the right way to do what you're trying. Just modify your app
    to link against CoreServices instead of Carbon and make it a startup
    item, or keep it linking against Carbon and put it in every user's login
    items.

    -Eric

    --
    Eric Albert [email]ejalbertstanford.edu[/email]
    [url]http://rescomp.stanford.edu/~ejalbert/[/url]
    Eric Albert Guest

  4. #4

    Default Re: Starting a Carbon application at user login

    In article <ejalbert-F59808.00105920092003news.stanford.edu>,
    Eric Albert <ejalbertstanford.edu> wrote:
    > > Well, I found information in apple website to create a login script
    > > (LoginHook), this is at:
    > >
    > > [url]http://developer.apple.com/doentation/MacOSX/Conceptual/SystemOverview/Bo[/url]
    > > ot
    > > ingLogin/chapter_4_section_4.html
    >
    > Wow...I can't believe that's doented. Please don't do that.
    Am I the only one that wishes there was a ~/Library/LoginItems that
    could contain aliases of items to run at login? Like the OS 9 startup
    items folder.
    Sean McBride Guest

  5. #5

    Default Re: Starting a Carbon application at user login

    In article <cwatson-E8CF1E.13301921092003aeinews.aei.ca>,
    Sean McBride <cwatsoncam.org> wrote:
    > Am I the only one that wishes there was a ~/Library/LoginItems that
    > could contain aliases of items to run at login? Like the OS 9 startup
    > items folder.
    No, but AppleScripting this is easy enough too.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Jurisic Guest

  6. #6

    Default Re: Starting a Carbon application at user login

    In article <cwatson-E8CF1E.13301921092003aeinews.aei.ca>,
    Sean McBride <cwatsoncam.org> wrote:
    > In article <ejalbert-F59808.00105920092003news.stanford.edu>,
    > Eric Albert <ejalbertstanford.edu> wrote:
    >
    > > > Well, I found information in apple website to create a login script
    > > > (LoginHook), this is at:
    > > >
    > > > [url]http://developer.apple.com/doentation/MacOSX/Conceptual/SystemOverview/[/url]
    > > > BootingLogin/chapter_4_section_4.html
    > >
    > > Wow...I can't believe that's doented. Please don't do that.
    >
    > Am I the only one that wishes there was a ~/Library/LoginItems that
    > could contain aliases of items to run at login? Like the OS 9 startup
    > items folder.
    No, you're not the only one who thinks that. :) That's orthogonal to
    this thread, though, since login hooks aren't how login items work.

    -Eric

    --
    Eric Albert [email]ejalbertstanford.edu[/email]
    [url]http://rescomp.stanford.edu/~ejalbert/[/url]
    Eric Albert Guest

  7. #7

    Default Re: Starting a Carbon application at user login

    In article <macdev-9B9464.13585821092003senator-bedfellow.mit.edu>,
    Miro Jurisic <macdevmeeroh.org> wrote:
    > No, but AppleScripting this is easy enough too.
    As far as I know, the AppleScript approach was not doented and will
    not work under Panther. As for Jaguar, I ran into a case where the
    script didn't work. The case in which it doesn't work is if you have
    previously used System Events to set a login item, and System Events is
    still running. Then there is no error message, but the new item just
    doesn't show up in the Login Items preference panel.
    James W. Walker Guest

  8. #8

    Default Re: Starting a Carbon application at user login

    In article <macdev-9B9464.13585821092003senator-bedfellow.mit.edu>,
    Miro Jurisic <macdevmeeroh.org> wrote:
    > In article <cwatson-E8CF1E.13301921092003aeinews.aei.ca>,
    > Sean McBride <cwatsoncam.org> wrote:
    >
    > > Am I the only one that wishes there was a ~/Library/LoginItems that
    > > could contain aliases of items to run at login? Like the OS 9 startup
    > > items folder.
    >
    > No, but AppleScripting this is easy enough too.
    FWIW, Apple doesn't recommend that approach because of current bugs.

    <[url]http://lists.apple.com/archives/cocoa-dev/2003/Sep/20/loginitems.002.txt[/url]
    >
    Jim
    Jim Correia Guest

  9. #9

    Default Re: Starting a Carbon application at user login

    In article <210920031117073337%osxNOSPAMjwwalker.com.invalid >,
    "James W. Walker" <osxNOSPAMjwwalker.com.invalid> wrote:
    > In article <macdev-9B9464.13585821092003senator-bedfellow.mit.edu>,
    > Miro Jurisic <macdevmeeroh.org> wrote:
    >
    > > No, but AppleScripting this is easy enough too.
    >
    > As far as I know, the AppleScript approach was not doented and will
    > not work under Panther.
    Why not? I'd expect a login item that's an AppleScript application that
    opens everything in ~/Library/LoginItems to work just fine without extra
    doentation and without regard to OS changes. If it doesn't, that
    sounds like an important bug....

    -Eric

    --
    Eric Albert [email]ejalbertstanford.edu[/email]
    [url]http://rescomp.stanford.edu/~ejalbert/[/url]
    Eric Albert Guest

  10. #10

    Default Re: Starting a Carbon application at user login

    In article <ejalbert-9D409B.15012721092003news.stanford.edu>, Eric
    Albert <ejalbertstanford.edu> wrote:
    > In article <210920031117073337%osxNOSPAMjwwalker.com.invalid >,
    > "James W. Walker" <osxNOSPAMjwwalker.com.invalid> wrote:
    >
    > > In article <macdev-9B9464.13585821092003senator-bedfellow.mit.edu>,
    > > Miro Jurisic <macdevmeeroh.org> wrote:
    > >
    > > > No, but AppleScripting this is easy enough too.
    > >
    > > As far as I know, the AppleScript approach was not doented and will
    > > not work under Panther.
    >
    > Why not? I'd expect a login item that's an AppleScript application that
    > opens everything in ~/Library/LoginItems to work just fine without extra
    > doentation and without regard to OS changes. If it doesn't, that
    > sounds like an important bug....
    No, I believe that Miro Jurisic was referring to a technique of
    defining a login item that involves using AppleScript to talk to the
    System Events application. But I could be mistaken.
    James W. Walker Guest

  11. #11

    Default Re: Starting a Carbon application at user login

    In article <210920031823530134%osxNOSPAMjwwalker.com.invalid >,
    "James W. Walker" <osxNOSPAMjwwalker.com.invalid> wrote:
    > In article <ejalbert-9D409B.15012721092003news.stanford.edu>, Eric
    > Albert <ejalbertstanford.edu> wrote:
    >
    > > In article <210920031117073337%osxNOSPAMjwwalker.com.invalid >,
    > > "James W. Walker" <osxNOSPAMjwwalker.com.invalid> wrote:
    > >
    > > > In article <macdev-9B9464.13585821092003senator-bedfellow.mit.edu>,
    > > > Miro Jurisic <macdevmeeroh.org> wrote:
    > > >
    > > > > No, but AppleScripting this is easy enough too.
    > > >
    > > > As far as I know, the AppleScript approach was not doented and will
    > > > not work under Panther.
    > >
    > > Why not? I'd expect a login item that's an AppleScript application that
    > > opens everything in ~/Library/LoginItems to work just fine without extra
    > > doentation and without regard to OS changes. If it doesn't, that
    > > sounds like an important bug....
    >
    > No, I believe that Miro Jurisic was referring to a technique of
    > defining a login item that involves using AppleScript to talk to the
    > System Events application. But I could be mistaken.
    You are right. Thanks for the heads-up for Panther.

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Jurisic Guest

  12. #12

    Default Re: Starting a Carbon application at user login

    In article <macdev-CFDF11.21384221092003senator-bedfellow.mit.edu>,
    Miro Jurisic <macdevmeeroh.org> wrote:
    > You are right. Thanks for the heads-up for Panther.
    Actually, looks like I was wrong. Maybe it wasn't in some earlier
    version of Panther, but it's there now.
    James W. Walker Guest

  13. #13

    Default Re: Starting a Carbon application at user login

    Thanks to everybody, I'm sorry for the late reply.

    Eric, I think you are right, this is not the best approach.

    I can't use the Login Items option, because this application will run
    in several machines and I can't to install it for each user. Besides,
    I can't ask for user permission because the app must to run silently.
    Remember that it is a tracking app.

    I think I should to consider the CoreServices option. I have just one
    doubt, can I catch events when an application brings to front with the
    CoreServices framework? Because I'm now using CarbonEvents and
    installing the event handlers with the "InstallEventHandler" option
    and it is not available with CoreServices.

    Regards ...!


    Eric Albert <ejalbertstanford.edu> wrote in message news:<ejalbert-F59808.00105920092003news.stanford.edu>...
    > In article <4beb34a4.0309191156.24534c00posting.google.com >,
    > [email]rgasparini29[/email] (Jorge) wrote:
    >
    > > Well, I found information in apple website to create a login script
    > > (LoginHook), this is at:
    > >
    > > [url]http://developer.apple.com/doentation/MacOSX/Conceptual/SystemOverview/Boot[/url]
    > > ingLogin/chapter_4_section_4.html
    >
    > Wow...I can't believe that's doented. Please don't do that. It's
    > really not the right way to do what you're trying. Just modify your app
    > to link against CoreServices instead of Carbon and make it a startup
    > item, or keep it linking against Carbon and put it in every user's login
    > items.
    >
    > -Eric
    Jorge Guest

Similar Threads

  1. user and admin login on same login page
    By davellaman in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: May 16th, 07:47 PM
  2. Help with starting XFce4 from KDM login
    By 4seasonphoto in forum Linux Setup, Configuration & Administration
    Replies: 3
    Last Post: July 20th, 12:25 PM
  3. Concept behind ASP.NET user LOGIN application?
    By omar in forum ASP.NET General
    Replies: 3
    Last Post: July 13th, 07:45 AM
  4. how to write carbon application
    By deedi in forum Mac Programming
    Replies: 1
    Last Post: July 7th, 02:26 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