APP: Clip Folders - create subfolders from clipboard string

Started by Jingo, June 16, 2019, 07:34:15 PM

Previous topic - Next topic

Jingo

Hi All - Happy Father's Day!!  I threw together this app today for Menace based upon a request to parse a clipboard list and create subdirectories based upon the elements.  For example, if you paste in the following: Rötegewächse (Rubiaceae)\Labkräuter (Galium)\Galium  mollugo\ - then 3 nested subdirectories would get created:
   <base folder>
           \Rötegewächse (Rubiaceae)
                  \Labkräuter (Galium)
                         \Galium  mollugo

The App allows you to paste items into the keyboard using the Paste Button - this button will take what is in the clipboard, display the contents and parse the clipboard to determine subdirectories.  If you paste content that cannot be formatted into subdirs (ie: not in the proper <dir>\<dir> form), you can manually paste into the clipboard textarea box, edit the content into a single line with subdirs and then click the Update Dir List button to perform the parse again.  Remember to include that trailing "\" in order for the last subdir to be included!

Once you are satisfied, clicking the Create Folders button will let you choose the base folder location and then the subdirectories will get created.  If all goes well, the results box will detail what was created.

As always, please USE AT YOUR OWN RISK. While I did some basic testing on this, it has not been testing in detail and there is VERY LITTLE error checking going on...  always open to thoughts/suggestions!   To install, just unzip the attached file into your C:\ProgramData\photools.com\imatch6\webroot\user folder... it will appear automatically in the app manager.  The app works equally well inside IM as it does in the browser.

Enjoy!!

The FANCY Icon:


The APP Interface:


The Result Folder in Explorer (well... XYPlorer):

Menace

Hi Jingo, Happy Father's Day to you too (we don't have it here). :)

Wow, this is amazing. So fast and probably so helpful. Thank you very much.

But I have one Question? Where can I download it? It is just me, missing the zip?

Jingo

See.. I got too excited to share.. forgot the zip!  It has been attached now... Enjoy and I hope this is helpful to you! - Andy.

Menace

Yes, it is very helpful. Thank you a lot; I already create my first Subdirectories. :) And I absolutely admire you, how fast you create this App. I just look at your Code and I understand literally nothing.  ;D

Edit: I already changed my starting folder for my naturfotos and it works well.  :D

Jingo

Quote from: Menace on June 16, 2019, 08:05:41 PM
Yes, it is very helpful. Thank you a lot; I already create my first Subdirectories. :) And I absolutely admire you, how fast you create this App. I just look at your Code and I understand literally nothing.  ;D

Edit: I already changed my starting folder for my naturfotos and it works well.  :D

That's great.. so happy this is helpful.  A lot of thanks should go to Mario who created the ability for us to use easy coding languages like Javascript and UI Frameworks.   It has taken me a year or so to get familiar enough to code this quicky... the JS part comes quickly for me... the interaction with IM and the whole Asynch -> Promise stuff still takes me longer!

Have a great week!

Mario

Promises is the 'thing' because it enables you to keep the UI working while your app is waiting for IMatch or a web service. Quite simple, once you wrapped your head around it.

It's just the principle of "My code now calls this...which can take any amount of time...and when it is done, it calls this method" that many find confusing at first. Your program is no longer linear, in a sense.
but promises are easy to deal with, just then, fail and always to manage.

Web Workers is a concept that allows true multi-threading in apps. This will be exploited heavily, to utilize modern processors. Even small Notebooks now have four cores to use :-)

If you don't feel like using Promises, you can use aync/await. See https://www.photools.com/dev-center/doc/imatch/tutorial-recipes.html and search for await.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Quote from: Jingo on June 16, 2019, 07:48:50 PM
See.. I got too excited to share.. forgot the zip!  It has been attached now... Enjoy and I hope this is helpful to you! - Andy.

Hey Andy
thanks a lot for sharing a script!!! (and basically create it for Menace)
Though I have not to use it, because I create seldom new directories, it sounds cool.
And I envy your script-skills!  :D
Best wishes from Switzerland! :-)
Markus

Jingo

Quote from: sinus on June 17, 2019, 08:14:48 AM
editor (I'm still using Notepad++)

Don't. Thing of the past. Make your life easier. Use the free Visual Studio Code for a much better experience, proper syntax highlighting, linting etc. Highly recommended.

Menace

Congratulate to the 1000th posting.  :D

For me, JS seems not so easy, but I just started to watch some youtube-Videos.

In this App, I have a problem:

1. I paste the the Clipboard Text.
2. I change a little in the box of the Clipboard Test.
3. I click on "Update Dir List" -> Problem: It paste again the original Clipboard Text in the box and undo all my changes.

I solve the problem with the workaround:
1. Paste the Clipboard Text.
2. Change the Clipboard Text.
3. Copy again the Clipboard Text
4. Click the "Update Dir List"
5. Create folder

Jingo

Quote from: Menace on June 17, 2019, 01:57:56 PM
Congratulate to the 1000th posting.  :D

For me, JS seems not so easy, but I just started to watch some youtube-Videos.

In this App, I have a problem:

1. I paste the the Clipboard Text.
2. I change a little in the box of the Clipboard Test.
3. I click on "Update Dir List" -> Problem: It paste again the original Clipboard Text in the box and undo all my changes.

I solve the problem with the workaround:
1. Paste the Clipboard Text.
2. Change the Clipboard Text.
3. Copy again the Clipboard Text
4. Click the "Update Dir List"
5. Create folder

Whoops... that's what I get for trying to take a shortcut... nice bug find!  I just fixed this - here is an updated zip file.  If you want to fix this yourself without having to replace the file, just change one line in the index.html file - this will update the directory list from the current text box WITHOUT re-reading the clipboard contents:



old:

   $('#btn-update').click(function() {
           $('#btn-paste').click ();
   });


new:


   $('#btn-update').click(function() {
       parseDirs($('#cliptext').val());
   });

Menace