topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Monday December 16, 2024, 3:00 am
  • 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

Last post Author Topic: IDEA: Create a containing folder by right clicking on a file  (Read 113308 times)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #25 on: July 30, 2007, 10:35 PM »
i posted here about a program that creates new folders from the context-menu. maybe the author will be interested in extending the program by adding the 'click on file' feature.. :)


Custom Folder v1.2


clif_notes

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 199
  • Clif Notes Newsletter
    • View Profile
    • Clif Notes Newsletter
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #26 on: July 30, 2007, 10:46 PM »
Here it is : FileNanny

;; FileNanny
;; "Go to your room !"
;; by ak
Loop, %0% {
param := %A_Index%
SplitPath param, fileName, dirName
StringSplit rawName, fileName, "."
dirToCreate = %dirName%\%rawName1%
FileCreateDir %dirToCreate%
FileMove %param%, %dirToCreate%
}

Actually, a nice solution is to put a shortcut to fileNanny.exe in the sendTo folder. It works with multiple files.

I quickly created an icon because i don't like software (even crappy little stuff like that) without icon, but i'm not sure the picture is very obvious (i hate using the mouse).

Wow AK. That's the program she wanted. Once the SendTo entry is created, it fits all the requirements that Marlene set forth.

Should I wait to see if Andy's context info can be implemented into FileNanny?

BTW - great name and good icon. I would never have imagined it - a pacifier as the icon. LOL

Thanks for the great effort.

Devoted to promoting freeware and free information

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #27 on: July 31, 2007, 02:45 AM »
I'm glad to see my little thingie does the job :)

Should I wait to see if Andy's context info can be implemented into FileNanny?
Andy's information is very interesting. Knowing this, it should be easy to add a config GUI to add/remove the context menu entry. I don't know when i'll have the time to work on it because right now i'm in holiday AND i have work to do (tell me about working at home and freedom :P) I think i'll have some time on friday so maybe we should consider that FileNanny is now 1.0 and will be 1.1 on friday :D
« Last Edit: July 31, 2007, 02:47 AM by ak_ »

jellydrop

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #28 on: July 31, 2007, 08:37 AM »
AK

Thanks so much for this little program. I have looked for something that will do this for years.

Marlene O

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #29 on: August 01, 2007, 03:05 PM »
Here's the update.

Just put filenanny.exe anywhere and launch it to run the configuration box. It allows you to add/remove context menu entry and/or 'Send to' shortcut.

filenanny_config.jpg

You can access the configuration box anytime by launching filenanny.exe again.

I've tested it a lot of times, it seems to be working well. Nevertheless, i'm not 100% happy with it. Indeed, the context menu method is slower than the sendto method because it loads the program for each file instead of passing all files as arguments and letting the script process the loop. If anyone has a solution, i'd be happy to read it :)

I'd also love to add the filenanny icon to the context menu entry but it seems to be quite difficult. Same here : if anyone knows how to do it, please tell me :)
« Last Edit: October 23, 2007, 11:48 AM by ak_ »

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #30 on: August 01, 2007, 04:29 PM »
brilliant. what a great way to set up an autohotkey script.

Grorgy

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 821
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #31 on: August 01, 2007, 05:19 PM »
This is great.  Just one thing, on my computer the quit box, the t ends up on a different line, probably using different fonts or something, maybe if you ever up date it a bit more room in there, but its purely aesthetics and for a program you run once and forget its not very important.

 :Thmbsup:

Just an edit to add screenshot after all a pic says a 1000 words lol
« Last Edit: August 01, 2007, 05:32 PM by Grorgy »

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #32 on: August 01, 2007, 11:22 PM »
Really cool, AK_.  :up:

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #33 on: August 02, 2007, 04:31 AM »
Grorgy> that's really weird, i don't see where the problem could be coming from. As you can see, the button is big enough to hold the text and there's no funny caracters in its label. Did you ever have a problem like this in other programs ?

If someone has the same problem, please let me know.

Armando> merci :)

Maybe someone will be interested in the code :

;; FileNanny
;; "Go to your room !"
;; by ak

#SingleInstance ignore
if 0 = 0 ; if fileNanny is launched without arguments
{
if strlen(winX) = 0
  winX := (A_Screenwidth - 180) / 2 ; if winX variable doesn't exist, window is centered
if strlen(winY) = 0
winY := (A_Screenheight - 130) / 2
gosub CreateGUI
}

else ; if there are arguments
{
Loop, %0% ; for each file
{
param := %A_Index%
SplitPath param, fileName, dirName ; we retrieve the folder and file name (with extension)
StringSplit rawName, fileName, "." ; rawname is the filename without extension
dirToCreate = %dirName%\%rawName1%  ; the folder to create is named after the file
FileCreateDir %dirToCreate% ; folder is created
FileMove %param%, %dirToCreate% ; the file is moved to the new folder
}
ExitApp
}
return

