Jump to content


Photo

organize files quick and comfortable


  • Please log in to reply
18 replies to this topic

#1 GDur

GDur
  • Members
  • 82 posts

Posted 20 December 2009 - 08:41 PM

EDIT: Fixed two anoying bugs:
- no longer Singleinstance force
- fixed string reverse method

With this script u can make a rightclick on marked files and there is a new option called "Organize".
if u click on "Organize" the file will be moved in the directory wich u wrote in the ini.txt.
it's very simple.

example of an ini.txt:
w3x = E:\Games\Warcraft III\Maps\Download
mp3 * wav * wmv = E:\Musik
jpeg * ico * jpg * bmp * tga * gif * psd = E:\Bilder
w3x is the filesuffix of warcraft3 maps..
and if i click right of a w3x map...and click organized...then the file will automaticly moved to "E:\Games\Warcraft III\Maps\Download"

if u want to move musicfils of many kinds to one directory...u seperate the suffixes with a *
so in this example will move all marked files wich are .wav, .mp3 or .wmv to "E:\Musik"

to initialize the script (make an entry to the registry so that the new options in the context menue is set). u got do doubleclick it one time.

then u can leave it there and u got the new option ..
have fun with it.

:wink:
; Language:       German/ English
; Platform:       winXP, Win7
; Author:         GDur <g-dur@hotmail.de>
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#NoTrayIcon
#SingleInstance

RegRead, regpath , HKEY_CLASSES_ROOT, *\shell\Organize\Command, 
regpathV =  AutoHotkey.exe "%A_ScriptFullPath%" "`%1"

IfNotInString, regpath, %regpathV%
{
  MsgBox, 
  (
Registryentry changed. 
This is the new path:
%regpathV%
  )
  RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\shell\Organize\Command,, AutoHotkey.exe "%A_ScriptFullPath%" "`%1"
  RegWrite, REG_SZ, HKEY_CLASSES_ROOT, AllFilesystemObjects\shell\Organize\Command,, AutoHotkey.exe "%A_ScriptFullPath%" "`%1"
}

if(%0% > 0)
{
  fullPath = %1% ; <- the error was here 
}else
{
  ExitApp
}

reversefullPath := revtxt(fullPath)
StringGetPos, pos, reversefullPath, .
if pos >= 0
{
  organizeThis(fullPath)
}else
{
  FileList =  ; Initialize to be blank.
  Loop, %fullPath%\*.*
      FileList = %FileList%%A_LoopFileName%`n
  Sort, FileList, R  ; The R option sorts in reverse order. See Sort for other options.
  Loop, parse, FileList, `n
  {
      if A_LoopField =  ; Ignore the blank item at the end of the list.
          continue
      organizeThis(fullPath "\" A_LoopField)
  }
}
ExitApp


revtxt(inVar)
{
    VarSetCapacity(out, n:=StrLen(inVar))
    Loop %n%
        out .= SubStr(inVar, n--, 1)
    return out
}

organizeThis(fullPath)
{
  reversefullPath := revtxt(fullPath)
  StringGetPos, pos, reversefullPath, .
  
  StringLeft, reversefullPath, reversefullPath, %pos%
  path_suffix := revtxt(reversefullPath)
  Loop, read, ini.txt
  {
    StringSplit, zeile, A_LoopReadLine, = , %A_Space%%A_Tab%
    StringSplit, Array, zeile1, * , %A_Space%%A_Tab%
    Loop, %Array0%
    {
      suffix := Array%a_index%
      path_suffix := path_suffix
      if suffix = %path_suffix%
      {
        FileMove, %fullPath%, %zeile2%
      }
    }
  }
}

;Esc::ExitApp

i made a little uninstall-script wich removes the registry-entrys..
; My Language:       German / English
; My Platform:       Win 7
; Author:            GDur <g-dur@hotmail.de>
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;#NoTrayIcon 

RegDelete, HKEY_CLASSES_ROOT, *\shell\Organize
RegDelete, HKEY_CLASSES_ROOT, AllFilesystemObjects\shell\Organize

MsgBox, Deleted registry-entry (Uninstalled FRAn-Organizer)
ExitApp


#2 Eedis

Eedis
  • Members
  • 1591 posts

Posted 21 December 2009 - 08:10 AM

I really like this script, it's a great idea. But what if you wanted to move a whole folder?

#3 GDur

GDur
  • Members
  • 82 posts

Posted 21 December 2009 - 10:26 AM

I really like this script, it's a great idea. But what if you wanted to move a whole folder?

thanks a lot =)

oh....do you mean every file inside of a folder?

by now you got to open the folder and press strg + a and so on..
i'll look at this feature....so u can organize foulders as well


or did u mean that u can write in the ini.txt like:
folders = recycle bin
?

#4 Eedis

Eedis
  • Members
  • 1591 posts

Posted 23 December 2009 - 01:43 AM

No I meant to move the whole folder according to the contents it contained.

You click on a folder called 'Stuff' and click organize. Then it sends all of the mp3's inside of that folder to a folder named 'Stuff' in the mp3's correct location, then it sends all of the jpeg files inside that folder into another folder called 'Stuff' into the jpeg's correct location.

#5 GDur

GDur
  • Members
  • 82 posts

