' Command.File_Tagger.vbs(.txt) ' Tagger is a script Add-In for Directory Opus. ' The pupose of Tagger is to comfortably show, find, edit, replace, add or delete ' Tags or Comment and Rating for files and folders. ' Tagger provides a dialog which shows all tags or the comment of ' a single file in a list where you can directly edit each tag. ' You can also select a range of files. Tagger will then show ' tags or comment and rating if they exist in all selected files. ' You can search for a certain tag, a rating value (0-5) or for ' comments containing a certain string by entering the search string ' in the main input field and pressing the hotkey alt+f. ' Tagger will select all files containing the specified tag, comment or rating ' and show the shared string in the list or ign the rating input field. ' For comment Tagger shows all comments containing the search string in the list ' and the index of the file that contains the comment in a second column. ' You can always edit tags or comment in the list, change rating or ' add/replace/delete tags or comment for each selected file or folder ' using the "Apply" or "Delete" button. ' The Delete button will delete all tags or the comment of all selected files ' if no items are selected in the list. Otherwise the button will only delete ' the selected items from all selected files. Option Explicit Dim all, arg, cmd, dict, dlg, index, input, lang, lastFile, lastIndex, strIndex,_ strRange, tagString, selComment, selRating, selTags, source, vecComment Function OnInit(data) ' Called by Directory Opus to initialize the script Dim desc, url, uid data.name = "Command.File: Tagger" data.copyright = "(c) 2016 Kundal" data.version = "3.4" data.min_version = "13.0.36" data.log_prefix = "Tagger" data.default_enable = True data.url = "https://resource.dopus.com/viewtopic.php?f=35&t=28314" data.desc = GetString("desc", lang) uid = "D05B5BAC-46D9-4E1E-886C-5D98B14EBFC7" ' Script configuration data.config_desc = DOpus.Create.Map data.config.conf_Language = DOpus.Create.Vector(0, "default", "english", "deutsch", "français") data.config_desc("conf_Language") = GetString("lang", lang) data.config.conf_ShowIndexColumn = True data.config_desc("conf_ShowIndexColumn") = GetString("index", lang) data.config.conf_MyHotkey = "alt+v" data.config.conf_MyCommand = "" ' Tagger hotkeys data.config.Hot_Apply = "alt+a" data.config_desc("Hot_Apply") = GetString("apply", lang) data.config.Hot_Delete = "alt+d" data.config_desc("Hot_Delete") = GetString("remove", lang) data.config.Hot_Copy = "alt+c" data.config_desc("Hot_Copy") = GetString("copy", lang) data.config.Hot_First = "home" data.config.Hot_Last = "end" data.config.Hot_Next = "alt+SPACE" data.config_desc("Hot_Next") = GetString("next", lang) data.config.Hot_NextV = "pagedown" data.config_desc("Hot_NextV") = GetString("next", lang) data.config.Hot_Previous = "ctrl+SPACE" data.config_desc("Hot_Previous") = GetString("prev", lang) data.config.Hot_PreviousV = "pageup" data.config_desc("Hot_PreviousV") = GetString("prev", lang) data.config.Hot_Mode = "alt+m" data.config_desc("Hot_Mode") = GetString("mode", lang) data.config.Hot_Lock = "alt+l" data.config_desc("Hot_Lock") = GetString("lock", lang) data.config.Hot_Find = "alt+f" data.config_desc("Hot_Find") = GetString("find", lang) data.config.Hot_Sort = "alt+s" data.config_desc("Hot_Sort") = GetString("sort", lang) data.config.Hot_Refresh = "alt+F5" data.config_desc("Hot_Refresh") = GetString("refresh", lang) data.config.Hot_Rating0 = "alt+0" data.config.Hot_RatingN0 = "alt+NUM0" data.config.Hot_Rating1 = "alt+1" data.config.Hot_RatingN1 = "alt+NUM1" data.config.Hot_Rating2 = "alt+2" data.config.Hot_RatingN2 = "alt+NUM2" data.config.Hot_Rating3 = "alt+3" data.config.Hot_RatingN3 = "alt+NUM3" data.config.Hot_Rating4 = "alt+4" data.config.Hot_RatingN4 = "alt+NUM4" data.config.Hot_Rating5 = "alt+5" data.config.Hot_RatingN5 = "alt+NUM5" data.config.Hot_CopyFile = "ctrl+alt+c" data.config.Hot_CutFile = "ctrl+alt+x" data.config.Hot_CopyFileTo = "ctrl+shift+c" data.config.Hot_MoveFileTo = "ctrl+shift+v" data.config.Hot_DeleteFile = "alt+delete" ' Viewer hotkeys data.config.vHot_Help = "F1" data.config.vHot_Info = "F10" data.config.vHot_Meta = "F9" data.config.vHot_ShowMark = "ctrl+m" data.config.vHot_ShortcutBar = "ctrl+l" data.config.vHot_StatusBar = "ctrl+b" data.config.vHot_ToolBar = "ctrl+n" data.config.vHot_Print = "ctrl+p" data.config.vHot_Mark = "ctrl+alt+m" data.config.vHot_FirstMark = "ctrl+up" data.config.vHot_LastMark = "ctrl+down" data.config.vHot_NextMark = "ctrl+right" data.config.vHot_PrevMark = "ctrl+left" data.config.vHot_ReturnMark = "ctrl+alt+SPACE" data.config.vHot_Fullscreen = "alt+ENTER" data.config.vHot_ScrollDown = "alt+down" data.config.vHot_ScrollUp = "alt+up" data.config.vHot_ScrollRight = "alt+right" data.config.vHot_ScrollLeft = "alt+left" data.config.vHot_ZoomReset = "alt+o" data.config.vHot_ZoomReset2 = "alt+NUM*" data.config.vHot_ZoomGrow = "ctrl+g" data.config.vHot_ZoomFit = "ctrl+f" data.config.vHot_ZoomPlus = "ctrl++" data.config.vHot_ZoomMinus = "ctrl+-" data.config.vHot_ZoomPlusN = "ctrl+NUM+" data.config.vHot_ZoomMinusN = "ctrl+NUM-" data.config.vHot_Zoom25 = "ctrl+1" data.config.vHot_Zoom50 = "ctrl+2" data.config.vHot_Zoom75 = "ctrl+3" data.config.vHot_Zoom150 = "ctrl+4" data.config.vHot_Zoom200 = "ctrl+5" data.config.vHot_Zoom300 = "ctrl+6" data.config.vHot_Zoom400 = "ctrl+7" data.config.vHot_Zoom800 = "ctrl+8" data.config.vHot_Rotate0 = "ctrl+alt+0" data.config.vHot_Rotate90 = "ctrl+alt+1" data.config.vHot_Rotate180 = "ctrl+alt+2" data.config.vHot_Rotate270 = "ctrl+alt+3" data.config.vHot_RotateLeft = "ctrl+alt+l" data.config.vHot_RotateRight = "ctrl+alt+r" data.config.vHot_FlipHorizontal = "ctrl+alt+h" data.config.vHot_FlipVertical = "ctrl+alt+v" data.config.vHot_Alpha = "ctrl+shift+a" data.config.vHot_GammaPlus = "ctrl+shift+NUM+" data.config.vHot_GammaMinus = "ctrl+shift+NUM-" data.config.vHot_GammaReset = "ctrl+shift+NUM*" data.config.vHot_Save = "ctrl+s" data.config.vHot_SaveAs = "ctrl+shift+s" data.config.vHot_Convert = "ctrl+i" data.config.vHot_Crop = "ctrl+r" data.config.vHot_Restore = "ctrl+z" data.config.vHot_Reselect = "ctrl+shift+r" ' Script command "Tagger" Set cmd = data.AddCommand cmd.name = "Tagger" cmd.method = "OnTagger" cmd.label = "Tagger" cmd.template = "APP/K,CLOSEAPP/O,CONFIRMDELETE/S,FILTER/K,NOFOLDERS/S,OPACITY/K,READONLY/S,VIEWER/S" cmd.desc = GetString("desc", lang) &vbCrLf&vbCrLf& data.url End Function Function OnAboutScript(data) ' ScriptWizard "About" dialog Set cmd = DOpus.Create.Command() If (Not cmd.Commandlist("s").exists("ScriptAbout")) Then If (DOpus.Dlg.Request(GetString("noabout", lang), _ GetString("butabout", lang), GetString("titleabout", lang), data.window) =1) _ Then cmd.RunCommand("http://resource.dopus.com/viewtopic.php?f=35&t=23179") Else cmd.SetModifier "runmode", "hide" cmd.RunCommand("ScriptAbout WIN="&data.window&" FILE="""&Script.File&"""") End If End Function Function GetFiles(data, source) ' Read folder, get valid files and initialize dictionary Dim col, colIndex, i, itemData, tag Set arg = data.func.args Set cmd = data.Func.Command Set dict = CreateObject ("Scripting.Dictionary") Set vecComment = DOpus.Create.Vector dict.CompareMode = vbTextCompare strIndex = "" tagString = "" dict.RemoveAll source = cmd.sourcetab.path ' If only one folder was selected open that folder If cmd.sourcetab.selected.count <> 0 Then If (cmd.sourcetab.selected.count = 1 _ And cmd.sourcetab.selected(0).is_dir = True) Then If arg.got_arg.viewer = True Then If IsObject(data.Func.viewer) Then If Not data.Func.viewer.current.path = cmd.sourcetab.path Then cmd.RunCommand("Go " & """" & data.Func.viewer.current.path & """") End If cmd.sourcetab.Update End If Else If arg.got_arg.nofolders = True Then Cmd.RunCommand("Go " & """" & cmd.sourcetab.selected(0) & """") cmd.RunCommand("Select FIRST TYPE=files") End If cmd.sourcetab.Update End If End If End If ' Arguments "NOFOLDER" and "VIEWER" If (arg.got_arg.nofolders = True _ Or arg.got_arg.viewer = True) Then cmd.RunCommand("Set HIDEFILTERFOLDERS=""""") cmd.RunCommand("Set HIDEFILTERFOLDERS=""*""") End If ' Argument "FILTER" If arg.got_arg.filter = True Then cmd.RunCommand("Set SHOWFILTERFILENAME *.*") cmd.RunCommand("Set SHOWFILTERFILENAME " & arg.filter) End If cmd.sourcetab.Update ' Exit function if sourcetab is empty If cmd.sourcetab.all.count = 0 Then If arg.got_arg.filter = True Then cmd.RunCommand("Set SHOWFILTERFILENAME *.*") End If If (arg.got_arg.nofolders = True _ Or arg.got_arg.viewer = True) Then cmd.RunCommand("Set HIDEFILTERFOLDERS=""""") End If Exit Function End If ' Column "index" For Each col In cmd.sourcetab.format.columns If col = "index" Then colIndex = True Next If colIndex = False Then If Script.config.conf_ShowIndexColumn = True Then cmd.RunCommand("Set COLUMNSADD=index(0)") End If End If ' Select first item if nothing was selected If cmd.sourcetab.selected.count = 0 Then cmd.RunCommand("Select FIRST") End If ' Add selected files cmd.sourcetab.Update all = cmd.sourcetab.all.count lastFile = cmd.sourcetab.selected(0) For i=0 To all -1 Set itemData = DOpus.FSUtil.GetMetadata(cmd.sourcetab.all(i)) 'If Not IsEmpty(itemData.tags) Then For Each tag In itemData.tags tagString = tagString & tag & ";" Next If itemData.tags.count >1 Then tagString = StringSort(tagString) 'End If If Not dict.Exists(cmd.sourcetab.all(i).id) Then dict.Add cmd.sourcetab.all(i).id, array(i+1,tagString,itemData.other.usercomment,itemData.other.rating) End If If cmd.sourcetab.all(i) = lastFile Then lastIndex = i+1 End If If cmd.sourcetab.all(i).selected = True Then index = i+1 strIndex = strIndex & "," strIndex = strIndex & index End If tagString = "" Next strIndex = right(strIndex, len(strIndex) - 1) If arg.got_arg.app = True Then cmd.RunCommand(arg.app & " " & """" & lastFile & """") End If If arg.got_arg.viewer = True Then If IsObject(data.Func.viewer) Then Script.vars.Set "viewer", data.Func.viewer data.Func.viewer.Command("listerlink") data.Func.viewer.title = "Tagger - %T" Else If IsObject(DOpus.viewers.lastactive) Then DOpus.viewers.lastactive.Command "close" End If End If End If cmd.ClearFiles cmd.SetFiles cmd.sourcetab.selected GetRange data, strRange End Function Function OnTagger(data) ' Create and show the "Tagger" dialog Dim colIndex, combo1Change, combo2Change,_ dblclkList, edList, file, edRange, hotmode, i, j, match, matches, msg,_ oldStrg, newStrg, reg, srcChange, tag, tagStrg tagStrg = "" GetFiles data, source If lastFile = "" Then Exit Function ' Dialog language If Script.config.conf_language = 1 Then lang = "english" ElseIf Script.config.conf_language = 2 Then lang = "deutsch" ElseIf Script.config.conf_language = 3 Then lang = "francais" Else lang = DOpus.language End If ' Create dialog Set dlg = data.Func.Dlg dlg.template = "Tagger" dlg.detach = True dlg.position = "parent" dlg.language = lang dlg.opacity = arg.opacity If arg.got_arg.viewer = True Then dlg.LoadPosition("KundalViewer") Else dlg.LoadPosition("Kundal") End If dlg.Create ' Apply unicode symbols and initial values If arg.got_arg.readonly = True Then dlg.Control("combo2").enabled = False dlg.Control("editrating").enabled = False dlg.Control("ApplyButton").enabled = False dlg.Control("DeleteButton").enabled = False End If If data.func.qualifiers = "ctrl" Then dlg.Control("combo1").value = 1 Else dlg.Control("combo1").value = 0 End If dlg.Control("editmain").value = "+" dlg.Control("combo2").RemoveItem(0) dlg.Control("combo2").InsertItemAt 0, ChrW(9660) dlg.Control("combo2").RemoveItem(1) dlg.Control("combo2").InsertItemAt 1, ChrW(9650) dlg.Control("combo2").RemoveItem(2) dlg.Control("combo2").InsertItemAt 2, " " & ChrW(9209) dlg.Control("NextButton").label = ChrW(9660) dlg.Control("PrevButton").label = ChrW(9650) dlg.Control("static2").label = ChrW(9733) dlg.Control("editmain").SelectRange 1,-1 dlg.Control("check1").value = False dlg.Control("combo2").value = 0 dlg.Control("static1").fg("30,50,177") dlg.Control("static1").style("b") dlg.Control("static2").fg("255,180,0") dlg.Control("list").columns.GetColumnAt(0).resize = True ' Apply hotkeys dlg.AddHotkey "myhotkey",Script.config.conf_MyHotkey dlg.AddHotkey "apply",Script.config.Hot_Apply dlg.AddHotkey "delete",Script.config.Hot_Delete dlg.AddHotkey "first",Script.config.Hot_First dlg.AddHotkey "last",Script.config.Hot_Last dlg.AddHotkey "next",Script.config.Hot_Next dlg.AddHotkey "nextv",Script.config.Hot_NextV dlg.AddHotkey "previous",Script.config.Hot_Previous dlg.AddHotkey "prevv",Script.config.Hot_PreviousV dlg.AddHotkey "copy",Script.config.Hot_Copy dlg.AddHotkey "lock",Script.config.Hot_Lock dlg.AddHotkey "sort",Script.config.Hot_Sort dlg.AddHotkey "mode",Script.config.Hot_Mode dlg.AddHotkey "refresh",Script.config.Hot_Refresh dlg.AddHotkey "metaFind",Script.config.Hot_Find dlg.AddHotkey "rating0",Script.config.Hot_Rating0 dlg.AddHotkey "ratingn0",Script.config.Hot_RatingN0 dlg.AddHotkey "rating1",Script.config.Hot_Rating1 dlg.AddHotkey "ratingn1",Script.config.Hot_RatingN1 dlg.AddHotkey "rating2",Script.config.Hot_Rating2 dlg.AddHotkey "ratingn2",Script.config.Hot_RatingN2 dlg.AddHotkey "rating3",Script.config.Hot_Rating3 dlg.AddHotkey "ratingn3",Script.config.Hot_RatingN3 dlg.AddHotkey "rating4",Script.config.Hot_Rating4 dlg.AddHotkey "ratingn4",Script.config.Hot_RatingN4 dlg.AddHotkey "rating5",Script.config.Hot_Rating5 dlg.AddHotkey "ratingn5",Script.config.Hot_RatingN5 dlg.AddHotkey "copyfile",Script.config.Hot_CopyFile dlg.AddHotkey "cutfile",Script.config.Hot_CutFile dlg.AddHotkey "copyto",Script.config.Hot_CopyFileTo dlg.AddHotkey "moveto",Script.config.Hot_MoveFileTo dlg.AddHotkey "deletefile",Script.config.Hot_DeleteFile ' viewer hotkeys dlg.AddHotkey "help",Script.config.vHot_Help dlg.AddHotkey "info",Script.config.vHot_Info dlg.AddHotkey "meta",Script.config.vHot_Meta dlg.AddHotkey "showmark",Script.config.vHot_ShowMark dlg.AddHotkey "navbar",Script.config.vHot_ShortcutBar dlg.AddHotkey "statusbar",Script.config.vHot_StatusBar dlg.AddHotkey "toolbar",Script.config.vHot_ToolBar dlg.AddHotkey "print",Script.config.vHot_Print dlg.AddHotkey "full",Script.config.vHot_Fullscreen dlg.AddHotkey "mark",Script.config.vHot_Mark dlg.AddHotkey "firstmark",Script.config.vHot_FirstMark dlg.AddHotkey "lastmark",Script.config.vHot_LastMark dlg.AddHotkey "nextmark",Script.config.vHot_NextMark dlg.AddHotkey "prevmark",Script.config.vHot_PrevMark dlg.AddHotkey "returnmark",Script.config.vHot_ReturnMark dlg.AddHotkey "scrollup",Script.config.vHot_ScrollUp dlg.AddHotkey "scrolldown",Script.config.vHot_ScrollDown dlg.AddHotkey "scrollleft",Script.config.vHot_ScrollLeft dlg.AddHotkey "scrollright",Script.config.vHot_ScrollRight dlg.AddHotkey "reset",Script.config.vHot_ZoomReset dlg.AddHotkey "reset2",Script.config.vHot_ZoomReset2 dlg.AddHotkey "grow",Script.config.vHot_ZoomGrow dlg.AddHotkey "fit",Script.config.vHot_ZoomFit dlg.AddHotkey "plus",Script.config.vHot_ZoomPlus dlg.AddHotkey "minus",Script.config.vHot_ZoomMinus dlg.AddHotkey "plusn",Script.config.vHot_ZoomPlusN dlg.AddHotkey "minusn",Script.config.vHot_ZoomMinusN dlg.AddHotkey "25",Script.config.vHot_Zoom25 dlg.AddHotkey "50",Script.config.vHot_Zoom50 dlg.AddHotkey "75",Script.config.vHot_Zoom75 dlg.AddHotkey "150",Script.config.vHot_Zoom150 dlg.AddHotkey "200",Script.config.vHot_Zoom200 dlg.AddHotkey "300",Script.config.vHot_Zoom300 dlg.AddHotkey "400",Script.config.vHot_Zoom400 dlg.AddHotkey "800",Script.config.vHot_Zoom800 dlg.AddHotkey "rotate0",Script.config.vHot_Rotate0 dlg.AddHotkey "rotate90",Script.config.vHot_Rotate90 dlg.AddHotkey "rotate180",Script.config.vHot_Rotate180 dlg.AddHotkey "rotate270",Script.config.vHot_Rotate270 dlg.AddHotkey "rotateleft",Script.config.vHot_RotateLeft dlg.AddHotkey "rotateright",Script.config.vHot_RotateRight dlg.AddHotkey "fliphorizontal",Script.config.vHot_FlipHorizontal dlg.AddHotkey "flipvertical",Script.config.vHot_FlipVertical dlg.AddHotkey "alpha",Script.config.vHot_Alpha dlg.AddHotkey "gammaplus",Script.config.vHot_GammaPlus dlg.AddHotkey "gammaminus",Script.config.vHot_GammaMinus dlg.AddHotkey "gammareset",Script.config.vHot_GammaReset dlg.AddHotkey "save",Script.config.vHot_Save dlg.AddHotkey "saveas",Script.config.vHot_SaveAs dlg.AddHotkey "convert",Script.config.vHot_convert dlg.AddHotkey "crop",Script.config.vHot_Crop dlg.AddHotkey "restore",Script.config.vHot_Restore dlg.AddHotkey "reselect",Script.config.vHot_Reselect UpdateDlg data, selTags, selComment, selRating dlg.Control("editrating").value = selRating dlg.Control("editrange").value = strRange i = dlg.Show If Script.vars.Exists("viewer") Then dlg.SetTimer 300,"tick" ' Message Loop: Do Set msg = dlg.GetMsg() If msg.result = 0 Then exit do hotmode = (msg.event = "hotkey" And msg.control = "mode") combo1Change = (msg.event = "selchange" And msg.control = "combo1") combo2Change = (msg.event = "selchange" And msg.control = "combo2") edRange = (msg.event = "editchange" And msg.Control = "editrange") edList = (msg.event = "editchange" And msg.Control = "list") dblclkList = (msg.event = "dblclk" And msg.Control = "list") input = dlg.Control("editmain").value strRange = dlg.Control("editrange").value ' event: hotkey If msg.event = "hotkey" Then If msg.Control = "myhotkey" Then If Not Script.config.conf_MyCommand = "" Then cmd.RunCommand(Script.config.conf_MyCommand) End If ElseIf msg.Control = "apply" Then ApplyButton data ElseIf msg.Control = "delete" Then DeleteButton data ElseIf msg.Control = "first" Then dlg.Control("editrange").value = 1 ElseIf msg.Control = "last" Then dlg.Control("editrange").value = all ElseIf (msg.Control = "next" Or _ msg.Control = "nextv") Then EditNext data ElseIf (msg.Control = "previous" Or _ msg.Control = "prevv") Then EditPrev data ElseIf msg.Control = "copy" Then CopyButton data ElseIf hotmode Then If dlg.Control("combo1").value = 0 Then dlg.Control("combo1").value = 1 Else dlg.Control("combo1").value = 0 End If ElseIf msg.Control = "lock" Then If dlg.Control("check1").value = 0 Then dlg.Control("check1").value = -1 Else dlg.Control("check1").value = 0 End If ElseIf (msg.Control = "rating0" _ Or msg.Control = "ratingn0") Then dlg.Control("editrating").value = 0 ElseIf (msg.Control = "rating1" _ Or msg.Control = "ratingn1") Then dlg.Control("editrating").value = 1 ElseIf (msg.Control = "rating2" _ Or msg.Control = "ratingn2") Then dlg.Control("editrating").value = 2 ElseIf (msg.Control = "rating3" _ Or msg.Control = "ratingn3") Then dlg.Control("editrating").value = 3 ElseIf (msg.Control = "rating4" _ Or msg.Control = "ratingn4") Then dlg.Control("editrating").value = 4 ElseIf (msg.Control = "rating5" _ Or msg.Control = "ratingn5") Then dlg.Control("editrating").value = 5 ElseIf msg.Control = "metaFind" Then MetaFind data UpdateDlg data, selTags, selComment, selRating ElseIf msg.Control = "refresh" Then dlg.Control("list").RemoveItem(-1) dlg.Control("static1").fg("255,0,0") dlg.Control("static1").label = GetString("upddict",lang) GetFiles data, source UpdateDlg data, selTags, selComment, selRating ElseIf msg.Control = "sort" Then If arg.got_arg.readonly = False Then For Each file In cmd.sourcetab.all dlg.Control("static1").fg("220,51,39") dlg.Control("static1").label = GetString("wait",lang) If InStr(dict(file.id)(1),";") <> 0 Then cmd.ClearFiles cmd.AddFile file cmd.RunCommand("SetAttr META ""tags:" & dict(file.id)(1) & """") End If Next cmd.ClearFiles cmd.sourcetab.Update For Each file In cmd.sourcetab.selected If file.selected = True Then cmd.AddFile file Next UpdateDlg data, selTags, selComment, selRating End If ElseIf msg.Control = "copyfile" Then cmd.RunCommand("Clipboard COPY") ElseIf msg.Control = "cutfile" Then cmd.RunCommand("Clipboard CUT") ElseIf msg.Control = "copyto" Then cmd.RunCommand("Copy TO=ask") ElseIf msg.Control = "moveto" Then cmd.RunCommand("Copy MOVE TO=ask") CheckSource data, srcChange ElseIf msg.Control = "deletefile" Then cmd.RunCommand("Delete") CheckSource data, srcChange End If ' viewer hotkeys If IsObject(data.Func.viewer) Then If msg.Control = "help" Then data.func.viewer.Command("help") ElseIf msg.Control = "info" Then data.func.viewer.Command("info") ElseIf msg.Control = "meta" Then data.func.viewer.Command("meta") ElseIf msg.Control = "navbar" Then data.func.viewer.Command("shortcutbar") ElseIf msg.Control = "statusbar" Then data.func.viewer.Command("statusbar") ElseIf msg.Control = "toolbar" Then data.func.viewer.Command("toolbar") ElseIf msg.Control = "print" Then data.func.viewer.Command("print") ElseIf msg.Control = "full" Then data.func.viewer.Command("fullscreen") ElseIf msg.Control = "showmark" Then data.func.viewer.Command("mark,view") ElseIf msg.Control = "mark" Then data.func.viewer.Command("mark,toggle,nohighlight") ElseIf msg.Control = "firstmark" Then data.func.viewer.Command("mark,first") ElseIf msg.Control = "lastmark" Then data.func.viewer.Command("mark,last") ElseIf msg.Control = "nextmark" Then data.func.viewer.Command("mark,next") ElseIf msg.Control = "prevmark" Then data.func.viewer.Command("mark,prev") ElseIf msg.Control = "returnmark" Then data.func.viewer.Command("mark,return") ElseIf msg.Control = "scrollup" Then data.func.viewer.Command("scroll,up,vert") ElseIf msg.Control = "scrolldown" Then data.func.viewer.Command("scroll,down,vert") ElseIf msg.Control = "scrollright" Then data.func.viewer.Command("scroll,down,horiz") ElseIf msg.Control = "scrollleft" Then data.func.viewer.Command("scroll,up,horiz") ElseIf (msg.Control = "reset" _ Or msg.Control = "reset2") Then data.func.viewer.Command("zoom,reset") ElseIf msg.Control = "grow" Then data.func.viewer.Command("zoom,grow") ElseIf msg.Control = "fit" Then data.func.viewer.Command("zoom,fit") ElseIf (msg.Control = "plus" Or _ msg.Control = "plusn") Then data.func.viewer.Command("zoom,+") ElseIf (msg.Control = "minus" Or _ msg.Control = "minusn") Then data.func.viewer.Command("zoom,-") ElseIf msg.Control = "25" Then data.func.viewer.Command("zoom,25") ElseIf msg.Control = "50" Then data.func.viewer.Command("zoom,50") ElseIf msg.Control = "75" Then data.func.viewer.Command("zoom,75") ElseIf msg.Control = "150" Then data.func.viewer.Command("zoom,150") ElseIf msg.Control = "200" Then data.func.viewer.Command("zoom,200") ElseIf msg.Control = "300" Then data.func.viewer.Command("zoom,300") ElseIf msg.Control = "400" Then data.func.viewer.Command("zoom,400") ElseIf msg.Control = "800" Then data.func.viewer.Command("zoom,800") ElseIf msg.Control = "rotate0" Then data.func.viewer.Command("rotate,reset") ElseIf msg.Control = "rotate90" Then data.func.viewer.Command("rotate,90") ElseIf msg.Control = "rotate180" Then data.func.viewer.Command("rotate,180") ElseIf msg.Control = "rotate270" Then data.func.viewer.Command("rotate,270") ElseIf msg.Control = "rotateleft" Then cmd.RunCommand("Image ROTATE=-90 HERE REPLACE PRESERVEDATE") data.func.viewer.Command("refresh") ElseIf msg.Control = "rotateright" Then cmd.RunCommand("Image ROTATE=+90 HERE REPLACE PRESERVEDATE") data.func.viewer.Command("refresh") ElseIf msg.Control = "fliphorizontal" Then data.func.viewer.Command("flip,horiz") ElseIf msg.Control = "flipvertical" Then data.func.viewer.Command("flip,vert") ElseIf msg.Control = "alpha" Then data.func.viewer.Command("alpha") ElseIf msg.Control = "gammaplus" Then data.func.viewer.Command("gamma,+10") ElseIf msg.Control = "gammaminus" Then data.func.viewer.Command("gamma,-10") ElseIf msg.Control = "gammareset" Then data.func.viewer.Command("gamma,reset") ElseIf msg.Control = "save" Then data.func.viewer.Command("save") ElseIf msg.Control = "save" Then data.func.viewer.Command("saveas") ElseIf msg.Control = "convert" Then cmd.RunCommand("Image CONVERT") ElseIf msg.Control = "crop" Then data.func.viewer.Command("crop") ElseIf msg.Control = "restore" Then data.func.viewer.Command("restore") ElseIf msg.Control = "reselect" Then data.func.viewer.Command("reselect") End If End If End If ' event: dblclk on listview item If dblclkList Then For i=0 to dlg.Control("list").count -1 If dlg.Control("list").GetItemAt(i).selected = True Then tag = dlg.Control("list").GetItemAt(i).name If right(input,1) = ";" Then input = left(input, len(input) - 1) If (right(input,1) = "+" Or right(input,1) = "-" Or right(input,1) = "") Then dlg.Control("editmain").value = input & dlg.Control("list").GetItemAt(i).name & ";" Else dlg.Control("editmain").value = input & ";" & dlg.Control("list").GetItemAt(i).name & ";" End If If dlg.Control("combo1").value = 1 Then If right(input,1) = "" Then dlg.Control("editmain").value = input & dlg.Control("list").GetItemAt(i).name Else dlg.Control("editmain").value = input & " " & dlg.Control("list").GetItemAt(i).name End If End If dlg.Control("check1").value = -1 input = dlg.Control("editmain").value dlg.Control("list").DeselectItem(i) dlg.Control("editmain").focus = True dlg.Control("editmain").SelectRange len(dlg.Control("editmain").value),-1 End If Next End If ' event: selchange in listview If (msg.event = "selchange" And msg.Control = "list") Then CheckSource data, srcChange If srcChange = False Then For i=0 to dlg.Control("list").count -1 If dlg.Control("list").GetItemAt(i).selected = True Then tag = dlg.Control("list").GetItemAt(i).name j = i End If oldStrg = tag Next End If End If ' event: editchange in rating input If (msg.event = "editchange" And msg.Control = "editrating") Then If InStr(1,"0,1,2,3,4,5",dlg.Control("editrating").value,1) = 0 Then dlg.Control("editrating").value = "" End If End If ' event: editchange in listview If edList Then newStrg = msg.value ' Detect changes and update dictionary If arg.got_arg.readonly = False Then If dlg.Control("combo1").value = 0 Then For Each file In cmd.sourcetab.selected tagStrg = dict(file.id)(1) If InStr(1,tagStrg,";",1) = 0 Then If oldStrg = dict(file.id)(1) Then tagStrg = newStrg Else tagStrg = tagStrg & ";" & newStrg End If Else If InStr(1,dict(file.id)(1),";" & oldStrg & ";",1) <> 0 Then If newStrg = "" Then tagStrg = Replace(tagStrg,";" & oldStrg & ";",";") Else tagStrg = Replace(tagStrg,";" & oldStrg & ";",";" & newStrg & ";") End If ElseIf oldStrg = Mid(dict(file.id)(1),InStrRev(dict(file.id)(1),";")+1) Then If newStrg = "" Then tagStrg = StrReverse(Replace(StrReverse(tagStrg),StrReverse(oldStrg),"",1,1)) Else tagStrg = StrReverse(Replace(StrReverse(tagStrg),StrReverse(oldStrg),StrReverse(newStrg),1,1)) End If ElseIf oldStrg = Left(dict(file.id)(1),InStr(dict(file.id)(1),";")-1) Then If newStrg = "" Then tagStrg = Replace(tagStrg,Left(tagStrg,InStr(tagStrg,";")-1),"",1,1) Else tagStrg = Replace(tagStrg,Left(tagStrg,InStr(tagStrg,";")-1), newStrg,1,1) End If End If End If ' Write new values tagStrg = StringSort(tagStrg) cmd.RunCommand("SetAttr META ""tags:" & tagStrg & """") dict(file.id) = array(dict(file.id)(0),tagStrg,dict(file.id)(2),dict(file.id)(3)) tagStrg = "" Next Else If dlg.Control("list").count = 1 Then cmd.RunCommand("SetAttr META ""comment: " & newStrg & """") For Each file In cmd.sourcetab.selected dict(file.id) = array(dict(file.id)(0),dict(file.id)(1),newStrg,dict(file.id)(3)) Next Else i = CLng(dlg.Control("list").GetItemAt(j).subitems(0)) cmd.ClearFiles cmd.AddFile file cmd.RunCommand("SetAttr META ""comment: " & newStrg & """") dict(file.id) = array(dict(file.id)(0),dict(file.id)(1),newStrg,dict(file.id)(3)) cmd.SetFiles cmd.sourcetab.selected End If End If If msg.value = "" Then dlg.Control("list").RemoveItem(j) End If Else dlg.Control("list").RemoveItem(j) dlg.Control("list").InsertItemAt(j), oldStrg End If End If ' event: selchange "Tags" or "Comment" If (combo1Change Or hotmode) Then dlg.Control("check1").value = False dlg.Control("editmain").value = "+" UpdateDlg data, selTags, selComment, selRating End If ' event: editchange in Range input field If edRange Then CheckSource data, srcChange If srcChange = False Then EditRange data End If End If ' event: click button or checkbox If msg.event = "click" Then If msg.Control = "check1" Then dlg.Control("editmain").focus = True dlg.Control("editmain").SelectRange len(dlg.Control("editmain").value),-1 ElseIf msg.control = "ApplyButton" Then CheckSource data, srcChange If srcChange = False Then ApplyButton data ElseIf msg.control = "DeleteButton" Then CheckSource data, srcChange If srcChange = False Then DeleteButton data ElseIf msg.control = "NextButton" Then CheckSource data, srcChange If srcChange = False Then EditNext data ElseIf msg.control = "PrevButton" Then CheckSource data, srcChange If srcChange = False Then EditPrev data ElseIf msg.control = "CopyButton" Then CheckSource data, srcChange If srcChange = False Then CopyButton data End If End If ' event: timer: viewer window was closed If msg.event = "timer" Then If Script.vars.Exists("closed") Then Script.vars.Delete "closed" dlg.EndDlg End If ' event: timer: current image in viewer has changed If Script.vars.Exists("viewerchange") Then dlg.KillTimer "tick" For i=0 To all -1 If cmd.sourcetab.all(i) = Script.vars.Get("viewerchange") Then dlg.Control("editrange").value = i+1 End If Next Script.vars.Delete "viewerchange" dlg.SetTimer 300, "tick" End If ' event: timer: variable "TaggerFocus" exists If DOpus.vars.Exists("TaggerFocus") Then dlg.Control("editmain").focus = True dlg.Control("editmain").SelectRange len(dlg.Control("editmain").value),-1 DOpus.vars.Delete "TaggerFocus" End If End If Loop While msg ' Button "Close" If dlg.result = 0 Then If arg.got_arg.filter = True Then cmd.RunCommand("Set SHOWFILTERFILENAME *.*") If (arg.got_arg.nofolders = True _ Or arg.got_arg.viewer = True) Then cmd.RunCommand("Set HIDEFILTERFOLDERS=""""") End If If (colIndex = False And Script.config.conf_ShowIndexColumn = True) Then cmd.RunCommand("Set COLUMNSREMOVE=index") End If If arg.got_arg.viewer = True Then Script.vars.Delete "viewer" Script.vars.Delete "viewerchange" dlg.SavePosition("KundalViewer") Else dlg.SavePosition("Kundal") End If If arg.got_arg.closeapp = True Then If arg.got_arg.viewer = True Then If IsObject(DOpus.viewers.lastactive) Then If DOpus.viewers.lastactive = data.Func.viewer Then data.Func.viewer.Command("close") End If End If Else cmd.RunCommand(arg.closeapp) End If End If End If End Function Function UpdateDlg(data, selTags, selComment, selRating) ' Get metadata of selected files Dim dictTmp, file, i, itemData, j, tag, tmp, tagCount selComment = "" : selRating = "" : selTags = "" : strIndex = "" : tmp ="" Set dictTmp = CreateObject ("Scripting.Dictionary") dictTmp.CompareMode = vbTextCompare ' Get metadata of a single selected file If cmd.sourcetab.selected.count = 1 Then Set file = cmd.sourcetab.selected(0) index = dict(file.id)(0) strIndex = index tagString = StringSort(dict(file.id)(1)) selComment = dict(file.id)(2) selRating = dict(file.id)(3) ' Open file in App or standalone viewer cmd.RunCommand("Select THIS") If Not index = lastIndex Then If arg.got_arg.app = True Then cmd.RunCommand(arg.app & " " & """" & file & """") End If If arg.got_arg.viewer = True Then If IsObject(data.Func.viewer) Then data.Func.viewer.Command("goto," & index-1) End If End If End If Else ' Get shared metadata of multiple selected files For Each file In cmd.sourcetab.selected index = dict(file.id)(0) strIndex = strIndex & index & "," If InStr(1,selRating,dict(file.id)(3),1) = 0 Then selRating = selRating & dict(file.id)(3) & ";" End If If dlg.Control("combo1").value = 0 Then For Each tag In Split(dict(file.id)(1),";") If Not dictTmp.Exists(tag) Then dictTmp.Add tag, tag End If Next Else If InStr(1,selComment,(dict(file.id)(2)),1) = 0 Then selComment = selComment & dict(file.id)(2) & ";;;" End If End If Next strIndex = Left(strIndex, Len(strIndex) - 1) If dlg.Control("combo1").value = 0 Then For Each file In cmd.sourcetab.selected For Each tmp In dictTmp For Each tag In Split(dict(file.id)(1),";") If tmp=tag Then seltags = selTags & tag & ";" End If Next If selTags = "" Then dictTmp.Remove(tmp) selTags = "" Next Next For Each tmp In dictTmp seltags = selTags & dictTmp(tmp) & ";" Next selTags = StringSort(selTags) Else selComment = Left(selComment,len(selComment)-3) If Ubound(Split(selComment,";;;")) <> 0 Then selComment = "" Else vecComment.Clear End If End If selRating = Left(selRating,len(selRating)-1) If Ubound(Split(selRating,";")) <> 0 Then selRating = "" End If End If ' Update the information in the dialog when selection changed tagCount = Ubound(Split(dict.items()(index-1)(1),";"))+1 If tagCount = -1 Then tagCount = 0 ' Clear listbox and input if unlocked dlg.Control("list").RemoveItem(-1) If dlg.Control("list").columns.count = 2 Then dlg.Control("list").columns.DeleteColumn(1) End If If dlg.Control("check1").value = 0 Then If dlg.Control("combo1").value = 1 Then dlg.Control("editmain").value = "" Else dlg.Control("editmain").value = "+" End If End If ' Single selected file ' Update listview and controls If cmd.sourcetab.selected.count = 1 Then If dlg.Control("combo1").value = 0 Then For Each tag In Split(tagString,";") dlg.Control("list").AddItem(tag) Next dlg.Control("static1").fg("30,50,177") dlg.Control("group1").label = GetString("existing",lang) & tagCount & " )" Else dlg.Control("static1").fg("21,94,79") dlg.Control("list").AddItem(selComment),1 dlg.Control("group1").label = GetString("comment",lang) End If dlg.Control("static1").label = GetString("file",lang) & index & "/" & all & "): " & vbCrLf & cmd.sourcetab.selected(0).name Else ' Multiple selected files ' Update Listview If dlg.Control("combo1").value = 1 Then If vecComment.empty = False Then dlg.Control("list").columns.AddColumn "index" For i=0 To vecComment.count -1 dlg.Control("list").AddItem(Split(vecComment(i),";;;")(1)) For j=0 To dlg.Control("list").count -1 dlg.Control("list").GetItemAt(i).subitems(0) = (Split(vecComment(i),";;;")(0)) Next Next Else dlg.Control("list").AddItem(selComment) End If Else If selTags = "" Then dlg.Control("group1").label = GetString("shared",lang) & "0" & " )" Else dlg.Control("group1").label = GetString("shared",lang) & Ubound(Split(selTags,";")) & " )" For Each tag In Split(selTags,";") dlg.Control("list").AddItem(tag) Next End If End If ' Update Controls dlg.Control("static1").label = GetString("various",lang) &_ cmd.sourcetab.selected.count & "/" & all & ")" dlg.Control("static1").fg("220,51,39") End If If dlg.Control("editmain").focus = True Then dlg.Control("editmain").SelectRange len(dlg.Control("editmain").value),-1 End If dlg.Control("editrating").value = selRating dlg.Control("list").columns.AutoSize End Function Function EditRange(data) ' Detect changes in range input field Dim file, reg, match, matches, Var ' Avoid error if the first number in range input is > all Set reg = New RegExp reg.Pattern = "^(\d+)$" Set matches = reg.Execute(strRange) If reg.Test(strRange) Then If Clng(matches(0).value) > all Then Exit Function End If reg.Pattern = "[^\d,-]" reg.global =True If reg.Test(strRange) Then dlg.Control("editrange").value = reg.Replace(strRange,"") dlg.Control("editrange").SelectRange len(dlg.Control("editrange").value),-1 Exit Function End If ' Select range of files If dlg.Control("editrange").value = "" Then cmd.ClearFiles cmd.Addfile lastFile cmd.RunCommand("Select FROMSCRIPT DESELECTNOMATCH SETFOCUS") cmd.sourcetab.Update Else cmd.RunCommand("Select DESELECTNOMATCH RANGE " & strRange) cmd.sourcetab.Update cmd.ClearFiles For Each file In cmd.sourcetab.selected If file.selected = True Then cmd.Addfile file Next End If UpdateDlg data, selTags, selComment, selRating vecComment.Clear End Function Function MetaFind(data) ' Find all files containing the specified tag, comment or rating Dim dictTmp, file, i, isNumber, item, j, strg, tag, vecIndex Set vecIndex = DOpus.Create.Vector Set dictTmp = CreateObject("Scripting.Dictionary") dictTmp.CompareMode = vbTextCompare vecComment.Clear i = 0 j = 0 strIndex = "" strg = "" If input = "+" Or input = "-" Or input = "" Then Exit Function If right(input,1) = ";" Then input = left(input, len(input) - 1) If (left(input,1) = "+" Or left(input,1) = "-" Or left(input,1) = ";") Then input = right(input, len(input) - 1) End If For Each strg In Split(input,",") If IsNumeric(strg) = True Then If CLng(strg) < 6 Then isNumber = True End If Else isNumber = False Exit For End If Next ' Find Rating If isNumber = True Then For Each strg In Split(input,",") For Each file In cmd.sourcetab.all selRating = dict(file.id)(3) If CLng(strg) = CLng(selRating) Then i = 1 End If If i = 1 Then index = dict(file.id)(0) vecIndex.push_back index i = 0 End If Next Next vecIndex.Sort For i=0 To vecIndex.count -1 strIndex = strIndex & vecIndex(i) & "," Next Else ' Find Tags If dlg.Control("combo1").value = 0 Then For Each file In cmd.sourcetab.all For Each tag in Split(input,";") If Not dictTmp.Exists(tag) Then dictTmp.Add tag, 0 Next For Each item In Split(dict(file.id)(1),";") If dictTmp.Exists(item) Then j = j+1 If (Ubound(Split(input,";"))+1) = j Then i = 1 Next If i = 1 Then index = dict(file.id)(0) strIndex = strIndex & index & "," End If i = 0 j = 0 Next Else ' Find Comment For Each file In cmd.sourcetab.all If InStr(1,dict(file.id)(2),input,1) Then i = 1 End If If i = 1 Then index = dict(file.id)(0) strIndex = strIndex & index & "," vecComment.push_back index & ";;;" & dict(file.id)(2) i = 0 End If Next End If End If If Not strIndex = "" Then strIndex = left(strIndex, len(strIndex) - 1) GetRange data, strRange dlg.Control("editrange").value = strRange cmd.sourcetab.Update For Each file In cmd.sourcetab.selected cmd.AddFile file Next Else cmd.ClearFiles cmd.Addfile lastFile cmd.RunCommand("Select FROMSCRIPT DESELECTNOMATCH SETFOCUS") dlg.Control("editrange").value = Clng(lastIndex) End If UpdateDlg data, selTags, selComment, selRating End Function Function ApplyButton(data) ' Write tags or comment and rating Dim file, tag, tagStrg tagStrg = "" If (input = "" Or input = "+" Or input = "-") Then If dlg.Control("combo1").value = 0 Then If cmd.sourcetab.selected.count = 1 Then Set file = cmd.sourcetab.selected(0) dict(file.id) = array(dict(file.id)(0),StringSort(dict(file.id)(1)),dict(file.id)(2),dict(file.id)(3)) cmd.RunCommand("SetAttr META ""tags:" & dict(file.id)(1) & """") End If End If Else If cmd.sourcetab.selected.count > 1 Then dlg.Control("static1").fg("220,51,39") dlg.Control("static1").label = GetString("wait",lang) End If If dlg.Control("combo1").value = 0 Then cmd.RunCommand("SetAttr META ""tags:" & input & """") Else cmd.RunCommand("SetAttr META ""comment: " & input & """") End If ' Update dictionary If Left(input,1) = ";" Then input = Right(input,Len(input)-1) If Right(input,1) = ";" Then input = Left(input,Len(input)-1) For Each file In cmd.sourcetab.selected If dlg.Control("combo1").value = 0 Then tagStrg = dict(file.id)(1) If Not (Left(input,1) = "+" Or Left(input,1) = "-") Then tagStrg = "" End If For Each tag In Split(input,";") If (Left(tag,1) = "+" Or Not Left(tag,1) = "-") Then If Left(tag,1) = "+" Then tag = Right(tag,Len(tag)-1) If tagStrg = "" Then tagStrg = tag Else If InStr(1,tagStrg,";",1) = 0 Then If Not tag = tagStrg Then tagStrg = tagStrg & ";" & tag End If Else If (InStr(1,tagStrg,";" & tag & ";",1) = 0 _ And Not (tag = Left(tagStrg,InStr(tagStrg,";")-1) _ Or tag = Mid(tagStrg,InStrRev(tagStrg,";")+1))) Then tagStrg = tagStrg & ";" & tag End If End If End If ElseIf Left(tag,1) = "-" Then tag = Right(tag,Len(tag)-1) If Not tagStrg = "" Then If InStr(1,tagStrg,";",1) = 0 Then If tag = tagStrg Then tagStrg = "" Else If InStr(1,tagStrg,(";" & tag & ";"),1) <> 0 Then tagStrg = Replace(tagStrg,";" & tag & ";",";") ElseIf tag = Mid(tagStrg,InStrRev(tagStrg,";")+1) Then tagStrg = StrReverse(Replace(StrReverse(tagStrg),StrReverse(tag) & ";","",1,1)) ElseIf tag = Left(tagStrg,InStr(tagStrg,";")-1) Then tagStrg = Replace(tagStrg,Left(tagStrg,InStr(tagStrg,";")-1) & ";","",1,1) End If End If End If End If Next dict(file.id) = array(dict(file.id)(0),tagStrg,dict(file.id)(2),dict(file.id)(3)) tagStrg = "" Else dict(file.id) = array(dict(file.id)(0),dict(file.id)(1),input,dict(file.id)(3)) End If If Not dlg.Control("editrating").value = "" Then dict(file.id) = array(dict(file.id)(0),dict(file.id)(1),dict(file.id)(2),dlg.Control("editrating").value) End If Next End If ' Write rating If Not dlg.Control("editrating").value = "" Then cmd.RunCommand("SetAttr META ""rating:" & dlg.Control("editrating").value & """") End If ' Get the next file depending on the state of combo2 If dlg.Control("combo2").value = 0 Then EditNext data ElseIf dlg.Control("combo2").value = 1 Then EditPrev data Else UpdateDlg data, selTags, selComment, selRating dlg.Control("editmain").focus = True End If End Function Function DeleteButton(data) ' Delete tags or comment Dim confDlg, file, tag, tagStrg Set confDlg = DOpus.Dlg confDlg.window = cmd.sourcetab tagStrg = "" ' Arguments CONFIRMDELETE and VIEWER = True If arg.got_arg.confirmdelete = True Then If Script.vars.Exists("viewer") Then If dlg.Control("combo1").value = 1 Then If (dlg.Control("list").value.count = 0 _ Or dlg.Control("list").count = 1) Then data.Func.viewer.Command(Dlg.Request(GetString("delcomment",lang))),,GetString("confirm",lang) Else data.Func.viewer.Command(Dlg.Request(dlg.Control("list").value.count & GetString("delcomsel",lang))),,GetString("confirm",lang) End If Else If dlg.Control("list").value.count = 0 Then data.Func.viewer.Command(Dlg.Request(GetString("deltagsall",lang))),,GetString("confirm",lang) Else data.Func.viewer.Command(Dlg.Request(dlg.Control("list").value.count & GetString("deltagssel",lang))),,GetString("confirm",lang) End If End If Else ' Argument CONFIRMDELETE = True, VIEWER = False If dlg.Control("combo1").value = 1 Then If (dlg.Control("list").value.count = 0 _ Or dlg.Control("list").count = 1) Then confDlg.Request(GetString("delcomment",lang)),,GetString("confirm",lang) Else confDlg.Request(dlg.Control("list").value.count & GetString("delcomsel",lang)),,GetString("confirm",lang) End If Else If dlg.Control("list").value.count = 0 Then confDlg.Request(GetString("deltagsall",lang)),,GetString("confirm",lang) Else confDlg.Request(dlg.Control("list").value.count & GetString("deltagssel",lang)),,GetString("confirm",lang) End If End If End If End If ' Write new values If (Dlg.Result = 1 Or confDlg.Result = 1 Or arg.got_arg.confirmdelete = False) Then If dlg.Control("combo1").value = 1 Then If (dlg.Control("list").value.count = 0 _ Or dlg.Control("list").count = 1)Then cmd.RunCommand("SetAttr META comment:") Else For Each file In cmd.sourcetab.selected For Each tag In dlg.Control("list").value j = CLng(dlg.Control("list").GetItemAt(tag.index).subitems(0)) If j = dict(file.id)(0) Then cmd.ClearFiles cmd.AddFile file cmd.RunCommand("SetAttr META ""comment:") cmd.SetFiles cmd.sourcetab.selected End If Next Next End If Else If dlg.Control("list").value.count = 0 Then cmd.RunCommand("SetAttr META tags:") Else For Each tag In dlg.Control("list").value tagStrg = "-" & tag.name & ";" Next cmd.RunCommand("SetAttr META ""tags:" & tagStrg & """") End If End If UpdDict data End If ' Write rating For Each file in cmd.sourcetab.selected If Not dlg.Control("editrating").value = "" Then dict(file.id) = array(dict(file.id)(0),dict(file.id)(1),dict(file.id)(2),dlg.Control("editrating").value) End If Next If Not dlg.Control("editrating").value = "" Then cmd.RunCommand("SetAttr META ""rating:" & dlg.Control("editrating").value & """") End If ' Get the next file depending on the state of combo2 If dlg.Control("combo2").value = 0 Then EditNext data ElseIf dlg.Control("combo2").value = 1 Then EditPrev data Else UpdateDlg data, selTags, selComment, selRating dlg.Control("editmain").focus = True End If End Function ' Update dictionaries Sub UpdDict(data) Dim file, j, tagStrg, tag For Each file In cmd.sourcetab.selected tagStrg = dict(file.id)(1) If dlg.Control("combo1").value = 0 Then If dlg.Control("list").value.count = 0 Then dict(file.id) = array(dict(file.id)(0),"",dict(file.id)(2),dict(file.id)(3)) Else For Each tag In dlg.Control("list").value If Not tagStrg = "" Then If InStr(1,tagStrg,";",1) = 0 Then If tag.name = tagStrg Then tagStrg = "" Else If InStr(1,tagStrg,(";" & tag.name & ";"),1) <> 0 Then tagStrg = Replace(tagStrg,";" & tag.name & ";",";") ElseIf tag.name = Mid(tagStrg,InStrRev(tagStrg,";")+1) Then tagStrg = StrReverse(Replace(StrReverse(tagStrg),StrReverse(tag.name) & ";","",1,1)) ElseIf tag.name = Left(tagStrg,InStr(tagStrg,";")-1) Then tagStrg = Replace(tagStrg,Left(tagStrg,InStr(tagStrg,";")-1) & ";","",1,1) End If End If End If Next dict(file.id) = array(dict(file.id)(0),tagStrg,dict(file.id)(2),dict(file.id)(3)) tagStrg = "" End If Else If (dlg.Control("list").value.count = 0 _ Or dlg.Control("list").count = 1) Then dict(file.id) = array(dict(file.id)(0),dict(file.id)(1),"",dict(file.id)(3)) Else For Each tag In dlg.Control("list").value j = CLng(dlg.Control("list").GetItemAt(tag.index).subitems(0)) If j = dict(file.id)(0) Then dict(file.id) = array(dict(file.id)(0),dict(file.id)(1),"",dict(file.id)(3)) End If Next End If End If Next End Sub Function CopyButton(data) ' Button "Copy": copy all tags of the current file to main input If dlg.Control("combo1").value = 1 Then dlg.Control("editmain").value = selComment dlg.Control("check1").value = -1 Else If Not (dlg.Control("editmain").value = "+" Or dlg.Control("editmain").value = "-") Then dlg.Control("editmain").value = dlg.Control("editmain").value & tagString & ";" dlg.Control("check1").value = -1 End If End If dlg.Control("editmain").focus = True dlg.Control("editmain").SelectRange len(dlg.Control("editmain").value),-1 End Function Function EditNext(data) ' Select the next item and add it to the script Dim file If cmd.sourcetab.selected.count >1 Then cmd.ClearFiles cmd.Addfile lastFile cmd.RunCommand("Select FROMSCRIPT DESELECTNOMATCH SETFOCUS") dlg.Control("editrange").value = Clng(lastIndex) Else If Not index = all Then dlg.Control("editrange").value = index +1 Else dlg.Control("editrange").value = 1 End If lastFile = cmd.sourcetab.selected(0) lastIndex = index End If 'cmd.RunCommand("Select NEXT") cmd.sourcetab.Update index = Clng(dlg.Control("editrange").value) dlg.Control("editmain").focus = True End Function Function EditPrev(data) ' Select the previous item and add it to the script Dim file If cmd.sourcetab.selected.count >1 Then cmd.ClearFiles cmd.Addfile lastFile cmd.RunCommand("Select FROMSCRIPT DESELECTNOMATCH SETFOCUS") dlg.Control("editrange").value = Clng(lastIndex) Else If index <> 1 Then dlg.Control("editrange").value = index-1 Else dlg.Control("editrange").value = all End If lastFile = cmd.sourcetab.selected(0) lastIndex = index End If cmd.sourcetab.Update index = Clng(dlg.Control("editrange").value) 'cmd.RunCommand("Select PREV") dlg.Control("editmain").focus = True End Function Function GetRange(data, strRange) ' Get range string Dim cur, i, inArr, nix, nxt, out, outtmp, start nix = -1 strRange = "" start = cur = nxt = nix inArr = split(strIndex,",") For i=0 To ubound(inArr) cur = inarr(i)*1 : nxt = nix : outtmp = "" If ((i) nxt Then If start <> nix And start <> cur Then outtmp = start & "-" strRange = strRange & outtmp & cur If nxt <> nix Then strRange = strRange & "," start = nix End If Next End Function Function StringSort(strSort) ' Sort strings Dim dictTmp, strg, tmp Set tmp = DOpus.Create.Vector Set dictTmp = CreateObject ("Scripting.Dictionary") dict.CompareMode = vbTextCompare strSort = Trim(strSort) If Right(strSort,1) = ";" Then strSort = Left(strSort,Len(strSort)-1) If Left(strSort,1) = ";" Then strSort = Right(strSort,Len(strSort)-1) If (Not strSort = "" Or InStr(strSort,";") <> 0) Then For Each strg In Split(strSort,";") strg = Trim(strg) If Not dictTmp.exists(strg) Then dictTmp.add strg,0 Next strSort = "" For Each strg In dictTmp tmp.push_back strg Next tmp.sort dictTmp.RemoveAll For Each strg In tmp strSort = strSort & strg & ";" Next tmp.clear strSort = Left(strSort, Len(strSort)-1) End If StringSort = strSort End Function Function CheckSource(data, srcChange) ' Check if sourcepath has changed srcChange = False DOpus.listers.Update cmd.SetSourceTab DOpus.listers(0).activetab cmd.sourcetab.Update If (Not cmd.sourcetab.path = source _ Or cmd.sourcetab.all.count <> all) Then srcChange = True dlg.Control("list").RemoveItem(-1) dlg.Control("list").AddItem GetString("upddict",lang) dlg.Control("static1").fg("255,0,0") dlg.Control("static1").label = GetString("srcChange",lang) GetFiles data, source UpdateDlg data, selTags, selComment, selRating GetRange data, strRange dlg.Control("editrange").value = strRange End If End Function Function OnViewerEvent(viewerEventData) ' Check if the viewer window still exists and if the currently displayed image has changed If Not Script.vars.Exists("viewer") Then Exit Function If viewerEventData.viewer = Script.vars.Get("viewer") Then If viewerEventData.event = "destroy" Then Script.vars.Set "closed", True Exit Function End If If viewerEventData.event = "load" Then Script.vars.Set "viewerchange", viewerEventData.item End If End If End Function Function GetString(s,lang) ' Add line breaks to string resources GetString = Replace(DOpus.Strings.Get(s,lang), "[:CR:]", vbCRLF) End Function ==SCRIPT RESOURCES Tastenkürzel: Schalter "Anwenden" Ja, zum Download!|Abbrechen Kommentar: Löschen bestätigen: Tastenkürzel: Schalter "C" Der Kommentar wird aus allen ausgewählten Dateien gelöscht.[:CR:][:CR:]Fortfahren? Kommentare werden gelöscht.[:CR:][:CR:]Fortfahren? Alle Tags werden aus den ausgewählten Dateien entfernt.[:CR:][:CR:]Fortfahren? Tags werden aus den ausgewählten Dateien entfernt.[:CR:][:CR:]Fortfahren? Bearbeiten und Anzeigen von Tags, Bewertung und Kommentar für Dateien und Ordner. Vorhandene Tags: ( Datei ( Tastenkürzel: Suche Tags, Rating oder Kommentar Zeige oder verstecke die Spalte "Index" Wähle die Sprache, in der der Dialog angezeigt werden soll. Tastenkürzel: Eingabefeld sperren oder entsperren Tastenkürzel: Auswahlbox "Tags" oder "Kommentar" Tastenkürzel: Schalter "Vorwärts" Das Add-In 'ScriptWizard' wurde nicht gefunden.[:CR:][:CR:] Installiere "ScriptWizard" von [resource.dopus.com].[:CR:] Das Add-In aktiviert diesen Dialog und bietet ausserdem[:CR:] einfaches updaten von Scripts und vieles mehr. Tastenkürzel: Schalter "Zurück" Tastenkürzel: Aktualisiere die Datenbank. Tastenkürzel: Schalter "Löschen" Gemeinsame Tags: ( Tastenkürzel: Sortiere die Tags aller Dateien alphabetisch. Quellordner wurde geändert... Kein About.. Datenbank wird aktualisiert... Mehrere Dateien ( Bitte warten... Hotkey: Button "Apply" Yes, take me there!|Cancel Comment: Confirm delete: Hotkey: Button "C" The comment will be removed from all selected files.[:CR:][:CR:]Continue? selected comments will be removed.[:CR:][:CR:]Continue? All tags will be removed from selected files?[:CR:][:CR:]Continue? selected tags will be removed from selected files.[:CR:][:CR:]Continue? Show and edit Tags, Rating and Comment for files and folders. Existing Tags: ( File ( Hotkey: Find Tags, Rating or Comment Show or hide the column "Index" Choose the language of the dialog. Hotkey: Lock or Unlock the main input field Hotkey: Combobox "Tags" or "Comment" Hotkey: Button "Next" The 'ScriptWizard' add-in has not been found.[:CR:][:CR:] Install 'ScriptWizard' from [resource.dopus.com].[:CR:] The add-in enables this dialog and also offers easy updating of scripts and many more. Hotkey: Button "Previous" Hotkey: Update the dictionary. Hotkey: Button "Remove" Shared Tags: ( Hotkey: Sort the Tags of all files alphabetically. Sourcepath has changed... No About.. Updating dictionary... Various files ( Please wait... Raccourci clavier: Bouton "Appliquer" Yes, take me there!|Cancel Commentaire: Confirmer supprimer: Raccourci clavier: Bouton "C" Le commentaire est supprimé de toutes fichiers selectionné.[:CR:][:CR:]Poursuivre? commentaires selectionnés sont supprimés.[:CR:][:CR:]Poursuivre? Tous les mots-clés sont supprimés.[:CR:][:CR:]Poursuivre? mots-clés selectionnés sont supprimés.[:CR:][:CR:]Poursuivre? Afficher et révisez mots-clés, note et commentaire de fichiers et dossiers. Mots-clés existant: ( Fichier ( Raccourci clavier: Rechercher des mots-clés, note ou commentaire Afficher ou cacher la colonne "Index" Choisis la langue du boîte de dialogue. Raccourci clavier: Verrouiller ou déverrouiller le champ de saisie Raccourci clavier: Choisir l'option "Mots-clés" ou "Commentaire" Raccourci clavier: Bouton "Suivant" The 'ScriptWizard' add-in has not been found.[:CR:][:CR:] Install 'ScriptWizard' from [resource.dopus.com].[:CR:] The add-in enables this dialog and also offers easy updating of scripts and many more. Raccourci clavier: Bouton "Précédent" Raccourci clavier: Aktualiser le dictionnaire. Raccourci clavier: Bouton "Supprimer" Mots-clés communs: ( Raccourci clavier: Sortez les mots-clés du toutes fichiers en ordre alphabétique. Changement de source... No About.. Aktualiser le Dictionnaire... Plusieurs fichiers ( Attendez s'il vous plaît...