[Windows 7] Pin a program to the superbar
I finally found a way to pin exe files to the windows 7 superbar, so I share my method :) .
First, I made this little vbsript (Pin.vbs).
Set objShell = CreateObject("Shell.Application")
set filesystem = CreateObject("scripting.Filesystemobject")
Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(1)))
Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(1)))
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Wscript.Arguments(0) = "pin" and Replace(objVerb.name, "&", "") = "Pin to taskbar" then
objVerb.DoIt
else
If Wscript.Arguments(0) = "unpin" and Replace(objVerb.name, "&", "") = "Unpin from taskbar" Then
objVerb.DoIt
end if
end if
Next
And I made this two very little functions :
Function PinToTaskbar
SetOutPath $TEMP
File pin.vbs
ExecWait "cscript /b /nologo $TEMP\pin.vbs pin $0"
delete pin.vbs
FunctionEnd
Function UnpinFromTaskbar
SetOutPath $TEMP
File pin.vbs
ExecWait "cscript /b /nologo $TEMP\pin.vbs unpin $0"
delete pin.vbs
FunctionEnd
Usage :
StrCpy $0 '"$PROGRAMFILES32\Mozilla Firefox\Firefox.exe"'
call PinToTaskbar
(same with UnpinFromTaskbar)
Feel free to improve this and, of course, reuse it if you need :).
Note: "Pin to taskbar" and "Unpin from taskbar" may vary with windows language. I only check this on english and french language.
You can find the good strings with this little script :
Set objShell = CreateObject("Shell.Application")
set filesystem = CreateObject("scripting.Filesystemobject")
Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(0)))
Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(0)))
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
Wscript.Echo objVerb
Next