Alternative to additemtodock from Henri Shustak I am using a commandline script to add items to the dock via scripts

http://www.macupdate.com/app/mac/23653/add-item-to-dock

But it seems to have a lot of bugs and maybe even "kills" my Dock config file. Are there any good alternatives out there to add *.app properly to the dock ?
Open Applications / Utilities / AppleScript Editor and paste this:

my add_item_to_dock(choose file of type {"APPL"} with prompt "Choose an application to add to the Dock:")
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 '&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;" &amp; item_path &amp; "&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;'"
    try
        tell application "Dock" to activate
    end try
end add_item_to_dock


Save it as Script or Application.