I want to create a new script that run Opus command when new lister is open.
' Called when a new Lister is opened
Function OnOpenLister(openListerData)
XXXX.RunCommand "Go C:\ EXPANDTREE"
End Function
Can I have some help please
I want to create a new script that run Opus command when new lister is open.
' Called when a new Lister is opened
Function OnOpenLister(openListerData)
XXXX.RunCommand "Go C:\ EXPANDTREE"
End Function
Can I have some help please
Function OnOpenLister(openListerData)
Dim cmd
set cmd = DOpus.NewCommand
cmd.RunCommand "Go lib:// EXPANDTREE"
End Function
It’s ok but if a lister is already open in current lister, tree is expand then new lister is open.
What's the overall aim of the script? OnOpenLister may not be the right event, e.g. if you need to check what the existing tabs are showing (they won't be open yet).
Only root item expansion is save in default lister.
My root item is "Desktop" with Library below it.
So I want to expand Library when I open new lister.
If you go to Preferences / Folder Tree / Contents and turn off the option to put Libraries under Desktop, they will get a top-level branch instead, if that helps.
Otherwise, Go lib:// EXPANDTREE will go to the folder as well as expanding the tree, so you might as well make the folder one of your default tabs in that case.
Yes but Libraries are display at the very bottom of tree
Option "Display at the top of the tree" will be perfect.
I note that if I use command Go NEW to open lister, script runs command Go lib:// EXPANDTREE to the current source lister, then open new lister.
If command is Go NEW=source, new lister is open then command Go lib:// EXPANDTREE is run.
And command seems to be run before displaying default folder saved in default lister, so Libraries are expand and default folder is selected automatically.
Problem double click on desktop shortcut run Go NEW command, so Libraries are not expand.
If you use DOpus.NewCommand then you get a command object with no source lister/tab set, and if you don't set one then it has to guess which one you want to use.
The differences you're seeing are due to changing things that it uses to guess which lister/tab you want it to use.
You could try explicitly setting the command object's source tab to the lister's source tab, although I am not sure if any tabs will actually be open at the time OnOpenLister is called. (It may work. i can't remember off the top of my head.)
[quote="AlbatorV"]If command is Go NEW=source, new lister is open then command Go lib:// EXPANDTREE is run.
And command seems to be run before displaying default folder saved in default lister, so Libraries are expand and default folder is selected automatically.
Problem double click on desktop shortcut run Go NEW command, so Libraries are not expand.[/quote]
If default folder is selected when lister is open, his format is not use.
As a workaround, I need to add Go /myfolder to script.
' Called when a new Lister is opened
Function OnOpenLister(openListerData)
Dim cmd
set cmd = DOpus.NewCommand
cmd.RunCommand "Go lib:// EXPANDTREE"
cmd.RunCommand "Go /mycomputer"
End Function
(Remember that script is ok only if lister is open by command Go NEW=source)