Ok. First, I'd like to say sorry to sviz as I sent this to him & it was probably discombobulated.
Create a new object & drop this whole script in it. Then drag one (only one) shortcut on to it to see how the FSO parses it.
Code: vbscript
- Sub Object_OnDropFiles(files)
- '--Call shell & FSO object
- Set WshShell = CreateObject("WScript.Shell")
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- '--Uses the CreateShortcut Method to retrieve the target Path(s) of the the shortcut
- '--eg. The actual file/folder or application the shortcut points to
- Set oShellLink = WshShell.CreateShortcut(files)
- '--Echos back the full path to respective Target
- msgbox "Path to Application: " & oShellLink.TargetPath
- objFile = oShellLink.TargetPath
- '--Using the comment field as temp storage for file target path
- Object.Comments = objFSO.GetAbsolutePathName(objFile)
- '-- Updates Tooltip & Text Label to Application Name
- Object.ToolTipText = objFSO.GetBaseName(objFile)
- '--Parses Paths using FSO & echoes back
- msgbox "Absolute path: " & objFSO.GetAbsolutePathName(objFile)
- msgbox "Parent folder: " & objFSO.GetParentFolderName(objFile)
- msgbox "File name: " & objFSO.GetFileName(objFile)
- msgbox "Base name: " & objFSO.GetBaseName(objFile)
- msgbox "Extension name: " & objFSO.GetExtensionName(objFile)
- '--Echos back path to Icon
- msgbox "Path to Icon: " & oShellLink.IconLocation
- End Sub
- '--Go to selected target on L-click
- Sub Object_OnLbuttonUp(x,y,dragged)
- Dim appPath
- appPath=object.Comments
- If Not dragged Then
- On Error Resume Next
- Set Sh = CreateObject("WScript.Shell")
- Sh.Run (Chr(34)& appPath & Chr(34))
- Set Sh = Nothing
- End If
- End Sub