Renaming

Hi,

before starting serious things : Great job about Dopus. I've always wanted a software like this one, and never give it a try.

I should have take the time to try it long time ago ...

Let's consider a list of many files, I select 2 of them manually
(file1.ext1 and file2.ext2)
and then, I need the button to rename file2.ext2 to file1.ext2.

The result will be : file1.ext1 and file1.ext2

I don't see how to make that without using any external command so I'm asking the wises :slight_smile:

Thanks for your help ^^

nobody is brave enough to create this button ?

Let me clarify my example :
Let's consider a list of many files, I select 2 of them manually
"aaaaa.bmp"
"bbbbbbbbbb.jpg"

and then, I need the button to rename "bbbbbbbbbb.jpg" to "aaaa.jpg".

The result will be :
"aaaa.bmp" (unchanged)
"aaaa.jpg" (extension unchanged, but filename copied from "aaaa.bmp").

Thx for your help :stuck_out_tongue:

It'll take some VBScript which I haven't had time for yet. I'm saving the post for later in case nobody else replies.

It'd also help if you only mentioned one thing per post so it's obvious what the question is. :slight_smile:

you are right, I thought of this later but couldn't edit the first post.

So I try to make another one with only the question about the renaming script, but the post was deleted :frowning:

My bad :wink:

I've just edited out the parts that are in the other thread. Sorted. :slight_smile:

Thx :slight_smile:

Without speaking of vbs, I have tried something, here is the logic of my attempt :

Select PATTERN *.jpg DESELECT
Rename INLINE=name
Clipboard COPY
Select RESELECT
Select PATTERN *.bmp DESELECT
Rename INLINE=name TO "whatever is in the clipboard"

That's logic to me, but I can't make it work :confused:

There's no way in the standard function system for a command to work on two separate files from the same Lister simultaneously, so a VBScript is the only way this would work as far as I know.

damn, I don't know a thing about vbs :neutral_face:

It could actually be any scripting language you do know and have, if any (I think)

You're right Bob, he could do it with a pretty simple batch file script too using two steps.

Step 1: Create an empty text file and paste the following into it:

@echo off set SRCNAME=%~n1 :go rename "%~2" "%SRCNAME%%~x2" shift if "%~2" NEQ "" goto:go

Save that file and give it a name that ends in .CMD (in my example here my file is named: "D:\Mine\cmd\Test.cmd"

Step 2: Create an opus button and give it the following command:

"D:\Mine\cmd\Test.cmd" {F}

Where "D:\Mine\cmd\Test.cmd" would need to be the script name you created. Then select some files and give it a go. The top selected file in opus should be the one that establishes the name for the rest of the selected. Note this method is limited to maybe 40 file names or so depending upon the length of those file names.

many thx, with your precious help, I have found something wich make the job perfectly.
Since I want only 2 files to be renamed, I add a skip condition whenever 3 parameters are detected.
I also add a condition to only rename the .jpg file whatever is its position in the lister.

Is this possible to display a Dopus dialog box in this case to tell the user he must select only 2 files ?

I would really be interested in seeing this scrip in .vbs.

[quote]@echo off
if not "%~3"=="" goto:end
if %~x1==.bmp goto:bmp
if %~x1==.jpg goto:jpg
goto:end
:bmp
set SRCNAME=%~n1
rename "%~2" "%SRCNAME%%~x2"
goto:end
:jpg
set SRCNAME=%~n2
rename "%~1" "%SRCNAME%%~x1"
goto:end
:end[/quote]

You could have Opus display one of its dialogs however if it were me since this is a batch file, I'd use a batch file script popup like the free one Frank Westlake offers here:

maem.umr.edu/batch/f_w_util/popup.zip

If you grab that above popup program and unzip it, just change this line in your script from:

if not "%~3"=="" goto:end 

to something like this (you would have to change the path to popup.exe to where it would be on your computer):

if not "%~3"=="" ( "D:\Other Tools\PopUp.exe" /ok /m:"Only 2 files can be selected!" goto:EOF )

By the way in case you weren't aware of it, once you have your batch file scripts working exactly as you want, you can prevent Opus from showing the DOS box flash by putting @runmode hide in your button command like this:

@runmode hide
"D:\Mine\cmd\Test.cmd" {F}

As far as VBS goes, while I've written a number of VB scripts in IMatch, I've barely touched them in Opus yet (old habits of using batch files or 4NT scripts die hard for me) so I'll have to pass (at least for now) on the vbs version of this.

I will try the popup software :slight_smile: thx

And about the runmode hide, I was aware of it and ve already set this (I'm not that noob :p), but thx for the advice.

I also added a nodeselect files, it's nicer :slight_smile: