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,$dothis,$i
$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
$objShell=CreateObject("Shell.Application")
$objFolder=$objShell.Namespace($path)
$objFolderItem=$objFolder.ParseName($shortcut)
$colVerbs=$objFolderItem.Verbs
for each $objVerb In $colVerbs
if instr(@producttype,"Windows 7") and ($action="" or $action="Taskbar")
for $i=0 to ubound($languages)
if split($languages[$i],",")[1]=join(split($objVerb.name,'&'),'')
$dothis=join(split($objVerb.name,'&'),'')
$location="\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\" + $shortcut
$objVerb.DoIt
endif
next
else
for $i=0 to ubound($languages)
if split($languages[$i],",")[2]=join(split($objVerb.name,'&'),'')
$dothis=join(split($objVerb.name,'&'),'')
$location="\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\" + $shortcut
$objVerb.DoIt
endif
next
endif
next
if $dothis and $location
if exist($objShell.Namespace(26).self.path + $location)
$PinTo=0
else
exit 82
endif
else
exit 1815
endif
endFunction