Sign in to follow this  
Followers 0

Autoit to unpin icons on taskbar

2 posts in this topic


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(, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
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

Share this post

Link to post
Share on other sites

Posted (edited)

I just found an easier way to unpin the icons from the desktop by running these simple commands:


Edited by tcox8

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.