Rename FILEINFO TO "P_{parent}|W_{picwidth}|H_{picheight}" @script vbscript Option Explicit Dim strUrlPrefix strUrlPrefix = "http://myaddress/shared/" Dim destinationDir destinationDir = "c:\htdocs\shared\" Dim fUseSetClip fUseSetClip = False ' Where to find SetClip.exe, if you have it at all. Only used if fUseSetClip is True. Dim strSetClipPath strSetClipPath = "C:\Windows\System32\SetClip.exe" ' Where to find DOpusRT.exe, the command used to set the clipboard if fUseSetClip is False. Dim strOpusHomePath strOpusHomePath = "C:\Program Files\GPSoftware\Directory Opus\DOpusRT.exe" Dim strClip strClip = "" Dim Shell Set Shell = CreateObject("WScript.Shell") Function Rename_GetNewName(strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName) Dim strInfoArray Dim name Dim value Dim x Dim strParent Dim strWidth Dim strHeight ' The strNewName we're given should be something like "W_640|H_480" ' We split this into an array of words, e.g. "W_640", "H_480" strInfoArray = split(strNewName, "|") ' Set strNewName to an empty string so that Opus does not rename the file. strNewName = "" ' Get the information we expect from the strInfoArray strWidth = "" strHeight = "" strParent = "" if fUseSetClip then if strClip = "" then ' Empty the clipboard if this is the first file. We'll append each line using "SetClip.exe -a". Shell.Run """SetClip.exe"" -e",0,True else strClip = "" end if else if strClip <> "" then ' Build up each line in the strClip variable, with a return (vbCrLf) between each line. strClip = strClip & vbCrLf end if end if 'strClip = strClip & "" 'strClip = strClip & strUrlPrefix & escape(strFileName) ' Rename if file already exists 'DOpus.OutputString destinationDir & strFileName Dim filesys Set filesys = CreateObject("Scripting.FileSystemObject") Dim counter counter=0 Dim newName newName=strFileName While filesys.FileExists(destinationDir & newName) or filesys.FolderExists(destinationDir & newName) Dim partialName partialName=split(strFileName, ".") newName="" if ubound(partialName)>0 then for x = lbound(partialName) to ubound(partialName)-1 if newName<>"" then newName=newName & "." end if newName=newName & partialName(x) Next newName=newName & counter & "." & partialName(ubound(partialName)) else newName=partialName(0) & counter end if counter=counter+1 Wend 'DOpus.OutputString newName strClip = strClip & strUrlPrefix & newName strClip = Replace(strClip, " ", "%20") if fUseSetClip then ' We need to double-up all "-characters in the string if we're using SetClip.exe strClip = """" & Replace(strClip, """", """""") & """" ' Set the clipboard via SetClip.exe Shell.Run """SetClip.exe"" -a -- " & strClip,0,True else ' Set the clipboard via Opus. Shell.Run """" & strOpusHomePath & """ /CMD Clipboard Set " & strClip,0,True end if 'DOpus.OutputString """" & strOpusHomePath & """ /CMD Copy File """ & strFilePath & strFileName & """ To """ & destinationDir & """ As """ & newName & """" Shell.Run """" & strOpusHomePath & """ /CMD Copy File """ & strFilePath & strFileName & """ To """ & destinationDir & """ As """ & newName & """" End Function