OK, sorry...
I made changes from line 24 to line 36 only
'//VBScript for TC to select Target for copy on the fly.
'
'
viewtopic.php?p=338700#338700
' Version 1.1 ; 2018-03-06-0900 (added some basic error handling)
'
'//TC-Button:
'//Command: "X:\path\to\ForEachSelectedDO - Kopie to Target.vbs"
'//Parameter: "%L"
'//Icon: C:\windows\System32\WScript.exe,2
'//Tooltip: ForEachSelectedDO - Kopie to Target
'//============================================================================================
Set FSO = CreateObject("Scripting.FileSystemObject")
Set wsArgs = WScript.Arguments
If wsArgs.count > 0 Then
Set strTCTempFile = CreateObject("Scripting.FileSystemObject").OpenTextFile(wsArgs(0), 1)
Else
MsgBox "Error"
Wscript.Quit
End If
'//========== USER SETTINGS
'//InputBox(prompt[, title][, default] ,Xpos,Ypos,HelpFile location, Context in the help file)
intUserTarget = InputBox("Choose target: 1=Angola; 2=Aviation; 3=ClipArt; 4=EBooks; 5=Fonts; 6=FormProf; 7=IT; 8=Ludico; 9=Politica", "TC-Script", 1)
If (intUserTarget = "") Then WSCript.Quit
Select Case intUserTarget
case 1 strTarget = "e:\mediateca\An\"
case 2 strTarget = "e:\mediateca\AV\"
case 3 strTarget = "e:\mediateca\Clipart\"
case 4 strTarget = "e:\mediateca\Ebooks\"
case 5 strTarget = "e:\mediateca\Fonts\"
case 6 strTarget = "e:\mediateca\FP\"
case 7 strTarget = "e:\mediateca\IT\"
case 8 strTarget = "e:\mediateca\Lu\"
case 9 strTarget = "e:\mediateca\Po\"
End Select
'//========== THE CODE
If Not FSO.FolderExists(strTarget) Then
MsgBox "Target not found, script quits." _
& vbLF & vbLF & strTarget & vbLF & vbLF
WSCript.Quit
End If
Do While Not strTCTempFile.AtEndOfStream
strCurrFile = strTCTempFile.ReadLine
If Right(strCurrFile,1) <> "\" then '//no folders
strNew = strTarget &"\"& FSO.GetFileName(strCurrFile)
If Not FSO.FileExists(strNew) Then
'FSO.CopyFile source, destination [,overwriteExisting? True(Default)/False]
FSO.CopyFile strCurrFile, strNew, False
Else
strOUT = strOUT & strCurrFile & vbCRLF
End If
End If
Loop
If (strOUT<>"") Then
strOUT = "Not copied, name already exists in target:" & vbCRLF & vbCRLF & strOUT
MsgBox strOUT
End If
'//============================================================================================
Regards