#region - Mozilla Sunbird install script - (Nullsoft)
#include <Common_Functions.au3>
Opt('TrayIconDebug', 1)
Break(False)

; Installer.
$executable = 'Mozilla Sunbird 0.3.1.exe'
; Default group folder in startmenu.
$group = 'Mozilla Sunbird'
; Installation folder in Program Files.
$directory = '?'

; Run the installer.
$pid = _Custom()
ProcessWaitClose($pid)

; Remove shortcuts.
If _Programs('Mozilla Sunbird.lnk') Then
    FileMove($group & '\Mozilla Sunbird.lnk', 'General\', 9)
    DirRemove($group, 1)
EndIf
_Desktop('Mozilla Sunbird.lnk')
_QuickLaunch('Mozilla Sunbird.lnk')

Exit
#endregion

Func _Custom($parameters = Default)
    ; Run a Custom Installer  with Default: -ms.
    Dim $executable
    If $parameters = Default Then
        $parameters = '-ms'
    EndIf
    If Not FileExists($executable) And Not FileExists(@ScriptDir & '\' & $executable) Then
        Exit 1
    ElseIf Not FileExists($executable) Then
        FileChangeDir(@ScriptDir)
    EndIf
    Return Run('"' & @WorkingDir & '\' & $executable & '" ' & $parameters)
EndFunc