Here is an example on how to add a program to a user's login items under OSX. I wrote this script for use with an installation program that I put together using a combination of REALbasic, some C++ plugins, and some Applescript.
To use prepare it per the Notes section below. To use it in an RB application just call osxAddToLoginItems(full_path_to_appliation).
(*
File: osxAddToLoginItems.applescript
Author: G. Tillman
Project: PerformancePower Installer
Purpose: Script the processing of adding a Login Item under OSX to the
User's Login Items System Preference
History: 0001-20030109 (got) initial creation
0002-20030126 (got) improved script. checks to see if app is alread in startup
items before adding it.
Notes: This file is the source. After saving it do a save as "application", using the
same name but w/o the ".applescript" extension. drag and drop this saved
application into the rb project window.
*)
on run {appPath}
tell application "System Events"
set thePath to ""
set foundApp to false
repeat with lItem in login items
set thePath to (the path of lItem)
if appPath contains thePath then
set foundApp to true
end if
end repeat
if not foundApp then
(* add it to the startup items... *)
make new login item at end of login items with properties {path:appPath}
end if
end tell
end run