I select two files:
[ul]
[li]Pete's garden.PDF[/li]
[li]20110723_112302.JPG[/li][/ul]
The script copies the name of the PDF file and renames the JPG file with that name, resulting:
[ul]
[li]Pete's garden.PDF[/li]
[li]Pete's garden.JPG[/li][/ul]
I can do that with XYPlorer, but I can't figure out how to do it with Opus, if possible. By the way, Directory Opus is the most amazing software I ever used, I wish Photoshop would have this range of customization.
Dim strExtension
Dim strNameOnly
' If we're renaming a file then remove the extension from the end and save it for later.
if fIsFolder or 0 = InStr(strFileName,".") then
strExtension = ""
strNameOnly = strFileName
else
strExtension = Right(strFileName, Len(strFileName)-(InStrRev(strFileName,".")-1))
strNameOnly = Left(strFileName, InStrRev(strFileName,".")-1)
end if
if strFirstName = "" then
strFirstName = strNameOnly
else
strNewName = strFirstName & strExtension
end if
End Function[/code]
Note that the operation will be sensitive to how the files are initially sorted when you open the Rename window. Whichever file is at the top of the list will be the one whose name is applied to the other files. (So, with the example you gave, I had to reverse-sort by Name to ensure the right file came first.)
You can also turn the script into a button / hotkey / menu-item / etc. if you want to be able to run it instantly without opening the Rename window. Shout if you need help doing that.