ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Create a containing folder by right clicking on a file

<< < (15/27) > >>

BigJim:
to DonationCoder!

Doh!-shinigamijusan (January 30, 2008, 04:21 PM)
--- End quote ---

Think you could elaborate on that comment??

nogojoe:
I think i'll add a config window with a few options, like :
- custom context-menu text
- convert . - _ %20 to spaces in folder name
- "Custom folder mode" as described there :
It seems to me, though, that the times that you would NOT want to do some small edit of the folder name are very few. I would favor having it go directly to the rename box by default and do away with the shift key altogether. If you didn't want to make a change you're already a lot of clicks and keystrokes ahead of the game and could simply hit the OK button.-BigJim
--- End quote ---

Any ideas are welcome :)
-ak_ (November 05, 2007, 11:20 AM)
--- End quote ---

Thanks AK for filenanny.  :Thmbsup:

Have just picked up a bug. :down:

Tried to convert a file named PremiumBooster.zip and it wouldn’t do the business after successfully converting several hundred files without any problem.

Took a hunch and put a space between Premium and Booster and it worked OK  :up:

nogojoe

ak_:
Ok, it's been quite a long time :)

Here's the latest version of FileNanny.
[attachmini=#1][/attachmini]

What's new ?

* File name is now FileNanny with two capital letters (that's for Curt)
* You can choose your own context menu text from the GUI
* You can choose wether you want . - _ and %20 converted to spaces or not
* Two modes : you can modify folder name only if you press Shift while launching FileNanny OR you can always modify folder name unless you press Shift while launching FileNanny (you choose that in the GUI)
* FileNanny doesn't mess up with files containing multiple dots anymore (only the extension is removed)
* Files without extension are handled
I think that's it :) Any proposition or bug report is welcome. By the way, nogojoe, i have no idea where the bug you talk about comes from. It's really weird.

Here's the code, i think it's quite messy but i don't really feel like cleaning it up right now :)
Spoiler
--- ---;; FileNanny
;; "Go to your room !"
;; by ak

#SingleInstance ignore
iniFile = %A_ScriptDir%\FileNanny.ini
if 0 = 0
{
gosub CreateGUI
gosub checkboxes
}

else
{
Iniread shiftKey, %iniFile%, options, shiftKey
GetKeyState kstate, Shift
if (shiftKey = 1 and kstate = "D")
  editFolder = 1
if (shiftKey = 0 and kstate = "U")
  editfolder = 1
Loop, %0%
{
param := %A_Index%
SplitPath param, fileName, dirName, extension, fileNameNoExt
rawName = %fileNameNoExt%
gosub convert
if editFolder = 1
{
  InputBox InputRawName, FileNanny, Name of the folder to create, , 320, 120, , , , , %rawName%
  rawName = %InputRawName%
  if ErrorLevel
    ExitApp
}
FileMove %param%, %param%.FileNanny
dirToCreate = %dirName%\%rawName%
FileCreateDir %dirToCreate%
FileMove %param%.FileNanny, %param%
fileNewName = %rawName%.%extension%
FileMove %param%, %dirToCreate%\%fileNewName%
}
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, Add, Button, x126 y195 w70 h30 gQuit, Quit
  Gui, Add, Tab, x3 y5 w315 h230 vSelectedTab, Configuration|Options
  Gui, Font, s9 w600
  Gui tab, Configuration
  Gui font, norm
  Gui, Add, Button, x90 y65 w140 h30 g%button1Action% vCMIb, %button1Text%
  Gui, Add, Button, x90 y125 w140 h30 g%button2Action% vSTb, %button2Text%
  Gui tab, Options
  if strlen(regTest) = 0
  {
    regTest = n/a
    disabledOrNot = disabled
  }
  Gui, Add, text, x26 y59 w190 h20 vCurrentCMI, Current : %regTest%
  Gui, Add, Button, x226 y55 w70 h20 %disabledOrNot% gchangeCMI vCMIc, Change
  Gui, Add, GroupBox, x16 y35 w290 h50 , Context menu text
  Gui, Add, CheckBox, x16 y95 w300 h30 vshiftKey gini, Holding the Shift key is required to modify `nfolder name before its creation
  Gui, Add, GroupBox, x16 y135 w290 h50 , Convert these to spaces
  Gui, Add, CheckBox, x30 y150 w50 h30 vconvDot gini, .
  Gui, Add, CheckBox, x80 y150 w50 h30 vconvMinus gini, -
  Gui, Add, CheckBox, x130 y150 w50 h30 vconvUnderscore gini, _
  Gui, Add, CheckBox, x180 y150 w50 h30 vconvPercent gini, `%20
  Gui, Show, h240 w320, FileNanny
return

ini:
Gui submit, NoHide
Iniwrite %shiftKey%, %iniFile%, options, shiftkey
Iniwrite %convDot%, %iniFile%, convert, dots
Iniwrite %convMinus%, %iniFile%, convert, minus
Iniwrite %convUnderscore%, %iniFile%, convert, underscore
Iniwrite %convPercent%, %iniFile%, convert, percent
return

checkBoxes:
Iniread shiftKey, %iniFile%, options, shiftKey
Iniread convDot, %iniFile%, convert, dots
Iniread convMinus, %iniFile%, convert, minus
Iniread convUnderscore, %iniFile%, convert, underscore
Iniread convPercent, %iniFile%, convert, percent
Guicontrol ,,shiftKey, %shiftKey%
Guicontrol ,,convDot, %convDot%
Guicontrol ,,convMinus, %convMinus%
Guicontrol ,,convUnderscore, %convUnderscore%
Guicontrol ,,convPercent, %convPercent%
return

convert:
Iniread convDot, %iniFile%, convert, dots
Iniread convMinus, %iniFile%, convert, minus
Iniread convUnderscore, %iniFile%, convert, underscore
Iniread convPercent, %iniFile%, convert, percent
if convDot = 1
  StringReplace rawName, rawName, ., %A_SPACE%, A
 
if convMinus = 1
  StringReplace rawName, rawName, -, %A_SPACE%, A
 
if convUnderscore = 1
  StringReplace rawName, rawName, _, %A_SPACE%, A
 
if convPercent = 1
  StringReplace rawName, rawName, `%20, %A_SPACE%, A
return

ChangeCMI:
RegRead, regTest, HKEY_CLASSES_ROOT, *\shell\FileNanny
transform,eperluette,chr,0x26
Inputbox newCMI, Enter new context menu text, Please choose the text that will appear in the context menu., , , , , , , , %regTest%
If ErrorLevel
{
  return
}
else
{
  RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\shell\FileNanny, , %newCMI%
  Guicontrol,, currentCMI, Current : %newCMI%
}
return

AddCMI:
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\shell\FileNanny, , FileNann&y !
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\shell\FileNanny\command, , "%A_ScriptFullPath%" "`%L"
Guicontrol,, CMIb, Remove context menu item
Guicontrol +gremCMI, CMIb
Guicontrol,, currentCMI, Current : FileNann&y !
Guicontrol enable, CMIc
return

RemCMI:
RegDelete HKEY_CLASSES_ROOT, *\shell\FileNanny
Guicontrol,, CMIb, Add context menu item
Guicontrol +gaddCMI, CMIb
Guicontrol,, currentCMI, Current : n/a
Guicontrol disable, CMIc
return

addST:
FileCreateShortcut, %A_ScriptFullPath%, %sendToFolder%\filenanny.lnk
Guicontrol,, STb, Remove 'Send to' shortcut
Guicontrol +gremST, STb
return

remST:
FileDelete, %sendToFolder%\filenanny.lnk
Guicontrol,, STb, Add 'Send to' shortcut
Guicontrol +gaddST, STb
return

Quit:
GuiClose:
GuiEscape:
  ExitApp
return

nosh:
That's awesome, ak_! :up: Thanks!

Edit: The version numbers are now left untouched, as intended, but I'm getting slightly strange behavior reg. replacing underscores with spaces. It replaces underscores if the target file is in D:\Tools, where I have the FileNanny executable. The underscores aren't replaced if the target file is at another location (including D:\). I even did a system restart to make sure it was the latest version in operation. Is this something to do with the .ini variables being local to that folder only?

Just to clarify, I'm perfectly happy with the app now that version numbers are untouched, this is simply feedback.

ak_:
Glad you like it nosh, and thanks a lot for the feedback. I ran all my tests with files within the FileNanny folder, that's why i never spotted this bug. It's corrected now :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version