Hi,

I am looking at desktop icons and want to delete only icons that meet a
criteria of having a specific value in the "Start in" property. Currently,
I'm only looking to display those names that meet this requirement, but I've
come across a roadblock. I can't even figure out how to extract that
property or even if it's possible. I have the following code:

Const ALL_USERS_DESKTOP = &H19&

Set objApp = CreateObject("Shell.Application")
Set objShell = Wscript.CreateObject("WScript.Shell")
Set objFolder = objApp.Namespace(ALL_USERS_DESKTOP)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path

Set colItems = objFolder.Items
For Each objItem In colItems
sResult = sResult & " " & objItem.TargetPath & vbCrLf
Next
wScript.Echo sResult

Does anyone have a suggestion?

Thanks in Advance,
JeffH

Re: Desktop icons by Bart

Bart
Mon May 08 11:02:09 CDT 2006

I took a little bit different approach to what you are trying to accomplish
but maybe this can help. However, I have not used the .TargetPath property.

This script says that for every folder in the documents and settings folder
(I am assuming it is on the C drive), look at the files in the \Desktop\
folder. If the file name meets one of two conditions, set the .Name
property.

I think you could say that for every object in the \Desktop\ folder, what is
the value of the .TargetPath property.

Although this is not a copy/paste version of what you need, you could make
some short edits to accomodate your intention - watch out for word wraps.

I hope this helps.

Bart Perrier

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Error Resume Next

Dim computerName, objFSO, rootDrive, ProfileLocation, objNetwork,
objFolder, objDesktopFolder, objFile, objShortcut

Const displaymessage = False

Set objNetwork = CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")

computerName = objNetwork.computerName


If objFSO.FolderExists("c:\Documents and Settings") Then
Set objFolder = objFSO.GetFolder("c:\Documents and Settings")
Call DisplayError("Set objFolder = objFSO.GetFolder(c:\Documents and
Settings)")
Set colSubFolders = objFolder.SubFolders
For Each objSubFolder In colSubFolders
Set objDesktopFolder = objFSO.GetFolder("c:\Documents and Settings\" &
objSubFolder.Name & "\Desktop\")
Call DisplayError("Set objDesktopFolder = objFSO.GetFolder(c:\Documents
and Settings\ & objSubFolder.Name & \Desktop\)")
Set colFiles = objDesktopFolder.Files

For Each objFile In colFiles
If (UCase(objFile.name) = UCase("Physician Orders.lnk")) Or
(Ucase(objFile.name) = UCase("Copy of Physician Orders.lnk")) Then
Set objShortcut = objFSO.GetFile(objFile.Path)
Call DisplayError("Set objShortcut = objFSO.GetFile(objFile.Path)")
objShortcut.Name = "Physician Orders and Consents.lnk"
Call DisplayError("objShortcut.Name = Physician Orders and
Consents.lnk")
End If
Next
Next
End If


'''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''' Functions and Subroutines '''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''

' echo a line -- used in testing
Sub EchoThis(tmp)
WScript.Echo (tmp)
End Sub


' Displays and error is err.number <> 0
' resets err.number after displaying the Error
' Call DisplayError
Sub DisplayError(referringCall)
If displaymessage = True Then
If Err.Number <> "0" Then
MsgBox "referringCall: '" & referringCall & "'" & VbCrLf & VbCrLf & _
"Error Number: " & Err.Number & VbCrLf & _
"Error Description: " & Err.Description & VbCrLf & VbCrLf & VbCrLf & _
"Exiting Script"
Err.Clear
WScript.Quit
End If
End If
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

"JeffH" <not@microsoft.com> wrote in message
news:eGe$GuqcGHA.3344@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> I am looking at desktop icons and want to delete only icons that meet a
> criteria of having a specific value in the "Start in" property.
Currently,
> I'm only looking to display those names that meet this requirement, but
I've
> come across a roadblock. I can't even figure out how to extract that
> property or even if it's possible. I have the following code:
>
> Const ALL_USERS_DESKTOP = &H19&
>
> Set objApp = CreateObject("Shell.Application")
> Set objShell = Wscript.CreateObject("WScript.Shell")
> Set objFolder = objApp.Namespace(ALL_USERS_DESKTOP)
> Set objFolderItem = objFolder.Self
> Wscript.Echo objFolderItem.Path
>
> Set colItems = objFolder.Items
> For Each objItem In colItems
> sResult = sResult & " " & objItem.TargetPath & vbCrLf
> Next
> wScript.Echo sResult
>
> Does anyone have a suggestion?
>
> Thanks in Advance,
> JeffH
>
>



Re: Desktop icons by JeffH

JeffH
Wed May 10 08:14:47 CDT 2006

Hi,

This may sounds like a silly question, but is there a way that I can obtain
all of the properties and methods that are available to an object. I know
in programming languages like vb you can see these via the IDE in the
compiler. Is there some program that I can run in the OS to show these
items?

Thanks in Advance,
JeffH



Re: Desktop icons by Bart

Bart
Wed May 10 16:38:17 CDT 2006

I don't reference a complete list so I'm not sure if there is one.

I use PrimalScript and as long as I declare the Object, it will show me the
available methods/properties. However, it does not show me the methods and
properties when I instantiate a Win32 Class. The MSDN site has this
informaiton for these classes. Here is an example.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp

Hope this helps.

Bart


"JeffH" <not@microsoft.com> wrote in message
news:eXor4ODdGHA.4312@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> This may sounds like a silly question, but is there a way that I can
obtain
> all of the properties and methods that are available to an object. I know
> in programming languages like vb you can see these via the IDE in the
> compiler. Is there some program that I can run in the OS to show these
> items?
>
> Thanks in Advance,
> JeffH
>
>