Using a package to distribute LC app over ARD

Mark Talluto userev at canelasoftware.com
Thu Apr 17 14:21:39 EDT 2014


On Apr 17, 2014, at 4:49 AM, Richard Miller <wow at together.net> wrote:

> I am using Iceberg to create a Mac installer package which contains my LC app. This package is then being used by Apple Remote Desktop to automatically install to multiple Mac's. These Mac's are generally in a logged-out state during the install. All of this works fine, except for this last piece.
> 
> After the install, I need to add my app to the users list of Startup items. I know Iceberg can run a post-install script. But I'm not sure if it is possible to add to the Startup items list while the Mac is logged out. If it is possible, perhaps someone can help me create the shell script to do this. I know how to do it with AppleScript, but not with a shell script.



Hi Richard,

I may not be able to help you with getting ARD to set up your start up items, but I can tell you the code we use.  You could have your app set this up on first run if you like.

You will want to adjust any reference to Acuity System or patching related specifically to our program.  Here is some code for Windows as well.  I do not have code for Linux unfortunately.

private command addMacAlias
     put "set theAppPath to" && quote & (sk_InstallationPath("bundle") & gSKPathingA["bundleName"] & "/") & quote & lf & \
           "tell application" && quote & "System Events" & quote & lf & \
           "make new login item at end with properties {path:theAppPath}" & lf & \
           "end tell" into tCommand --BUILD THE APPLESCRIPT
     do tCommand as "AppleScript"
end addMacAlias


private command removeMacAlias
     put gSKPathingA["bundleName"] into tAppName
     replace ".app" with empty in tAppName
     
     put "set appToDelete to" && quote & tAppName & quote & lf & \
           "tell application" && quote & "System Events" & quote & lf & \
           "set login_items to name of every login item" & lf & \
           "if appToDelete is in login_items then" & lf & \
           "delete login item appToDelete" & lf & \
           "end if" & lf & "end tell" into tCommand --BUILD THE APPLESCRIPT
     do tCommand as "AppleScript"
end removeMacAlias


private command addWinAlias
     put sk_Installationpath("bundle") & gSKPathingA["bundleName"] into tAppPath
     replace "/" with "\" in tAppPath
     --FOLLOWING VBSCRIPT IS PARTIALLY COURTESY OF SIMON FROM THE RUNREV FORUMS
     --BE VERY CAREFUL WITH *ANY* MODIFICATIONS DUE TO VBSCRIPT BITCHINESS
     put "' Make sure variables are declared." & cr & \
           "  option explicit" & cr & \
           "" & cr & \
           "  ' Routine to create <quote>Acuity System.lnk<quote> on the Windows startup folder." & cr & \
           "  sub CreateShortCut()" & cr & \
           "    dim objShell, strPath, objLink" & cr & \
           "    set objShell = CreateObject(<quote>WScript.Shell<quote>)" & cr & \
           "    strPath = objShell.SpecialFolders(<quote>Startup<quote>)" & cr & \
           "    set objLink = objShell.CreateShortcut(strPath & <quote>\Acuity System.lnk<quote>)" & cr & \
           "    objLink.Arguments = <quote>-skdelay5<quote>" & cr & \
           "    objLink.Description = <quote>Acuity System<quote>" & cr & \
           "    objLink.TargetPath = <quote>" & tAppPath & "<quote>" & cr & \
           "    objLink.WindowStyle = 1" & cr & \
           "    objLink.WorkingDirectory = <quote>" & $HOMEDRIVE & "\windows<quote>" & cr & \
           "    objLink.Save" & cr & \
           "  end sub" & cr & \
           "" & cr & \
           "  ' Program starts running here." & cr & \
           "  call CreateShortCut()" into tScript
     replace "<quote>" with quote in tScript
     do tScript as VBscript
end addWinAlias


private command removeWinAlias
     delete file (specialFolderPath("7") & "/Acuity System.lnk")
end removeWinAlias


Best regards,

Mark Talluto
canelasoftware.com





More information about the use-livecode mailing list