topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday April 16, 2024, 4:54 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: "CopySmart"  (Read 10689 times)

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
IDEA: "CopySmart"
« on: January 04, 2012, 07:07 AM »
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.
« Last Edit: January 04, 2012, 07:12 AM by TaoPhoenix »

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #1 on: January 17, 2012, 08:30 AM »
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.
« Last Edit: January 17, 2012, 09:02 AM by TaoPhoenix »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #2 on: January 17, 2012, 01: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

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #3 on: January 19, 2012, 06:42 AM »
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".

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #4 on: January 20, 2012, 03: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 [Select]
  1. #v::
  2. {
  3.     myPath := Clipboard
  4.     ; Check for existence of multiple items.  Kick out if found.
  5.     Loop, Parse, myPath, `n, `r
  6.     {
  7.         If ( A_LoopField != "" )
  8.         {
  9.             If ( A_Index > 1 )
  10.             {
  11.                 MsgBox, 16, Error, Multiple files selected!`n`nThis hotkey is designed for use with only one file or folder selected.
  12.                 Return
  13.             }
  14.         }
  15.     }
  16.    
  17.     ; Check path for validity.
  18.     If ! FileExist( myPath )
  19.     {
  20.         MsgBox, 16, Error, Current clipboard contents either:`n1) Do not exist anymore or`n2) Are not a file/folder path
  21.         Return
  22.     }
  23.    
  24.     ; Get number of copies to make from the user.
  25.     InputBox, numCopies, Number of copies, Enter number of copies to make:, , , 110
  26.  
  27.     If ! ( ErrorLevel ) ; User did not cancel.  Proceed.
  28.     {
  29.         SplitPath, myPath, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
  30.         Loop, % numCopies
  31.         {
  32.             ; Check if destination file/folder exists.  If so, create a unique name for it to avoid collisions.
  33.             Loop
  34.             {
  35.                 If FileExist( OutDir . "\" . OutFileName )
  36.                 {
  37.                     OutFileName := OutNameNoExt . A_Index . ( ( InStr( FileExist( myPath ), "D" ) ) ? ( "" ) : ( "." . OutExtension ) )
  38.                 }
  39.                 Else
  40.                 {
  41.                     Break
  42.                 }
  43.             }
  44.             If ( InStr( FileExist( myPath ), "D" ) ) ; myPath is a folder.
  45.             {
  46.                 FileCopyDir, % myPath, % OutDir . "\" . OutFileName
  47.             }
  48.             Else ; myPath is a file.
  49.             {
  50.                 FileCopy, % myPath, % OutDir . "\" . OutFileName
  51.             }
  52.         }
  53.     }
  54. }
  55. Return

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #5 on: January 21, 2012, 03: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?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #6 on: January 21, 2012, 04:15 AM »
Here you go:  TaoCopier

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #7 on: January 21, 2012, 06:38 PM »
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

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #8 on: January 21, 2012, 09:37 PM »
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

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #9 on: January 22, 2012, 10:03 AM »
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.)
« Last Edit: January 23, 2012, 06:34 AM by TaoPhoenix, Reason: Slightly off-key tone in the first edition of this post. Sorry! »

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #10 on: January 25, 2012, 07:17 PM »
Oh dear, I annoyed dear ol Skwire again : (

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #11 on: January 29, 2012, 03:56 PM »
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.

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #12 on: January 31, 2012, 06:44 AM »
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.

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #13 on: January 31, 2012, 06:51 AM »
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.

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #14 on: January 31, 2012, 08:59 AM »
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

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #15 on: February 11, 2012, 01:08 PM »
So can I beg and plead for this last feature to get added? Lord Skwire?

"Increment X character of the original file"?


TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #16 on: February 20, 2012, 08:01 PM »
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! : )

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #17 on: February 20, 2012, 08:05 PM »
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

TaoPhoenix

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 4,642
    • View Profile
    • Donate to Member
Re: IDEA: "CopySmart"
« Reply #18 on: February 20, 2012, 08:14 PM »
Well, This topic has languished for two weeks, so I thought I'd put a feeler out ...