Function PinTo($Shortcut, optional $Action)
dim $Languages[2]
$Languages[0]="0409English,Pin to Taskbar,Pin to Start Menu"
$Languages[1]="0407German,An Taskleiste anheften,An Startmenü anheften"
$Languages[2]="040CFrench,Épingler à la barre des tâches,Épingler au menu Démarrer"
dim $path,$objshell,$objfolder,$objFolderitem,$colverbs,$objverb,$location,$langid
$PinTo=1
if not right($shortcut,3)="lnk"
$shortcut=$shortcut + ".lnk"
endif
if exist($shortcut)
if getfileattr($shortcut) & 16
exit 87
else
$path=left($shortcut,instrrev($shortcut,"\"))
$shortcut=right($shortcut,-instrrev($shortcut,"\"))
endif
else
exit 2
endif
$langid=ascan($languages,@userlang,,,1)
if $langid>-1
if instr(@producttype,"Windows 7") and ($action="" or $action="Taskbar")
$action=split($languages[$langid],",")[1]
$location="\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\" + $shortcut
else
$action=split($languages[$langid],",")[2]
$location="\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\" + $shortcut
endif
else
exit 1815
endif
$objShell=CreateObject("Shell.Application")
$objFolder=$objShell.Namespace($path)
$objFolderItem=$objFolder.ParseName($shortcut)
$colVerbs=$objFolderItem.Verbs
for each $objVerb In $colVerbs
if join(split($objVerb.name,'&'),'')=$action
$objVerb.DoIt
if exist($objShell.Namespace(26).self.path + $location)
$PinTo=0
else
exit 82
endif
endif
next
endFunction