Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Pin folder contents to Start Menu

$
0
0

Hello,

I know how to pin a single item to the start menu. I am using the following for a single item:

Function fPinToStart
	Set objShell = CreateObject("Shell.Application")
	Set objFolder = objShell.NameSpace(strPinFrom)
	Set objFolderItem = objFolder.ParseName("google.lnk")
	wscript.echo objFolderItem.Name
	For Each verb In objFolderItem.Verbs()
		wscript.echo verb.name
		If verb.Name = "Pin to Start Men&u" Then
			verb.DoIt()
		End If
	Next
End Function

What I need to do though is take the contents of a folder and pin the contents to the start menu. The reason for this is we have 5 or 6 websites that need to easily be accessed on locked down systems. In order to make them easy to access we want to pin to the start menu. I know I can create 5 or 6 functions but it seems like I should be able to take the contents of a folder and somehow parse that data so that it can run each item separately. I am using the below to read the contents of a folder. Is there a way I can feed it into the above function so that each objFile can be looped through the For Each?

Function fPinToStartFolder
	Set objShell = CreateObject("Shell.Application")
	Set objFolder = objFSO.GetFolder(strPinFrom)
	Set colFiles = objFolder.Files
	For Each objFile in colFiles
		wscript.echo objFile.Name
	Next
End Function

The way I look at it is objShell.NameSpace(strPinFrom) and objFolder.ParseName("google.lnk") need to be dynamic so that fPinToStartFolder can feed the data into fPinToStart one file at a time. Ofcourse the names of the functions are messy. They will change as I get a solution.

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>