To organise my emails in Outlook, I use categories. I was wondering if this would be possible with files as well.
Does anyone know if there is a field / attribute of files that is common to all file types that isn't the filename?
If there isn't a separate field, I created a tool (see code below) that will allow a user to specify three individual letters to add as a prefix to the currently selected file. If my only option is to rename files, how can I loop through the currently selected files to rename all that are selected?
Code: Select all
#SingleInstance, Force
F3::
;https://autohotkey.com/board/topic/57362-retrieve-the-name-of-the-currently-selected-files/#entry360328
clipboard =
Send, ^c
Clipwait, 3
FullPath := clipboard
;MsgBox, % "FullPath: " FullPath
;https://autohotkey.com/board/topic/98215-get-the-file-extension/#entry618424
StringGetPos, PosA, FullPath, ., R
StringRight, CurrentExt, FullPath, % StrLen(FullPath)-PosA ;-1
;MsgBox, % "CurrentExt: " CurrentExt
clipboard =
Send, {F2}
Sleep, 25
Send, ^c
Clipwait, 3
FilePath := clipboard
;MsgBox, % "Filepath: " FilePath
ParentPath := SubStr(FullPath,1, StrLen(FullPath)-( StrLen(FilePath) + StrLen(CurrentExt) ))
;MsgBox, % "ParentPath: " ParentPath
clipboard =
;-------------------------------------------------------------
Gui, FileRename:New, +AlwaysOnTop +ToolWindow +Resize
Gui, Add, Text, x10, Prefix 1:
Gui, Add, Edit, x+5 w50 vPF1
Gui, Add, Text, x10 y+10, Prefix 2:
Gui, Add, Edit, x+5 w50 vPF2
Gui, Add, Text, x10 y+10, Prefix 3:
Gui, Add, Edit, x+5 w50 vPF3
Gui, Add, Button, x150 y+17 w225 h40 gAddPrefix, `r Add Prefix
Gui, FileRename:Show, w420 h300, - FileSort -
Return
;-------------------------------------------------------------
AddPrefix:
;Gui, Submit, NoHide
GuiControlGet, PF1
GuiControlGet, PF2
GuiControlGet, PF3
FilePrefix := PF1 . PF2 . PF3 . "_"
;msgbox % "The prefix is: " FilePrefix
;msgbox % "New full path: " ParentPath . FilePrefix . FilePath . CurrentExt
NewFullPath := ParentPath . FilePrefix . FilePath . CurrentExt
FileMove, %FullPath%, %NewFullPath%
if (ErrorLevel)
msgbox Error; can't rename file.
Return
;-------------------------------------------------------------