I posted a question about quickly hiding a file or folder using a hotkey, and adding them to my Global Filters here:
Now if I want to view (unhide) a file or folder that is hidden by a Global Filter, I either press a hotkey which disables all Global Filters by activating this command:
Set GLOBALHIDEFILTER=Toggle
... or I click on an entry in my status bar which activates this command:
{hi}
Is there a command or a way that would let me perform the opposite action? That is, can I remove a file or folder from the Global Filters using a hotkey? I am currently doing the following to remove a file from the Global Filters:
I unhide a file in a Lister.
Copy the file name to the clipboard.
Open Preferences > Global Filters, then copy all of the text in the Filename: edit field to the clipboard.
Paste the text to a text file, then open it.
Search for the file name I want to remove, delete it, then copy the remaining text to the clipboard.
Paste the text back to the Filename: edit field, then save my changes.
This is a tedious process. Any help would be greatly appreciated! Thanks.
Hmmm... This is the script I am using that adds files/folders to the Global Filters:
Option Explicit
Function OnClick(clickData)
Dim flt, vecFiles, vecDirs, f, cmd, c
Set flt = DOpus.filters
Set vecFiles = DOpus.Create.Vector
Set vecDirs = DOpus.Create.Vector
c = 0
for each f in clickData.func.command.files
if f.is_dir Then
vecDirs.push_back(f.name)
else
vecFiles.push_back(f.name)
end if
c = c + 1
next
if c > 0 Then
clickData.func.command.ClearFiles
if not(vecDirs.empty) then AddToFilter flt.folder, vecDirs, clickData.func.command, "GLOBALHIDEFOLDERS"
if not(vecFiles.empty) then AddToFilter flt.file, vecFiles, clickData.func.command, "GLOBALHIDEFILENAME"
if not(flt.enable) then clickData.func.command.AddLine("Set GLOBALHIDEFILTER on")
clickData.func.command.Run
end if
End Function
Function EscapeFilename(strName)
strName = Replace(strName, "'", "''")
strName = Replace(strName, "#", "'#")
strName = Replace(strName, "(", "'(")
strName = Replace(strName, ")", "')")
strName = Replace(strName, "~", "'~")
strName = Replace(strName, "[", "'[")
strName = Replace(strName, "]", "']")
EscapeFilename = strName
End Function
Function AddToFilter(strPattern, vecItems, cmd, arg)
Dim f, existingMatches, setNewMatches
if Left(strPattern, 1) = "(" then strPattern = Right(strPattern, Len(strPattern) - 1)
if Right(strPattern, 1) = ")" then strPattern = Left(strPattern, Len(strPattern) - 1)
existingMatches = Split(strPattern, "|")
Set setNewMatches = DOpus.Create.StringSetI
for each f in existingMatches
setNewMatches.insert(f)
next
For each f in vecItems
setNewMatches.insert(EscapeFilename(f))
Next
strPattern = "("
for each f in setNewMatches
if Len(strPattern) > 1 Then strPattern = strPattern & "|"
strPattern = strPattern & f
next
strPattern = strPattern & ")"
cmd.AddLine "Set " & arg & " """ & strPattern & """"
End Function
Are you saying I could modify this script to do the reverse (unhide instead of hide)? If so, could you tell me how to do this? Thanks for your help.
I have no scripting experience. I don't want to take up your time, I just thought I could modify the same script that adds objects to the Global Filters. Thank you.