CreateGUI:
  gui destroy ; we destroy previous gui
  RegRead, regTest, HKEY_CLASSES_ROOT, *\shell\FileNanny ; check if the filenanny key exist
  if strlen(regTest) = 0 ; if it doesn't exist
  {
    button1Text = Add context menu item ; we set the label of the first button...
    button1Action = addCMI ; ... and its action
  }
  else
  {
    button1Text = Remove context menu item
    button1Action = remCMI
  }
 
  sendToFolder = %UserProfile%\SendTo ; path to "Send to" folder
  ifnotExist %sendToFolder%\filenanny.lnk ; if there's no filenanny shortcut in there
  {
    button2text = Add 'Send to' shortcut ; we set the label of the first button...
    button2action = addST ; ... and ? Its action, right.
  }
  else
  {
    button2text = Remove 'Send to' shortcut
    button2action = remST
  }
 
  Gui, Font, s9 w600
  Gui, Add, Text, x20 y10 w150 h20 , FileNanny configuration
  Gui font, norm
  Gui, Add, Button, x14 y35 w150 h30 g%button1Action%, %button1Text% ; the first button, with appropriate label etc
  Gui, Add, Button, x14 y75 w150 h30 g%button2Action%, %button2Text% ; the second button...
  Gui, Add, Button, x55 y120 w70 h30 gQuit, Quit
  Gui, Show, x%winX% y%winY% h160 w180, FileNanny
return

AddCMI: ; operations to add context menu item
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\shell\FileNanny, , FileNann&y this ; create the first key
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\shell\FileNanny\command, , "%A_ScriptFullPath%" "`%L" ; and the subkey
gosub refreshGUI ; we redraw gui because buttons must be changed
return

RemCMI: ; operations to remove context menu item
RegDelete HKEY_CLASSES_ROOT, *\shell\FileNanny ; remove FileNanny registry key
gosub refreshGUI ; we redraw gui because buttons must be changed
return

addST: ; operations to add 'Send to' shortcut
FileCreateShortcut, %A_ScriptFullPath%, %sendToFolder%\filenanny.lnk ; create a shortcut to filenanny.exe
gosub refreshGUI
return

remST: ; operations to remove 'Send to' shortcut
FileDelete, %sendToFolder%\filenanny.lnk ; shortcut is deleted
gosub refreshGUI
return

refreshGUI:
winId := WinExist("FileNanny") ; we retrieve FileNanny's unique id
WinGetPos winX, winY, , , ahk_id %winId% ; we store window coordinates in winX and winY
gosub CreateGUI
return

Quit:
GuiClose:
GuiEscape:
  ExitApp
return

Grorgy

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 821
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #34 on: August 02, 2007, 05:29 AM »
Well ak, it appears to be something to do with the windowblind im using, if i tell windowblinds to ignore it then it works ok, and I've had other programs not work, but none that have done this, this is new and exciting  ;D.  Anyway its no problem, the script does exactly what it says it will,  and its  only when you set it up that its seen anyway. 

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #35 on: August 02, 2007, 06:02 AM »
thanks for the code. (something i'll have to look at when i can dedicate a bit of time.)

wanderer

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 14
  • I never knew what real happiness was until I got m
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #36 on: October 17, 2007, 02:52 PM »
Fantastic idea. This is a keeper. Hope you continue to work on this but if not many thanks

( I know work gets in the way )
I never knew what real happiness was until I got married,......... by then, it was too late.

CleverCat

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,164
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #37 on: October 20, 2007, 02:28 AM »
When I click on filenanny.exe I get....Nothing?

CleverCat

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,164
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #38 on: October 20, 2007, 02:30 AM »
Re downloaded and working..... :D

Just what I need to organize my downloaded .exe files! :Thmbsup:
« Last Edit: October 20, 2007, 02:33 AM by CleverCat »

wolf.b

  • Member
  • Joined in 2007
  • **
  • Posts: 70
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #39 on: October 20, 2007, 03:34 PM »
Hi ak_,

really nice tool! Thank you.

Maybe the next version could have an edit field on the configuration dialogue. This would be a way to customize the text that appears in context menu. My entry would be "Go to your room !" (as found in the source code). But it might not be worth the effort because of error checking would have to be in place as well. I'm not sure what happens when you register a display string with punctuation characters. I will do a bit of research myself, but I have to go now and watch the snooker.

Please don't regard this as a feature request, it's just a thought. I really like utilities that are small, easy to set up and easy to use. Thanks for the code as well, I can translate the strings to display to German myself, if I need to do so for my family.


Greetings
Wolf
Schön wär's, wenn's schön wär!

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #40 on: October 20, 2007, 06:25 PM »
Hi :) Nice to see my little nanny is useful. Wolf.b, if i get some time, i'll add the edit field you asked for.

BigJim

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 178
  • I have seen the light!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #41 on: October 20, 2007, 07:13 PM »
AK, your little nanny is VERY useful. I use it daily - so a big 'thank you' from me, too.   :Thmbsup:

I'd like to be given the opportunity to edit the new folder name before it's processed so that I could, e.g. change "Filenanny.zip" to "File Nanny" for the folder name.

Keep up the fine work   :greenclp:
TruckerJim says "You can go down a hill too slow a thousand times. But too fast only once."

CleverCat

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,164
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #42 on: October 23, 2007, 03:44 AM »
AK, your little nanny is VERY useful. I use it daily - so a big 'thank you' from me, too.   :Thmbsup:

I'd like to be given the opportunity to edit the new folder name before it's processed so that I could, e.g. change "Filenanny.zip" to "File Nanny" for the folder name.

Keep up the fine work   :greenclp:

That would be nice if possible... :D

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #43 on: October 23, 2007, 11:47 AM »
filenanny-cartoon.jpg

I slightly updated FileNanny, i added the possibility to edit the folder name before its creation. All you have to do is hold the Shift key when you click the FileNanny context entry so it will open an input box before the folder is created. You can cancel the whole operation by clicking the Cancel button.

Enjoy :)
« Last Edit: October 23, 2007, 12:11 PM by ak_ »

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #44 on: October 23, 2007, 12:15 PM »
 ;D ;D

ak_ : thanks a lot for that script. It's really useful.  :-* (And --  I love the icon -- and your drawing.)

BigJim

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 178
  • I have seen the light!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #45 on: October 23, 2007, 02:03 PM »
Totally phantasmagorical! And wildly useful. Thanks, ak!!
TruckerJim says "You can go down a hill too slow a thousand times. But too fast only once."

ak_

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 223
    • View Profile
    • wopah
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #46 on: October 23, 2007, 04:34 PM »
Thanks, glad to see you like it.

I forgot to post the source code :
;; FileNanny
;; "Go to your room !"
;; by ak

GetKeyState kstate, Shift
if kstate = D
  editFolder = 1

#SingleInstance ignore
if 0 = 0
{
if strlen(winX) = 0
  winX := (A_Screenwidth - 180) / 2
if strlen(winY) = 0
winY := (A_Screenheight - 130) / 2
gosub CreateGUI
}

else
{
Loop, %0%
{
param := %A_Index%
SplitPath param, fileName, dirName
StringSplit rawName, fileName, "."
if editFolder = 1
{
  InputBox InputRawName, FileNanny, Name of the folder to create, , 320, 120, , , , , %rawName1%
  rawName1 = %InputRawName%
  if ErrorLevel
    ExitApp
}
dirToCreate = %dirName%\%rawName1%
FileCreateDir %dirToCreate%
FileMove %param%, %dirToCreate%
}
ExitApp
}
return

CreateGUI:
  gui destroy
  RegRead, regTest, HKEY_CLASSES_ROOT, *\shell\FileNanny
  if strlen(regTest) = 0
  {
    button1Text = Add context menu item
    button1Action = addCMI
  }
  else
  {
    button1Text = Remove context menu item
    button1Action = remCMI
  }
 
  sendToFolder = %UserProfile%\SendTo
  ifnotExist %sendToFolder%\filenanny.lnk
  {
    button2text = Add 'Send to' shortcut
    button2action = addST
  }
  else
  {
    button2text = Remove 'Send to' shortcut
    button2action = remST
  }
 
  Gui, Font, s9 w600
  Gui, Add, Text, x20 y10 w150 h20 , FileNanny configuration
  Gui font, norm
  Gui, Add, Button, x14 y35 w150 h30 g%button1Action%, %button1Text%
  Gui, Add, Button, x14 y75 w150 h30 g%button2Action%, %button2Text%
  Gui, Add, Button, x55 y120 w70 h30 gQuit, Quit
  Gui, Show, x%winX% y%winY% h160 w180, FileNanny
return

AddCMI:
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\shell\FileNanny, , FileNann&y this
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\shell\FileNanny\command, , "%A_ScriptFullPath%" "`%L"
gosub refreshGUI
return

RemCMI:
RegDelete HKEY_CLASSES_ROOT, *\shell\FileNanny
gosub refreshGUI
return

addST:
FileCreateShortcut, %A_ScriptFullPath%, %sendToFolder%\filenanny.lnk
gosub refreshGUI
return

remST:
FileDelete, %sendToFolder%\filenanny.lnk
gosub refreshGUI
return

refreshGUI:
winId := WinExist("FileNanny")
WinGetPos winX, winY, , , ahk_id %winId%
gosub CreateGUI
return

Quit:
GuiClose:
GuiEscape:
  ExitApp
return

nosh

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,441
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #47 on: October 24, 2007, 12:39 PM »
Handy little utility, ak_!  :)

A couple of tweaks that come to mind:

1. If a file has periods in the base name, the folder name gets truncated [everything_beyond_this.will_be_aborted.txt]

2. Extensionless files - not that these are very common but it'd be nice if they could be handled anyway.

Thanks.




CleverCat

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,164
    • View Profile
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #48 on: October 26, 2007, 01:32 AM »
The shift key to edit name doesn't work for me. :(

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,915
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Create a containing folder by right clicking on a file
« Reply #49 on: October 26, 2007, 01:42 AM »
ahhaahahahahaha that drawing is priceless