Scripts Thread, Script to pin/unpin items to/from Start Menu in Win7/2k8r2? in Coding and Web Development; Hi everyone, hoping there's someone who could help me out.
Trying SO hard to get this to work, but it's ...
-
27th January 2012, 12:16 PM #1 Script to pin/unpin items to/from Start Menu in Win7/2k8r2?
Hi everyone, hoping there's someone who could help me out.
Trying SO hard to get this to work, but it's a little bit beyond me.
Given that there's no policy to set the pinned start menu icons for windows 7 in gp (oh *deity* why not??!?!?!) I started looking for scripts as Angry Technician suggested.
Found a cracking one I thought I'd modify:
Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
Set objShell = CreateObject("Shell.Application")
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Accessories")
Set objFolderItem = objFolder.ParseName("Calculator.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next
...And success! I've now got a calculator shortcut where I want it! But, when I change it to the following (to try and get paint in there) it doesn't work:
Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
Set objShell = CreateObject("Shell.Application")
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Accessories")
Set objFolderItem = objFolder.ParseName("Paint.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next
Is there any way to change this script so I can put any shortcut in there? Can I also put in shortcuts that aren't in accessories? I'm no whiz with scripts so please be kind!
Thanks folks.
-
-
IDG Tech News
-
27th January 2012, 03:16 PM #2 
Originally Posted by
Miscbrah
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
This section says use the All Users Start menu.
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Accessories")
And within that the Accessories folder, so for a folder in All Users start menu called bob, you'd want
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\bob")
And for something in the top level of the start menu, just
Set objFolder = objShell.Namespace(strAllUsersProgramsPath)
To check you have the shortcut in the All Users right click on All Programs and choose Open All Users, some shortcuts might be default user ones copied to each user's profile, but Paint doesn't seem to be one of them, odd
-
-
27th January 2012, 03:22 PM #3
- Rep Power
- 0
I just copied the bottom script (for paint) into notepad, saved as a .vbs and ran it. I now have Paint pinned to my Start Menu (Thanks for that :P ), so I have no idea why you cannot get it working.
Did you try it on its own, or just as an extension of the script that adds Calculator?
-
-
27th January 2012, 03:28 PM #4
-
-
27th January 2012, 03:54 PM #5

...It's because I was copying the
Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
bit as well. It works fine if I don't do that.
Bleergh.
-
-
27th January 2012, 04:16 PM #6 Ah, you were doing them all in 1 script then?
You'd only need, for the 2nd/3rd/etc times to have
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Accessories")
Set objFolderItem = objFolder.ParseName("Paint.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next
-
SHARE:
Similar Threads
-
By Gilleen in forum Windows 7
Replies: 13
Last Post: 17th October 2011, 10:02 AM
-
By MaXiM in forum Windows 7
Replies: 3
Last Post: 18th May 2011, 02:11 PM
-
By Mr.Ben in forum Windows
Replies: 5
Last Post: 11th April 2011, 02:47 PM
-
By FN-GM in forum Windows
Replies: 7
Last Post: 30th March 2011, 11:06 PM
-
By FN-GM in forum How do you do....it?
Replies: 11
Last Post: 21st June 2008, 12:03 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules