Make a Lister select file other than first in only 1 specific folder

I would like to modify the Automatically select first file in folder (except in Power Mode) option for only a specific folder, instead of globally for all folders, and instead of selecting the first file in the file list, I want to have a specific file lower in the file list to be selected instead.

An example of what I mean:

I have a folder named C:\Passwords with the following files:


I want File4.txt to always be automatically selected, instead of File1.txt

By the way: I also have folders named \Passwords on multiple drives which contain backups of the example file described above (File4.txt). If I could have Directory Opus select File4.txt whenever I go to any of those other folders named \Passwords, that would be great. Thanks!

You could do this via a script that uses the OnAfterFolderChange event, checks the folder name, and runs the select command if it's the right folder.

If you need help writing a script, just ask!

Thanks for responding, Leo. If you have the time, I'd appreciate help with making a Lister select a specific file other than the first one. I don't know anything about scripting (yet), so any help would be greatly appreciated.

Here's a sample script. You should just need to change the path and filename at the top:

[code]SpecialFolder = "C:\Program Files"
SpecialFile = "Internet Explorer"

' Called by Directory Opus to initialize the script
Function OnInit(initData) = "Special Auto-Select"
initData.desc = ""
initData.copyright = ""
initData.version = "1.0"
initData.default_enable = true
End Function

' Called after a new folder is read in a tab
Function OnAfterFolderChange(afterFolderChangeData)
If ( = SpecialFolder) Then
Set cmd = DOpus.Create.Command()
cmd.RunCommand "Select PATTERN=""" & SpecialFile & """ EXACT SETFOCUS DESELECTNOMATCH"
End If
End Function[/code]

Download the .vbs.txt attachment, edit the top two lines and save the change, then drag the .vbs.txt file to Preferences / Toolbars / Scripts to install it.

Special_Auto-Select.vbs.txt (669 Bytes)

Thank you so much, Leo. I appreciate all of the help you've given me.

Leo, I was wondering if the script you wrote for me can be modified to work with multiple folders on multiple disk drives that all have the same file names and folder names? To clarify, I keep a copy of my Outlook.pst database file on multiple disk drives, like this:

G:\Outlook\Outlook.pst ... and so on.

I would like to use just one copy of your script that will auto-select the Outlook.pst anytime I go to a folder named \Outlook on any disk drive. I currently have created a copy of your script for each drive, but if it can be made to work like a File and Folder Label wildcard... is this possible? Thanks.

Easy enough. I've made it configurable:

The new version can be found in the Script Add-Ins area, here: Auto-select certain files when entering certain folders.