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
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.
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:
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.