When I click on Computer, I want any expanded folders and drives to collapse. Is there an option for this or a script that can do this? I know that open folders will collapse when I click on another drive or folder, but it doesn't do it when I click on Computer.
Did you try double clicking?
When I double click This computer or any drive or folder it collapses or expands, depending on the state it was in.
In Preferences > Folder Tree > Options there is a setting Expand/Collapse all child branches when parent double-clicked.
If you select this it expands all folders and not only the ones that where expanded before you collapsed.
Maybe you like that setting (I don't).
Maybe I didn't explain it right. First image I have Drive P expanded. When I click on Computer, I want Drive P to collapse is in the second image. Double clicking on Computer collapses everything under Computer which is not what I want
Ah, I see. The only other option I know is to collapse all drives automatically when you select another one.
This setting is under Preferences > Folder Tree > Options > Collapese non-selected branches and its sub option Unless open in other tabs.
If you single click a closed drive (H:\ for example) it would collapse all other drives and gives the result in the second image. So instead of double clicking Computer you click a folder. Maybe not quite what you want, but it comes pretty close.
But if you don't like your folders collapsing every time then this is not an option too I think.
I don't think the option you want is possible. It would be an exception to the way (double) clicking works with drives and folders. But maybe the DO developers know something.
Folder Tree branches not collapsing has some similar discussion, and an explanation of why the auto-collapse option isn't applying here.
You could probably have a script which runs on folder change, checks if you are in the Computer folder and, if you are, runs this:
Go ROOT=collapse
Go CURRENT EXPANDTREE
That would have the effect of collapsing the other drives whenever you went to Computer.
I created a script and when I run the script, the "Go CURRENT EXPANDTREE" calls the script again and it is in a loop collapsing and expanding. I have to kill DOpus in Task Manager.
[code]option explicit
' ComputerCollapse
' (c) 2016 Jerry
' This is a script for Directory Opus.
' See http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.
' Called by Directory Opus to initialize the script
Function OnInit(initData)
initData.name = "ComputerCollapse"
initData.version = "1.0"
initData.copyright = "(c) 2016 Jerry"
' initData.url = "https://resource.dopus.com/viewforum.php?f=35"
initData.desc = "Collapse all drives and folders when Computer selected"
initData.default_enable = true
initData.min_version = "12.0"
End Function
' Called after a new folder is read
Function OnAfterFolderChange(afterFolderChangeData)
Dim objCmd
If afterFolderChangeData.result Then
DOpus.Output afterFolderChangeData.tab.path
' Check if the path is Computer
If Left(afterFolderChangeData.tab.path, 11) = "::{20D04FE0" Then
DOpus.Output "Found Computer"
Set objCmd = DOpus.CreateCommand
objCmd.RunCommand("Go ROOT=collapse")
objCmd.RunCommand("Go CURRENT EXPANDTREE")
End If
End If
Set objCmd = Nothing
End Function
[/code]
Add the NOSCRIPT argument to the two Go commands and that should stop.
Thanks Leo, that worked.