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

<< < (7/27) > >>

nudone:
brilliant. what a great way to set up an autohotkey script.

Grorgy:
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

Armando:
Really cool, AK_.  :up:

ak_:
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:
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. 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version