You can launch osascript by way of StartupItems, but of security, you will have to do lotsa maunal work. Run the following script:'
--begin
set nl to ASCII character 10
set _name to text returned of (display dialog "Name of Startup Item:" default answer "")
tell application "Finder"
try
set new_folder to (make new folder at desktop with properties {name:_name}) as string
end try
end tell
set shell_contents to "#!/bin/sh" & nl & nl & "/usr/bin/osascript "
do shell script "/bin/echo " & quoted form of shell_contents & " > " & quoted form of (POSIX path of (new_folder & _name))
set plist_contents to "{" & "
Description = \"" & _name & "\";" & nl & "}"
do shell script "/bin/echo " & quoted form of plist_contents & " > " & quoted form of (POSIX path of (new_folder & "StartupParameters.plist"))
--end
it'll prompt for the Startup Item name.
<folder name>
it'll create a folder on your desktop with specified name, the folder contains two text files.
leave the StartupParameters.plist alone, you need to edit the
other file
open
other file with TextEdit, you find:
#!/bin/sh
/usr/bin/osascript
you have to append
POSIX path of your script in quoted form to after /usr/bin/osascript . ie: /usr/bin/osascript '/blah/blah blah'
move (copy) the folder to '/Library/StartupItems/' folder
now you have to chmod and chown for the folder, in Terminal:
sudo chmod -R 755 /Library/StartupItems/
<folder name>
sudo chown -R root:wheel /Library/StartupItems/
<folder name>