Can I make a duplicate button that duplicates a selection with no dialogue pop up?
Auto renames the new files with ascending numbers and no brackets. ?
Copy DUPLICATE
Can I make a duplicate button that duplicates a selection with no dialogue pop up?
Auto renames the new files with ascending numbers and no brackets. ?
Copy DUPLICATE
Copy PATTERN * AS * DUPLICATE WHENEXISTS=rename
That'll do it with the standard ascending numbers in brackets. If you really don't want the brackets then it'll need more than a one-liner.
You can pimp the Copy command with the Evaluator...
@nodeselect
=i=1
=if (!preparse_dummy) return "Copy DUPLICATE FILE=""" + filepath + """ PATTERN=*.* AS=""* " + i++ + ".*""";
... or get some help from Rename:
Copy DUPLICATE PATTERN=*.* AS=*tmp.*
Rename FROM=*tmp.* TO="* .*" NUMBER
Thanks guys.
These are good. I like being able to push the button multiple times and end up with:
File
File 2
File 3
I think "getting help from rename" might be the trick but it's not adding the numbers together.
Is there a way to make the copied items have an ascending number, based on the previous copy?
And maybe add a 1 to the original because it's now part of a series so it gets numbered too.
If I selected a file named "Tag Logo Red"
and pushed the button twice the desired result would be:
Tag Logo 1
Tag Logo 2
Tag Logo 3
You'll probably need to use scripting if you want to avoid brackets around the numbers.
I have this as a hotkey... Its not sequential numbering, thou with the current date & time.
Copy DUPLICATE PATTERN * AS "* - CopyDup - {date|D#MMddyy}-{time|T#HH-mm-ss}" IGNOREEXT
e.g....
file.txt
becomes
file - CopyDup - 011925-12-42-01.txt
- CopyDup -
, can be removed obviously, I use that in duplicated file names for quick filtering\searching
try to modify this
@ASUNDER
There is an ancient solution to this on the forum.
It is very, very, old !
Personally, these days, I think that this is what to do.
It is easy to do another rename to get these to final form.
This was written by @Leo long before he was a Directory Opus Developer.
He really was, but he didn't have to work for GPSoft yet.
I still have a button for it.
This thread was copied over from the old forum.
The comments are very old an out of context today.
So what you need is a safe place to copy the old script, DupeFile.vbs
to.
/dopusdata\Scripts
is probably a good choice.
The button code is then just this:
@set NumDupes = {dlgstring|Number of duplicates to create:|10}
/dopusdata\Scripts\DupeFile.vbs {filepath$} {$NumDupes}
It does have a pop-up for the number of copies needed.
This will get you any # of duplicate files appended intelligently by a properly padded _# .
Other than these solutions, you'll probably need to write a new script.
Ya I get that a lot lately. I don't know who's been telling you guys TRev can script.
If I could then I wouldn't have to ask.
This isn't my industry; my computer knowledge is consumer grade at best. I'll just have to be stuck with what I got.
Try this (be careful as it also duplicates folders) as a script button.
DuplicateNumber.dcf (4.8 KB)
function OnClick(clickData)
{
var cmd = clickData.func.command;
var fsu = DOpus.FSUtil;
cmd.deselect = false; // Prevent automatic deselection
// --------------------------------------------------------
cmd.RunCommand("Set VIEW=Details");
var duplicateCmd = DOpus.Create.Command();
duplicateCmd.SetSourceTab(clickData.func.sourcetab);
duplicateCmd.SetDestTab(clickData.func.sourcetab);
// --------------------------------------------------------
DOpus.Output("Selected items in " + clickData.func.sourcetab.path + ":");
if (clickData.func.sourcetab.selected.count == 0)
{
DOpus.Output("No selection. Aborting.");
}
var allTargetNames = DOpus.Create.Map();
for (var e = new Enumerator(clickData.func.sourcetab.selected); !e.atEnd(); e.moveNext())
{
var item = e.item();
dout("item name : " + item.name_stem_m);
// Define default target duplicate name
var targetName = GetNextName(item.name_stem_m);
var fullTargetName = item.path + "\\" + targetName + item.ext_m;
// dout("full target = '" + fullTargetName + "'");
while (fsu.Exists(fullTargetName) || allTargetNames.Exists(fullTargetName)) {
//dout("fsu : already exists");
targetName = GetNextName(targetName);
fullTargetName = item.path + "\\" + targetName + item.ext_m;
//dout(" => Needs to try '" + fullTargetName + "'");
}
allTargetNames(fullTargetName) = 1;
// dout("## Target '" + fullTargetName + "' added to the map");
// Build command
var unitCmd = 'Copy "' + item + '" AS "' + targetName + item.ext_m + '"';
dout("cmd line = #" + unitCmd + "#");
duplicateCmd.AddLine(unitCmd);
}
duplicateCmd.Run();
}
function GetNextName(name) {
var endingNumber = 1;
var targetName = name + " " + endingNumber;
var regex = new RegExp(" ([0-9]+)$", "g");
var match = regex.exec(name);
if (match !== null && match.length == 2) {
//dout("Item ends with a number (" + match[1] + ")");
endingNumber = +match[1] + 1;
//dout ("NEW Ending Number = " + endingNumber);
targetName = name.replace(regex, " " + endingNumber);
}
//dout ("Target Name = '" + targetName + "'");
return targetName;
}
function dout(msg, error, time) {
if (error == undefined) error = false;
if (time == undefined) time = true;
DOpus.output(msg, error, time);
}
Yup that's what's up.
THATS WHATS UP Thank YOUUUU
Works on folders too? Even better!
Isn't it a thing of beauty.
These other guys are cute. They wanted me to create THAT with what sorcery
So on my vertical toolbar I have my two Copy three-buttons.
Left click = copy
Right click = paste
MM button = cut
Copy.dcf (854 Bytes)
Left click = duplicate (script)
Right click = duplicate as (dialog)
MM button = toggle duplicate finder tool
Duplicate.dcf (5.5 KB)
I'm sorry; I sincerely apologize.
The simple fact is that there is not an abundance of people who post here that are proficient in scripting. Some of those who can are truly quality professionals in computing.
Their efforts to help on this forum are much appreciated.
But they have personal lives too. People can't expect them to drop everything to write every imagined script. But, reality is that if someone seriously tries to write something and needs some help, very often help will be there. Your relentless efforts are why I have tried to help you with what I have been able to do, where and when I could.
The only real class I have ever had in computing is so ancient it is laughable today !
FORTRAN programming for scientists. I should have taken PASCAL.
I just wanted an excuse to post a meme.
Ya I was thinking about that. When you first encounter a new person how are you supposed to know their experience?
It would be beneficial if on our profile set up we could choose what our computer acumen is, and especially our ability to write Dopus scripts. There would be little icons beside our avatar pic. So that people know at first glance if this person is able to help with scripting or if the person would need help with scripting. So that would even change how people respond to questions.
A tag of "I don't know how to script" is like a "do no solicit" sign on the house mailbox. If I don't know how to script do NOT tell me I can do it with a script. Because that is making you think you've solved a problem by looking at it and saying, "yup that's a problem".
True, tech support isn't owed to anyone. Especially when this business model is license, not subscription. Microsoft even charges good money for business support and that is like a three day wait. Anytime a good response comes back and solves a problem it's a matter of getting lucky.
But that doesn't mean it's wise to use that to disregard problems.
Not doing something because you don't have to is a terrible decision making process. But it makes a great excuse to not do things you should do but don't want to.
Like I said before about alienating the market: with this goldfish attention span generation, expecting them to learn a computing language so they can set up some buttons, then never use that learned skill again, isn't legit whatsoever.
"Dopus is better because you can customize it." Ya and if you don't know how then what does it matter that you can? If you were gifted a Ferrari but can't afford the insurance you don't have a Ferrari.
People that ask a question and get something solved did get something for free. And yet the business forum communication model is brilliant (as opposed to ticketing). Because the business gets free beta testing and the awareness of issues when people post and ask about it, that is free data. This same data the big business pay extremely good money for.
And others can step in and answer the questions too. So the labour is free for the business twice! The people posting problems are acting as a sensor that is picking up otherwise unknown issues. Having their kitchen Ramsay'ed for free. That includes free suggestion ideas too. Then when the question is solved it is forever on the forum so the next person to have that problem is filtered through the search bot that shows them the answer. It is continually getting more efficient, lowering business customer relation overhead, because of the forum members, not any work that the business put in. So it's a mutually beneficial symbiotic relationship.
Hey, I celebrated a little too early.
Is it possible to make the first duplicate start at the number 2 instead of 1?
I've reviewed your code and I'm lost. I won't even bother trying to modify it myself.
The modification is easy !
Edit the button and under the edit menu of the button itself check Show Line Numbers
.
Go to line 51.
Change var endingNumber = 1;
to var endingNumber = 2;
.
But understand, that this is only a 'Hack' .
@ASUNDER : @David is correct this is the line to change.
FWIW, a little precision for an edge case : if you happen to try this button with a selection including two files named File 3
and File 4
(and no file named File 5
and File 6
), one file (should be File 3
) will end up renamed File 5
and the other will be renamed File 6
.
Note that this is also true if any of these is a folder (you can not have a file and a folder with the same name in a folder).
Ok thanks.
I will use the script for any time I just want a quick duplicate/s.
Anything more complicated and I will go straight to the right click on the button for the dialogue.