DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: "CopySmart"  (Read 14,815 times)

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
IDEA: "CopySmart"
« on: January 04, 2012, 01:07 PM »
Here's a fun idea!

You have a file or folder with a number in it. You want to make a whole bunch of template files and folders. So you copy it, right? Only instead of File1 File2 File3 File4, you get File1, File1 (copy2), file1-copy-copy-copy(2) etc! Yuck! Because you then have to go rename them all.

What about a utility that lets you select a file or folder, pick the digit to increase, then names all the new copies after that?

Suggested features: Definitely keyboard support! The whole idea came from banging Control-V on my files and folders. I don't think I want to over-write Control-V. It's not clear why it needs a control-anything at all! What about the Tilde key? ` I can't even remember the last time I used that key for real.
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)
« Last Edit: January 04, 2012, 01:12 PM by TaoPhoenix »

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #1 on: January 17, 2012, 02:30 PM »
Anyone want to take a whack at this?

I'm stuck making more folders again, and here we go renaming away from "doc copy copy copy" to "doc1" "doc2" etc.

Edit: Flexible Renamer is pretty good, and it got me past today, though I like "low-res" tricks too, so there's still room for the "1-button" widget.
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)
« Last Edit: January 17, 2012, 03:02 PM by TaoPhoenix »

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: IDEA: "CopySmart"
« Reply #2 on: January 17, 2012, 07:17 PM »
Are you only ever selecting one file or one folder when you do this?  If so, writing something like this is infinitely easier.

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #3 on: January 19, 2012, 12:42 PM »
Hi Skwire!

I agree Flexible Renamer has more horsepower to repair existing junk names etc.

Yes, what I see the need for is a single file / folder smart copier so that I don't get all that junk that requires Flexible Renamer to fix!  ;D

Usage wise, I'd see it as something that sits in the tray so that the new smartcopy is "just there", tied to some key, rather than having to open the app and "import target folder or file".
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: IDEA: "CopySmart"
« Reply #4 on: January 20, 2012, 09:34 PM »
Here's a quick-n-dirty AutoHotkey hotkey that should do what you want.  Copy a single file or folder to the clipboard and then press Win+V, enter the number of copies you want and it should make them.  Works with a single file or a single folder only and has some basic sanity checking built-in to check this.

Code: (autohotkey)
#v::
{
    myPath := Clipboard
    ; Check for existence of multiple items.  Kick out if found.
    Loop, Parse, myPath, `n, `r
    {
        If ( A_LoopField != "" )
        {
            If ( A_Index > 1 )
            {
                MsgBox, 16, Error, Multiple files selected!`n`nThis hotkey is designed for use with only one file or folder selected.
                Return
            }
        }
    }
    
    ; Check path for validity.
    If ! FileExist( myPath )
    {
        MsgBox, 16, Error, Current clipboard contents either:`n1) Do not exist anymore or`n2) Are not a file/folder path
        Return
    } 
    
    ; Get number of copies to make from the user.
    InputBox, numCopies, Number of copies, Enter number of copies to make:, , , 110

    If ! ( ErrorLevel ) ; User did not cancel.  Proceed.
    {
        SplitPath, myPath, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
        Loop, % numCopies
        {
            ; Check if destination file/folder exists.  If so, create a unique name for it to avoid collisions.
            Loop
            {
                If FileExist( OutDir . "\" . OutFileName )
                {
                    OutFileName := OutNameNoExt . A_Index . ( ( InStr( FileExist( myPath ), "D" ) ) ? ( "" ) : ( "." . OutExtension ) ) 
                }
                Else
                {
                    Break
                }
            }
            If ( InStr( FileExist( myPath ), "D" ) ) ; myPath is a folder.
            {
                FileCopyDir, % myPath, % OutDir . "\" . OutFileName
            }
            Else ; myPath is a file.
            {
                FileCopy, % myPath, % OutDir . "\" . OutFileName
            }
        }
    }
}
Return

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #5 on: January 21, 2012, 09:16 AM »
Hmm.

I don't have any experience with Autohotkey, so does that code compile into the clicky exe's you've been making or is that something else entirely?
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: IDEA: "CopySmart"
« Reply #6 on: January 21, 2012, 10:15 AM »
Here you go:  TaoCopier

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #7 on: January 22, 2012, 12:38 AM »
Here you go:  TaoCopier
That's getting close!

If you feel like tweaking it, something about the size of the box makes the instructions "how many copies" etc completely unreadable - maybe you could make the box taller.

Also, a quick feature that would be nice is because Windows (other OS's?) get grumpy with two copies of the same file, I tend to always start my files with trailing digits like 1, etc. So NewFolder1 gave me Newfolder11, Newfolder 12, up to NewFolder110. So Start With Trailing Digit would be nice.

Another case is when I have files like ElegyForSkwire Unrecited.txt, aka trailing descriptive info that should stay the same, when I make the copies, I'd really rather have ElegyForSkwire2 Unrecited.txt ElegyForSkwire3 Unrecited.txt ElegyForSkwire4 Unrecited.txt etc. So that feature would be Insert Numerals X characters from the left. Is that still simple to do?

Your fan,

--Tao
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

skwire

  • I eat Coding Snacks for breakfast...
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,297
    • Participated in NANY Challenge Seventeen Times
    • Coding Snacks
    • Superboy Coder
    • Cody Award
    • Volunteers/Staff
    • Gathering Badge
Re: IDEA: "CopySmart"
« Reply #8 on: January 22, 2012, 03:37 AM »
I uploaded another build with a taller InputBox.  Let me know if that works better on your computer.  TaoCopier

As to your other questions, yes, they're possible.  However, they're delving into what I call "subjective coding" where the choices you're making are no problem at all for a human to decide but they're really inelegant to try and code for.  Does that make sense at all?  If not, I apologise; it's sometimes hard to convey this point.   :(

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #9 on: January 22, 2012, 04:03 PM »
Sorry, I think I get your point about Subjective Coding but I had hoped that I made the functions precise enough to allow them to be codeable. See the pseudo-code below. I can get the function on data in MS Excel, but I was hoping to be able to do the same with creating files and folders.

A.
   A1. If (StartWithEndingNumeral box is checked, then InsteadOfWholeFilename in memory, FilenameMod=FilenameMinusRightmostCharacter).
   A2. Get RightmostCharacter(Filename) = Numeric Variable NewStartNumber, Add +1, ConcatenateToFileNameMod, and that's your first new copy. Then the rest is all the same.

Example. NewFile1 currently grabs the whole filename, and begins to kick out NewFile11, NewFile12, etc.
With that option mode checked, it goes:
Filename = NewFile1
FilenameMod = FilenameLessRightChar(1) aka NewFile
Get RightChar(Filename) = 1 ; Add+1 ; NewStartNumber=2
Concatenate FileNameMod which is NewFile with NewStartNumber which is 2,
And then now that the machine knows the first file to create is NewFile2 and not NewFile11, the rest should work, right?

The other feature is the same idea, with a Get Character but user specified X From Left.
So the starting filename is File1ToDebug, instead of making the first new file File1ToDebug2, (Appending increase at the end), it increases at Position X to produce File2ToDebug.

I tried to make it "simple" by having a toggle box for each so there is no guessing, both user specified options.

Does that make things any easier to implement?

Sorry to be a pest again,

--Tao
   
P.S. The size increase works.  (Both at home and at work.)
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)
« Last Edit: January 23, 2012, 12:34 PM by TaoPhoenix »

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #10 on: January 26, 2012, 01:17 AM »
Oh dear, I annoyed dear ol Skwire again : (
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Re: IDEA: "CopySmart"
« Reply #11 on: January 29, 2012, 09:56 PM »
Quote
However, they're delving into what I call "subjective coding" where the choices you're making are no problem at all for a human to decide but they're really inelegant to try and code for.

Reminds me of a recent request I had by a friend. He wanted me to code an application to look through some text documents in which he kept journal entries and find places where he'd made the mistake of substituting a homophone for the correct word, such as "There home is insured" instead of the correct "Their home is insured." And there was one example sentence in which he'd written "I remember one particular incident from my adolescents...", which of course should have been "I remember one particular incident from my adolescence."

I've tried to explain to my friend that to write code to heuristically choose between any one set of homophones would be quite non-trivial. To choose the right homophone among dozens, hundreds?

This is why robots will never take over the world (sorry T3 fans). Programming constraints and processing-speed constraints just won't allow for anywhere near human-speed/human-accurate decisions and judgment.
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #12 on: January 31, 2012, 12:44 PM »
Quote
However, they're delving into what I call "subjective coding" where the choices you're making are no problem at all for a human to decide but they're really inelegant to try and code for.

Reminds me of a recent request I had by a friend. He wanted me to code an application to look through some text documents in which he kept journal entries and find places where he'd made the mistake of substituting a homophone for the correct word, such as "There home is insured" instead of the correct "Their home is insured." And there was one example sentence in which he'd written "I remember one particular incident from my adolescents...", which of course should have been "I remember one particular incident from my adolescence."

I've tried to explain to my friend that to write code to heuristically choose between any one set of homophones would be quite non-trivial. To choose the right homophone among dozens, hundreds?

This is why robots will never take over the world (sorry T3 fans). Programming constraints and processing-speed constraints just won't allow for anywhere near human-speed/human-accurate decisions and judgment.

I disagree. I think it's more of a SF/Scifi "racial fear" of letting the robots get too smart, as portrayed in Lowest Common Denominator fashion in the movies.

While I'd certainly grant that it's more than a coding snack, and maybe even for 1 person, it's not "impossible". Quick observation from a slightly spelling-obsessed guy : there are less than thirty "infamous" homophones. There/They're/Their/ ; to/too/two ; lose/loose ; its/it's ; apostrophes vs plurals  -- are the top five sets or so.

Then yes, your "adolescence/adolescents" and "intents and purposes (not intensive purposes)" are some more rare ones. But in fact it's "not that hard" because the "spec" called for homophones and suddenly the problem narrows down like a game of 20 questions. Instead of searching every word against every other word, you have a list of all words that CAN be homophones, then when one appears, you check the grammar structure, because it turns out there aren't that many valid grammar structures when homophone pairs are involved.

So yes, it is not a 2 hour lunch snapper, but neither is it in "flying car" territory either. I just believe that we racially have decided that we don't want robots taking over our lives because we haven't socially matured up to Asimov Story level.

Cases in point: The IBM Jeopardy engine is already a quarter up to natural language checking, and what is "cutting edge now" will be "retail" in seven years or so it all goes.

Social commentary time: We had more "fun" blinking about with the Terror/Copyright/BlueBlood theme and wasted a crucial decade and a trillion dollars. Now if that had gone to good ol' social infrastructure we'd be seeing the first wave of fun SF stuff. Instead we're getting the first wave of the dystopian novel visions.
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #13 on: January 31, 2012, 12:51 PM »
Looping back on topic:

I have made a minor amateur hobby about low tech linguistic processing. In fact my NANY entry is in this same class. Sometimes with a seemingly minor shortcut a "miracle" chops down to something easy, and I try to use those methods to describe my code requests.

If anyone else wants a crack at it after all this, I can try to do a mockup in another medium.
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Re: IDEA: "CopySmart"
« Reply #14 on: January 31, 2012, 02:59 PM »
I understand your point Tao. I think English is such an incredibly abstruse beast (look at the horror on the faces of non-native English speakers who are trying to learn English) that every time you think you've got all cases nailed down, another exception will be found in someone's diary, journal, etc. The coding project then becomes one of grinning as your program seems to deal properly with all sample texts submitted thus far, only to have your happiness dashed when someone else says "Hey, I ran such and such file through your program and it did THIS!  :( ) I submit that my particular example is not impossible to code against, as you have correctly stated. But it was only offered as an example of something that at first seems easy enough, but really is beginning to enter the area of subjective coding. Perhaps I should have used an example with a less-limited problem-space.

I maintain that robots will never be able to pass for human  :P
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #15 on: February 11, 2012, 07:08 PM »
So can I beg and plead for this last feature to get added? Lord Skwire?

"Increment X character of the original file"?

Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #16 on: February 21, 2012, 02:01 AM »
Can I prevail on the mighty wisdom of DC to get one more feature? All I want left is an "Increment X Character from the left". So if you have a file "Donation Coder File 1 To Be Evaluated.txt", It would increment something like the 21st character from the left for its copies.
Donation Coder File 1 To Be Evaluated.txt
Donation Coder File 2 To Be Evaluated.txt
Donation Coder File 3 To Be Evaluated.txt
Donation Coder File 4 To Be Evaluated.txt

I may have exhausted poor Sqwire. I will probably donate soon. Help! : )
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • Participated in NANY Challenge Eight Times
    • Programming School - Deluxe Bonus Medal
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Military Service Badge - US Army
    • Writer
Re: IDEA: "CopySmart"
« Reply #17 on: February 21, 2012, 02:05 AM »
Quote
I may have exhausted poor Sqwire.

Nah, Skwire in inexhaustible. He's just communing in his binary sanctuary. Picture Dark Vader kneeling before a darkly-shrouded 64-bit figure. "Your bidding, my lord?"

;D
Win 10 Pro running on a 3.2 GHz CPU and 12 Gb RAM
__________________________________________

Proofreading Service: http://williammillerservices.com/proofreading

TaoPhoenix

  • 0 - 60 ... then back to 0 again!
  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • Participated in NANY Challenge Three Times
Re: IDEA: "CopySmart"
« Reply #18 on: February 21, 2012, 02:14 AM »
Well, This topic has languished for two weeks, so I thought I'd put a feeler out ...
Use attachthumb=# to show an attached image as an expandable thumbnail, or attach=# to show full size. (With Brackets)

Original address: https://www.donationcoder.com/forum/index.php?topic=29506.0