User Tools

Site Tools


windows:scripts:pin_to_taskbar

Windows 7/8 Pin to Taskbar

pin_to_taskbar.vbs
Dim arrOfficeArray (4)
Dim arrChromeArray (1)
Dim arrAccessoriesArray (1)
Dim i
 
'Declare constants
Const CSIDL_COMMON_PROGRAMS = &H17 
Const CSIDL_PROGRAMS = &H2
 
'Initialize variables
arrOfficeArray(0) = "Microsoft Office Word 2007.lnk"
arrChromeArray (0) = "Google Chrome.lnk"
arrAccessoriesArray (0) = "Windows Explorer.lnk"
 
'Pin to taskbar - Outlook, Word, Excel, PowerPoint, OneNote, OCS
Set objShell = CreateObject("Shell.Application")
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS) 
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path 
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office")
For i = 0 To 0
	Set objFolderItem = objFolder.ParseName(arrOfficeArray(i)) 
	Set colVerbs = objFolderItem.Verbs 
	For Each objVerb in colVerbs 
	    If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt 
	Next
Next
 
Set objShell = CreateObject("Shell.Application")
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS) 
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path 
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Google Chrome")
For i = 0 To 0
	Set objFolderItem = objFolder.ParseName(arrChromeArray(i)) 
	Set colVerbs = objFolderItem.Verbs 
	For Each objVerb in colVerbs 
	    If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt 
	Next
Next
 
Set objShell = CreateObject("Shell.Application")
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_PROGRAMS) 
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path 
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Accessories")
For i = 0 To 0
	Set objFolderItem = objFolder.ParseName(arrAccessoriesArray(i)) 
	Set colVerbs = objFolderItem.Verbs 
	For Each objVerb in colVerbs 
	    If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt 
	Next
Next
windows/scripts/pin_to_taskbar.txt · Last modified: 2014/01/13 12:23 by tschulz