@leo:
Thanks for your hints.
I now got it working although I couldn't get it working with the whole Script in the Button.
Simply adding the Standard Lines used to abuse Rename Scripts (Rename TO="*" and the Script-Function stuff) doesn't work.
It's good enough for me with the .vbs-file.
Here's the working Script:
CopyShortcutTarget.vbs[code] Option Explicit
Dim ARG()
Dim ARGS()
Dim i
Dim f
Dim FileName
Dim FilePath
Dim FolderName
Dim FolderPath
Dim fExt
Dim fExtb
Dim ifExt
Dim oSHLink
Dim target
Dim WShell
Set WShell = Wscript.CreateObject("Wscript.Shell")
Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
For i = 0 to Wscript.Arguments.Count - 1
'Enumerate the collection and provide details of each item
Redim Preserve ARG(i)
ARG(i) = Wscript.Arguments(i)
'Obviously there are various ways to handle looking at the filesystem object properties...
fExt = Fs.GetExtensionName(ARG(i))
IF fExt = "" THEN
Set f = fs.GetFolder(ARG(i))
FolderName=f.Name
FolderPath=f.Path
ELSE
Set f = fs.GetFile(ARG(i))
FileName=f.Name
FilePath=f.Path
End IF
'Transform List-Item Links into their actual targets
fExt = Fs.GetExtensionName(ARG(i))
ifExt = StrComp(fExt, "LNK", vbTextCompare)
IF ifExt = 0 THEN
set oSHLink = Wshell.CreateShortcut(FilePath)
target = oSHLink.TargetPath
fExtb = Fs.GetExtensionName(oSHLink.TargetPath)
IF fExtb = "" THEN
Set f = fs.GetFolder(oSHLink.TargetPath)
ELSE
Set f = fs.GetFile(oSHLink.TargetPath)
End IF
End IF
'Recreate a new collection containing all hard targets (no links)
Redim Preserve ARGS(i)
ARGS(i) = f
Next
' Now send this off to "dopusrt.exe"
WShell.Run """C:\Programme\Directory Opus\dopusrt.exe"" /cmd Copy TO={destpath} """ & Join(ARGS,""" """)
'Next
Set oSHLink = Nothing
Set fs = Nothing
Set WShell = Nothing
Wscript.Quit
[/code]
To call the file from a Button use this:@nodeselect
Yourpath\CopyShortcutTarget.vbs {filepath}