Applescript startup item

Discussion in 'Mac Programming' started by nomar383, Jan 12, 2010.

  1. nomar383 macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #1
    Okay, so I have written an applescript that basically launches opera in kiosk mode and then enters a keystroke command. This works fine on its own and if I drag it into my login items, it even launches at login as I would expect.

    Now the trouble:

    I am working on an installer and this applescript needs to automatically be added to the users startup items at some point during the package install. I have been able to get it copied to /Library/StartupItems (with correct permissions even), but it will not launch at login as I would expect. What am I missing?
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    You should just add it to a folder such as ~/Library/Application Support/etc if you only need it for the current user.

    The login items list can be modified various ways, but assuming you only know AppleScript you can still use AS to modify it:
    http://macstuff.beachdogs.org/blog/?p=30
     
  3. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #3
    That looks like it will do nicely, now how can I run it during a PackageMaker install? I tried adding a similar post-install applescript, but couldn't get it working.

    Thanks so much for your input
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Probably can use osascript to run the script in your postflight script. Search Apple's documentation for info on how to use this.
     
  5. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #5
    Okay, I have my postflight script written and it works perfectly when I run it after the package install, but only runs half of the commands properly when it runs as part of the installation. How do I make the script run after EVERYTHING else has been completed in the package installation (including component registration)?
     
  6. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #6
    In case anyone later runs across this thread, I ended up making a post install applescript to include in my DMG. I instruct the user after my installation to just double click on the included applescript. Worked for me.

    And the login item instructions posted earlier worked perfectly.
     

Share This Page