Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Downnote - an addition to FileNote


  • Please log in to reply
No replies to this topic
msel
  • Members
  • 6 posts
  • Last active: May 07 2013 12:49 PM
  • Joined: 22 Jul 2005
Edit:
I've removed one bug (folder with . in name, like Install.Files) and added two buttons:
Close (closes the program)
Delete (which deletes a corresponding text file to a folder / file).

This program creates textfiles to folders or files with the same name to enter description for folders & files.
It uses for editing the freeware program PSPad, http://www.pspad.com/en/.
You might use also other editors. In this case you have to change the locations in the lines which begin with Run
Usage:
1. Open Folder to which you want add descriptions: Button Folder
2. Select Files and Folders from the listview element to which you want to add descriptions. Example:
Backup | Backup.txt: To the folder Backup a file with name Backup.txt exists. In this case the Backup.txt file is opening for editing.
Backup | new: No description file to the folder exists. A new file is created (empty or by template).
File1.txt | File1.txt: No source file or folder exists to the text file. The text file is opening for editing.
3. If you want to use empty file templates you can use the button FileNote. It will create or open text files to the selected files & folders in PsPad Editor. There you can edit / view the content.
4. If you want to use templates you can use the button FileNoteTemplate. You have to select a text template and then the template is used for the new text files which are created. Existing files are only opened for editing.
5. To modify the view after creating the files use the button Modify.
6. You may also use the program FileNote in addition. See http://www.autohotke...opic.php?t=4595
7. What to do next:
+ Add button to combine selected text files.
? Add button to search in text with grep or agrep.

; DownNote
; Version 0.2
; Generated using SmartGUI Creator 3.4
; Author: Maria Seliger
; This program creates textfiles to folders or files with the same name to
; enter description for folders & files.
; It uses for editing the freeware program PSPad, http://www.pspad.com/en/.
; You might use also other editors. In this case you have to change the locations
; in the lines which begin with Run
; Usage:
; 1. Open Folder to which you want add descriptions: Button Folder
; 2. Select Files and Folders from the listview element to which you want to
;    add descriptions. Example:
; Backup | Backup.txt: To the folder Backup a file with name Backup.txt exists.   
; In this case the Backup.txt file is opening for editing.
; Backup | new: No description file to the folder exists. A new file is created
; (empty or by template).
; File1.txt | File1.txt: No source file or folder exists to the text file. The
; text file is opening for editing.
; 3. If you want to use empty file templates you can use the button FileNote.
;    It will create or open text files to the selected files & folders in PsPad
;    Editor. There you can edit / view the content.
; 4. If you want to use templates you can use the button FileNoteTemplate.
;    You have to select a text template and then the template is used for the
;    new text files which are created. Existing files are only opened for editing.
; 5. To modify the view after creating the files use the button Modify.
; 6. You may also use the program FileNote in addition. 
;    See http://www.autohotkey.com/forum/viewtopic.php?t=4595
; 7. Button Close: Closes the program.
; 8. Button Delete: Deletes corresponding text files to files / folders.
; 9. What to do next:
;    Add button to combine selected text files.
;    ? Add button to search in text with grep or agrep.
Gui, Add, ListView, x6 y47 w450 h410, File|FileNote
Gui, Add, Button, x476 y67 w150 h30, FileNote
Gui, Add, Button, x476 y107 w150 h30, FileNoteTemplate
Gui, Add, Button, x476 y307 w150 h30, Modify
Gui, Add, Button, x476 y347 w150 h30, Delete
Gui, Add, Button, x476 y387 w150 h30, About
Gui, Add, Button, x476 y427 w150 h30, Close
Gui, Add, Button, x476 y7 w150 h30, Folder
Gui, Add, Edit, x6 y7 w450 h30 r2 vFolderpath
; Gather a list of file names from a folder and put them into the ListView:

Gui, Show, x173 y146 h483 w635, FileNote
return

ButtonFolder:
   FileSelectFolder, OutputVar, , 0, Select Folder
   if OutputVar =
     Gui, Show, x173 y146 h483 w635, FileNote
   else
     GoSub, Browse
   Gui, Show, x173 y146 h483 w635, FileNote
   return

ButtonFileNote:
   RowNumber = 0  ; first loop iteration to start search at the top of the list
   Loop
   {
      RowNumber:= LV_GetNext(RowNumber) ; first selected element
      if not RowNumber  ; zero = no more selected rows
		    break
      LV_GetText(Text, RowNumber)
      GoSub, GetFileName
      Sleep 100 ; this is because sometimes PsPad fails to open the files correctly
                 ; if you have problems increase time
	    Run, C:\Programme\PSPad\PsPad.exe "%filename%"
    }
    GoSub ButtonModify
    Gui, Show, x173 y146 h483 w635, FileNote
    return

ButtonFileNoteTemplate:
; select template
   FileSelectFile, SelectedFile, , , Open Template for FileNote, Text Documents (*.txt)
; create files or open file if it already exist
  RowNumber = 0  ; first loop iteration to start search at the top of the list
   Loop
   {
      RowNumber:= LV_GetNext(RowNumber) ; first selected element
      if not RowNumber  ; zero = no more selected rows
		    break
      LV_GetText(Text, RowNumber)
      GoSub, GetFileName
      IfNotExist, %filename%
        FileCopy, %SelectedFile%, %filename%
      Sleep, 100 ; this is because sometimes PsPad fails to open the files correctly
                 ; if you have problems increase time
      Run, C:\Programme\PSPad\PsPad.exe "%filename%"
   } 
   GoSub ButtonModify
   Gui, Show, x173 y146 h483 w635, FileNote
   return

ButtonDelete:
   RowNumber = 0  ; first loop iteration to start search at the top of the list
   Loop
   {
      RowNumber:= LV_GetNext(RowNumber) ; first selected element
      if not RowNumber  ; zero = no more selected rows
		    break
      LV_GetText(Text, RowNumber)
      GoSub, GetFileName
      IfExist, %workfolder%%filename%
      {
      Msgbox, 4, Delete File, Do you want to delete the file %workfolder%%filename%?
      IfMsgbox, Yes
      {
         FileDelete, %workfolder%%filename%
         GoSub, ButtonModify
      }
      }
   }
   Gui, Show, x173 y146 h483 w635, FileNote
   return

ButtonModify:
   if OutputVar<>
      GoSub, Browse
   if OutputVar =
      Gui, Show, x173 y146 h483 w635, FileNote
   else
      GoSub, Browse
   Gui, Show, x173 y146 h483 w635, FileNote
   return


ButtonAbout:
   Msgbox DownNote Program created by Maria Seliger, Version 0.1, Usage see SourceCode!
   Gui, Show, x173 y146 h483 w635, FileNote
   return

Browse:
  LV_Delete() ; Delete content of listview
  GuiControl, , Folderpath, %OutputVar%
  SetWorkingDir, %OutputVar%
  Searchstring=
  extension=txt
  workfolder=%A_WorkingDir% ; for later use
  Loop, %A_WorkingDir%\*.*,1,0 ; collects only files and folders which are not
                               ; text files
  {
    nameoffile=%A_LoopFileName%
    if A_LoopFileExt<>%extension%
       Searchstring=%Searchstring% %nameoffile%
  }
  Loop, %A_WorkingDir%\*.*,1,0
  {
        point=.
        nameoffile=%A_LoopFileName%
        IfInString, nameoffile, %point%
        {
          StringTrimRight, filename, nameoffile, 4 
          filename=%filename%.txt
          StringTrimRight, filename2, nameoffile, 4
        }
        else
          filename=%nameoffile%.txt
        IfExist, %OutputVar%\%filename%
        {
          IfNotInString, Searchstring, %filename2%
            LV_Add("", nameoffile, filename)
          else
          {
          If nameoffile<>%filename%
            LV_Add("", nameoffile, filename)
          }
        }
        else
          {
            filename=new
	          LV_Add("", A_LoopFileName, filename)
	      }
      }
     LV_ModifyCol(1)  ; Auto-size first column to fit its contents
      return

GetFileName:
      point=.
      nameoffile=%Text%
      If A_LoopFileSize > 0
      {
        StringTrimRight, filename, nameoffile, 4 
        filename=%filename%.txt
      }
      else
        filename=%nameoffile%.txt
      return

ButtonClose:
   GoSub GuiClose

GuiClose:
ExitApp
Greetings, Maria!