Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Autoit to unpin icons on taskbar


  • Please log in to reply
1 reply to this topic

#1 tcox8

tcox8

    Seeker

  • Active Members
  • 32 posts

Posted 24 August 2011 - 02:41 PM

Hello all,

I'm having a problem trying to use COM to remove the icons from the taskbar (unpin from taskbar) in Windows 7. Here is the source of the .vbs script I have found online that does the same thing:

Set objShell = CreateObject("Shell.Application") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU) strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS) strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path '''''''''''''''''''''''''''''''''''''''Unpin Shortcuts''''''''''''''''''''''''''''''''''''''' 'Internet Explorer If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Internet Explorer.lnk") Then Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs") Set objFolderItem = objFolder.ParseName("Internet Explorer.lnk") Set colVerbs = objFolderItem.Verbs For Each objVerb in colVerbs If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt Next End If



Here is what I have so far. Using the error handler out of the AutoIt help file I know that I am not receiving any COM errors, but nothing seems to happen after running this:

$UsrProf = @AppdataDir & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar" $Shell = ObjCreate("shell.application") ;Let's get the Windows Shell Object If FileExists($UsrProf & "\Windows Explorer.lnk") Then     $objFolder = $Shell.Namespace(@StartMenuDir & "\Programs\Accessories")     $objFolderItem = $objFolder.ParseName("Windows Explorer.lnk")     $objFolderItem.InvokeVerb("Unpin from Taskbar")     if $g_eventerror then Msgbox(0,"","the previous line got an error.") ;This goes to the AutoIt help file error handler EndIf

"There are only 10 types of people in the world: Those who understand binary, and those who don't"







#2 tcox8

tcox8

    Seeker

  • Active Members
  • 32 posts

Posted 24 August 2011 - 04:57 PM

I just found an easier way to unpin the icons from the desktop by running these simple commands:
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband","Favorites","REG_BINARY","0xFF") RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband","FavoritesResolve") processclose("explorer.exe")

Edited by tcox8, 24 August 2011 - 04:59 PM.

"There are only 10 types of people in the world: Those who understand binary, and those who don't"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users