Posted 23 December 2009 - 03:16 AM

No I meant to move the whole folder according to the contents it contained.

You click on a folder called 'Stuff' and click organize. Then it sends all of the mp3's inside of that folder to a folder named 'Stuff' in the mp3's correct location, then it sends all of the jpeg files inside that folder into another folder called 'Stuff' into the jpeg's correct location.

oh yeeeeeees..
hmm...i found the registrykey for that...i just got to modify the code...
i'll make it..it's an important feature...

#6 GDur

GDur
  • Members
  • 82 posts

Posted 05 January 2010 - 12:13 AM

the new version can now organize folders as well...
i replaced the code above..
=)

#7 Ronny

Ronny
  • Guests

Posted 13 January 2010 - 03:04 PM

Hi, I don't get this script to work. My fullpath is always set to d:\downloads. That would mean that the script doesn't receive all it's arguments. I run Vista if that has any effect on this. I tested to change d:\downloads to another path and the rest of the script works fine.

I must say that I really like the idea of this script and I believe I will remove the register stuff from it and add a hotkey instead. Thanks a lot!

#8 GDur

GDur
  • Members
  • 82 posts

Posted 13 January 2010 - 03:51 PM

Hi, I don't get this script to work. My fullpath is always set to d:\downloads. That would mean that the script doesn't receive all it's arguments. I run Vista if that has any effect on this. I tested to change d:\downloads to another path and the rest of the script works fine.

I must say that I really like the idea of this script and I believe I will remove the register stuff from it and add a hotkey instead. Thanks a lot!

woooooooooooooooow..
thats shitty =P
i uploaded the code with debuggingcode...
thank u i fixed the code above

#9 JF_NRW

JF_NRW
  • Members
  • 2 posts

Posted 03 February 2010 - 05:30 PM

Hello,

that is really what I'm looking for.

But is it possible to append another feature? Let me explain, please!

In my car I'm using a MP3-Adapter with SDCards. The structure on the SDCard must be the folders CD01, CD02, CD03, CD04, CD05 and CD06. In these folders I have to put the MP3s.

On my PC I use MediaMonkey. With MM I can build AutoPlaylists in the necessary size of 2 GB, 4 GB and so on. With MM I copy the Playlist (MP3-Files) to an folder outside my MP3-archive and then I have to move the files in the folders CD01, CD02... on the SDCard. Every folder gets more or less MP3s.

Now my Question: Is it possible to move the MP3-files to these folders. Maybe in the folder on PC are 480 MP3s - then your script moves 80 MP3-Files in every folder on SDCard.

#10 GDur

GDur
  • Members
  • 82 posts

Posted 06 February 2010 - 12:16 PM

Hello,

that is really what I'm looking for.

But is it possible to append another feature? Let me explain, please!

In my car I'm using a MP3-Adapter with SDCards. The structure on the SDCard must be the folders CD01, CD02, CD03, CD04, CD05 and CD06. In these folders I have to put the MP3s.

On my PC I use MediaMonkey. With MM I can build AutoPlaylists in the necessary size of 2 GB, 4 GB and so on. With MM I copy the Playlist (MP3-Files) to an folder outside my MP3-archive and then I have to move the files in the folders CD01, CD02... on the SDCard. Every folder gets more or less MP3s.

Now my Question: Is it possible to move the MP3-files to these folders. Maybe in the folder on PC are 480 MP3s - then your script moves 80 MP3-Files in every folder on SDCard.


i'll think about it =)

#11 GDur

GDur
  • Members
  • 82 posts

Posted 07 February 2010 - 01:23 PM

i thin i can solve ne new feature request..

how is that?:
u can write :
mp3 * wav = e:/pictures1 * e:/pictures2

with this code the files will moved to pictures1 folder and pictures2 folder in turns.

file1 to pictures1
file2 to pictures2
file3 to pictures1
file4 to pictures2
and so on...

#12 JF_NRW

JF_NRW
  • Members
  • 2 posts

Posted 07 February 2010 - 03:50 PM

This will be a superb offer.

Most of the time I play the mp3 in my car in random order. With this solution the mp3's on the SD-Card are in random order.

#13 GDur

GDur
  • Members
  • 82 posts

Posted 10 February 2010 - 07:46 PM

sry it's harder i thought...
it'll take more time

#14 Guests

  • Guests

Posted 21 October 2010 - 10:51 AM

uber cool script, thanks :O

#15 Chicken Pie 4 Tea

Chicken Pie 4 Tea
  • Members
  • 377 posts

Posted 21 October 2010 - 01:20 PM

would it be possible to add a feature that changes the extension of a file.

I often copy and paste text from Firefox into notepad. I save the files all in the same folder to save time always having to navigate to different folders when I am busy on the internet. When I go back to the download folder I have a lot of text files. To be able to distinguish them I save them with different extentions (they are not valid extenisons just something I can remember) For instance if I had copied a recipe I would save it as something.ck (ck for cooking)
Now using your script I can set up in the ini.txt
ck = C:\cooking

and the selected .ck files will be sent to the cooking dir.
however I then have to go to the dir and change the extension to a relavent one. ie. .txt
how could I set this up to be done automatically by your script?
I mean it would move AND change the extension of the .ck files