MAC OS - Adding Dock icon (part 5)?

Comments

10 comments

  • Avatar
    michiel

    Hi,

    Could you run the installer with the `--debugtrace debug.txt` option and send us the debug.txt file to support@bitrock.com? For example:

    `/Path/to/installer.app/Contents/MacOs/installbuilder.sh --debugtrace debug.txt`

    Regards,

    Michiel

    0
    Comment actions Permalink
  • Avatar
    Codename K

    Hello,

    Thanks for your reply. The answer given in this link seems to be working. But it only works if it is in AppleScript. So I created an AppleScript and saved it as APP file. When this file is run through the installer I get this error shown in below image. But when the AppleScript APP file is run manually it works fine and creates the Dock icon. How to fix this?

    0
    Comment actions Permalink
  • Avatar
    michiel

    Hi,

    Can you share the snippet where you execute the Applescript, and also the command you are running manually?

    Regards,

    Michiel

    0
    Comment actions Permalink
  • Avatar
    Codename K

    Hello,

    This is the code,

    <postInstallationActionList>
    <runProgram>
    <abortOnError>0</abortOnError>
    <program>${installdir}/myApp.app/⁨Contents/⁨MacOS⁩/applet</program>
    <programArguments></programArguments>
    <run>0</run>
    <show>0</show>
    </runProgram>
    </postInstallationActionList>

    And this is the AppleScript code from apple.stackexchange.com,

    my add_item_to_dock("/Applications/myAppFolder/myApp.app")
    on add_item_to_dock(item_path)
    try
    get item_path as alias -- you need a POSIX path so this coerces the path in case it's an HFS path, alias, file ref, etc.
    set item_path to POSIX path of item_path
    end try
    try
    tell application "Dock" to quit
    end try
    do shell script "defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" & item_path & "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'"
    try
    tell application "Dock" to activate
    end try
    end add_item_to_dock

     

    0
    Comment actions Permalink
  • Avatar
    michiel

    Hi,

    You need to run the script with osascript:

    <postInstallationActionList>
    <runProgram>
    <abortOnError>0</abortOnError>
    <program>osascript</program>
    <programArguments>${installdir}/myApp.app/⁨Contents/⁨MacOS⁩/applet</programArguments>
    </runProgram>
    </postInstallationActionList>

    Regards,

    Michiel

    0
    Comment actions Permalink
  • Avatar
    Codename K

    Hello,

    Sorry for the delay in reply.

    But I found the issues I was facing. The reason I got this message,

    when trying to run an AppleScript application from the installer is this: I right-clicked on the applet program and selected Get Info menu item. Then copied the folder path text from the Get Info dialog and pasted it in the BitRock InstallBuilder. It seems this added some other characters which did not show in the InstallBuilder's text boxes or any text editors in macOS. So I manually typed the path name in the InstallBuilder and it worked.

    Also as for adding the application icon to the Dock, this code worked in InstallBuilder,

    <runProgram> <program>defaults</program> <programArguments>write com.apple.dock persistent-apps -array-add ' &lt;dict&gt; &lt;key&gt;tile-data&lt;/key&gt; &lt;dict&gt; &lt;key&gt;file-data&lt;/key&gt; &lt;dict&gt; &lt;key&gt;_CFURLString&lt;/key&gt; &lt;string&gt;${installdir}/your.app&lt;/string&gt; &lt;key&gt;_CFURLStringType&lt;/key&gt; &lt;integer&gt;0&lt;/integer&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/dict&gt;' </programArguments> </runProgram> <runProgram> <program>killall</program> <programArguments>-HUP Dock</programArguments> </runProgram>

    But this only works if the installer is run without admin. The above code does not work if run as admin.This is in macOS Mojave and Catalina. How to run as admin and add the Dock icon? Running as admin is required sometimes when installing to Applications folder.

    Regards

    0
    Comment actions Permalink
  • Avatar
    BitRock support

    Hi,

    Could you contact us at bitrock@support.com with this issue? We will continue helping you from there.

    Regards,

    Michiel

    0
    Comment actions Permalink
  • Avatar
    Codename K

    Hello,

    I got this message when trying to send the email,

    -----------------------------------------------------------------

    Delivery has failed to these recipients or groups:

    bitrock@support.com (bitrock@support.com)
    The e-mail address you entered couldn't be found. Please check the recipient's e-mail address and try to resend the message. If the problem continues, please contact your helpdesk.

    -----------------------------------------------------------------

    Regards

    0
    Comment actions Permalink
  • Avatar
    BitRock support

    Hi, 

    Please accept my sincere apologies for giving the wrong email address. It should be support@bitrock.com

    Regards,

    Michiel

     

    0
    Comment actions Permalink
  • Avatar
    Codename K

    Thank you.

    0
    Comment actions Permalink

Please sign in to leave a comment.