Menu

#14 "enfolder" AutoHotKey script submission

New
nobody
command (6)
Medium
2008-08-02
2008-08-02
Anonymous
No

Originally created by: kijoshua...@gmail.com

/*
Takes the items in the arguments and packages them in a folder for you.
*/

items =
name =

Loop %0%    ;build a suggestion for the folder path.  better suggestions could
be made, but I never got around to it.
{

    item := %A_Index%
    SplitPath, item, name, dir, ext, name_no_ext, drive
    break
}
;msgbox, %item%--%name%--%dir%--%ext%--%name_no_ext%--%drive%
InputBox,fname,Folder Name?, Please enter the folder name.  The path will
be relative to "%dir%" unless a full path is given,,,,,,,,%name_no_ext%   
;first item's name as the suggestion

if ErrorLevel
    return

;no need for trailing slashes
StringRight test, fname, 1
if test = \     StringTrimRight, fname, fname, 1

;check if user provided path is relative or not
IfInString fname, :
    destination = %fname%
else
    destination = %dir%\%fname%
   
FileCreateDir %destination%

if ErrorLevel
{
    Msgbox there was some error in creating the folder "%dir%\%fname%"
    return
}

Loop %0%
{
    item := %A_Index%
    FileGetAttrib, Attributes, %item%
    IfInString, Attributes, D
    {
        StringGetPos, break,item,\,[r1]
        break:=break+1
        StringTrimLeft, tail, item, %break%
        FileCreateDir %destination%\%tail%
        FileMoveDir %item%, %destination%\%tail%, 2
    }
    else
        FileMove %item%, %destination%   
       
    if ErrorLevel
        MsgBox error moving %item%                    ;meh
}
QUIT:
ExitApp

Related

Commit: [r1]

Discussion

  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: tortoisesvn

    (No comment was entered for this change.)

    Labels: -Type-Defect command

     
  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: tortoisesvn

    what's the filename this script should be saved under (file extension *.ahk ?)?
    I guess you have to have AutoHotKey installed?

     
  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: kijoshua...@gmail.com

    Actually, I'll compile them all and attach them to new comments.  Then they'll be
    regular .exe files.

    Otherwise, yes, they would have been .ahk files that would need AutoHotKey to run.

     
  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: kijoshua...@gmail.com

    Compiled version (doesn't require AutoHotKey to run)

     
  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: tortoisesvn

    Could you attach the ahk files too? I will then add both to our contrib folder - if
    someone already has autohotkey installed, they might rather use the scripts instead
    of the exe files.

    Also, I don't know if it's possible to attach exe files, you may have to zip them
    first (never tried to attach them to a comment, but I would assume that Google has
    some restrictions on content to upload here).

     
  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: tortoisesvn

    Also, could you add a comment to the files on how to configure the commandline in
    StExBar to use them?
    For example, I did that for tha 'attrib.js' file:
    https://code.google.com/p/stexbar/source/browse/trunk/StExBar/contrib/attrib.js

    We want to make it as easy as possible for people to use those scripts :)

     
  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: kijoshua...@gmail.com

    Here they all are (I leave for a second and look what happens.  Your really quick in
    dealing with all this!). 

    These are new versions containing better comments and support for %selafile.  Both
    source and compiled versions of the five scripts I had laying around.  I'm pretty
    sure they work fine, but I'll go test them again with the new version of StExBar just
    to make sure.  %selufile should work just the same as well.

     
  • Anonymous

    Anonymous - 2008-08-02

    Originally posted by: kijoshua...@gmail.com

    It may take me a while to compile the source (still downloading some prereqs).

    But I did a quick test using a temporary file I created myself, and everything worked
    as expected.

    I'm attaching a new set, because I forgot to put my name and a timestamp in the source...

    Thanks again for providing a much better way for me to put these scripts to good use
    (among other things)! 

    I really hope some more people start contributing.  I could post a notice in the
    AutoHotKey forums about this program if you'd like (or you could do it to make sure
    things get said the way you want).  I'm sure some of those scripters already have
    great ideas but are just waiting for a way to implement them.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.