LinkedTab_AutoOpen_Handler: Open related folder tabs automatically

Thanks, steje. Yes, i think there was something, but i need re-check things, before i can say, what it exactly was. I think, one thing was, that i wanted a change regarding the automatic linking. Also, maybe a slightly different way to fetch the befriended folder. I will report back soon.

Okey! Yes, I remember you wanting a way to disable the auto-linking.

If you DON'T normally want the paired path tabs to be slaved together - I added the OpenLinkedTab_Slaved script config option last year which disables slaving the tabs when set to False. Is that good enough, or do you in fact want some sort of an ON DEMAND WAY to enable/disable the slaving of the tabs? Slaving tabs manually is really easy - just <Ctrl+click> one of the tabs.

I also added a script command to the last script package update (1.20) so that you have the ability to do what you asked for with THIS request from awhile back:

As well as what I think you might have meant from your last comment:

So for this I added the LinkedTab_AutoOpen script command that lets you call up the paired folder after the fact in the following sort of scenario:

  • LinkedTabList has a set of paired folder paths like: D:\folder1 || E:\folder1
  • You opened D:\folder1\folder2\folder3 BEFORE enabling the script to auto-open E:\folder1, and now you want E:\folder1 opened withOUT having to go back up to D:\folder1 and toggle the script on, then navigate back to the sub-dir you were in
  • Running the LinkedTab_AutoOpen RESYNC=read script command will then leave your source tab positioned in the current D:\folder1\folder2\folder3 path while opening the paired E:\folder1 folder path in the other display

So I ~think that covers most of what you had asked for. Check out my last big update from 12/29 last year with a big button with variations on the use of the script command to see what the options do and let me know.

Thanks again, steje. I'm looking forward to test the new code. I've only fast-read your answer, will have to plunge into it later. The bottom part sound very interesting. I will test it, & maybe it's aleeady better than what i have thought about, some kind of hotkey to open the friends folder in the destination side. By the way, i'm glad you have provided so many modifier keys, because my old "Win-Enter" combination did not work any longer. That's a typical problem, when you have so many different shortcuts for different applications, even though most of them are not global. Luckily, many programs allow you to white list things, so it would work only in that specified context.

I am confused a bit now. Which modules exactly do i have to use to get the functions, you´ve described? Also, im not sure i have actually downloaded the latest version. Here´s a picture of the modules in use.

You can certainly bind a standard Opus hotkey to run the LinkedTab_AutoOpen RESYNC=read script command...

By the way, with soooo many different things people want to use hotkeys for (you're not the only one - I recall some other users here on the forum talk about actually running out of hotkey bindings - that they can remember anyways), one thing you could consider doing is that for Opus scripts that use environment variables (like most of mine use) to enable/disable the script functions, you can also create hotkeys that do different things with the SAME qualifier keys - depending on what environment variables are set.

For instance, consider things like (as a hotkey):

@ifset:$lst:linkedtab_autoopen
LinkedTab_AutoOpen RESYNC=read

@ifset:$glob:SCRIPT_DEBUG
@confirm Script debugging is enabled...

@ifset:else
go newtab

So for such scripts - you can consider create context sensitive hotkey bindings based on Opus environment variables providing the context... yay! I've been thinking of writing a script wrapper to provide better conditional control over 'what to do' based on what vars are enabled, since the @ifset modifier in Opus doesn't really allow a scripts level of flow control. You could even get a bit advanced to catch conditions when you're using multiple script at the same time and you want a hotkey to do multiple things under multiple script based variable control, even a popup menu with a list of actions to take depending on what vars are enabled, where you can enable a checkbox, hit ok - then the script performs a series of actions based on you having pressed the hotkey.

Let me know if you're interested in such a thing... I have a few tweaks to my old scripts to take care of - then will probably work on such a hotkey wrapper script.

This update adds support for Ctrl and Alt qualifier keys... which I guess I left out originally when it was bundled with the LinkedTab_AutoClose script, since those qual keys are hard coded in Opus to do other things when dbl-clicking on tab headers.

I've also added some experimental support for the use of regular expressions in response to CWagner's request. This is currently only supported for use in the uni-directional format for the LinkedTabList property. This so that when entering a folder whose path matches the regex, an absolute path can then be referred to to open the paired folder. Regular expressions should be placed as the first part of a uni-directional paired folder entry using && as the delimiter, and should be pre-pended by the string re://:


As shown above, the very simple regex of temp will cause the script to open a linked tab for [b]d:[/b] any time a folder named temp. The script creates a standard VBscript regex object then sets the pattern to the value following the re:// prefix... You should take any case sensitivity concerns into account in the regex itself.

@abr: I've just posted a new version - so please grab v1.2.2 from the root post.

In addition, you should get rid of the older 1.0.8 version all-together. The one named: OnAfterFolderChange_LinkedTab_AutoOpen

Steje, thanks. However, i am completely lost now. I have to admit, that i have no idea how to set up the whole command. My last try ended up in some infinite loop. I have to begin from scratch. If i understand right, all i need to use is the Linked_Tab_AutoOpenHandler, but not Linked_Tab_AutoCloseHandler?

I have tried "LinkedTab_AutoOpen RESYNC=read" (also, without the "read"), which led to smoe infinite loop, opening lots of identical messages at the bottom of the lister. With the other command

<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
   <label>LinkedTab_AutoClose</label>
   <icon1>#closetab</icon1>
   <function type="normal">
      <instruction>@toggle:if $lst:linkedtab_autoclose</instruction>
      <instruction />
      <instruction>@ifset:$lst:linkedtab_autoclose</instruction>
      <instruction>@set lst:linkedtab_autoclose</instruction>
      <instruction />
      <instruction>@ifset:else</instruction>
      <instruction>@set lst:linkedtab_autoclose=true</instruction>
   </function>
</button>

absolutely nothing happened, because i obviosuly didn't understand, waht i am doing :smiley:, while with the other code (i can't even find that in the two threads right now :blush:) i get some empty lister side. I slao don't know, if there is some new, completely insdependent command, or do i still need to push the qualifier key plus Enter? I have to look into it in the afternoon, maybe i find something new.

(i meant this code

@toggle:if $lst:linkedtab_autoclose

@ifset:$lst:linkedtab_autoclose
@set lst:linkedtab_autoclose

@ifset:else
@set lst:linkedtab_autoclose=true

it does nothing at the moment, as it surely doesn't make much sense, what i've tried so far). Maybe you can help me to start from scratch? Here are my basic questions

  • Which module do i need (only LinkedTab_AutoOpenHandler v.1.2.2, i suppose) (i have thrown out that 1.08 module, like you have suggested)

  • do i need qualifier keys at all, or is there some other single command to open the other folder from within one folder (which is how i understood)

I also have to find out about the new re:// part, which looks quite interesting. Thanks, i will keep trying, & looking forward to get it to work!

You'd do well to read the threads :slight_smile:...

I originally bundled this script with a second/companion script that handled the 'auto close' of a linked tab - but later broke it out to it's own script. So for THIS 'auto open' script, the variable names you mentioned above do nothing (they are the variables to control the 'auto close' script). Check the root post of this thread for the 'linkedtab_autoopen' vars needed to control this script.

For the other problems, all I can suggest is to go into the script configuration options in Prefs, and enable the DEBUG option (set to True). Grab a screenshot of the scripts config options as well as the entries in the LinkedTabList option and post them here along with the log (you can copy the script log from the Opus' Output Window).

I will do that. Thanks steje. It's a big thread, with many changes, but i will work through it again. :slight_smile:

Just look at the updated root post as well as the Dec 29 2015 entry here... That should be all you need to look at.

But also, just turn on debug and post the log. I'll have time this today and this weekend to look at it.

If i use the command LinkedTab_AutoOpen RESET RESYNC, i will get an infinite loop in the destination folder.

 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(9):  S:\ || R:\
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  Found match...
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    Relative Path:  
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  ResyncPath will be READ if it exists:
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    ResyncPath:  R:\
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    ResyncPath exists
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  Read initial path for paired folder in dest tab:  R:\
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  Path RESYNC OK!
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  OnLinkedTab_AutoOpen:
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  LinkedTab_AutoOpen RESYNC
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  Source path:  N:\
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  Parsing LinkedTabList...
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(0):  N:\Bilder || K:\"H:\Fotografie2"Bilder\Fotografie
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(1):  R:\Filme || N:\Filme
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(2):  M:\ || L:\Musik2
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(3):  L:\Web\Dropbox\Dropbox\Phot (1)\Phot (1) || H:\_FTP
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  OnAfterFolderChange:  N:\
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  No valid qualifier key was used, exit...
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(4):  F:\ && K:\Bilder\Fotografie
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(5):  N:\RTFs\Routen || L:\Web\Routen
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(6):  E:\BikeNav || L:\Web\Routen
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(7):  H:\_FTP || L:\Dropbox\Phot (1)\Dropbox\Phot (1)\Phot (1)
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(8):  K:\Bilder\Fotografie || H:\Fotografie2
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:    LinkedTabList(9):  S:\ || R:\
 25.11.2016 14:33 LinkedTab_AutoOpen_Handler:  No matches found in LinkedTabList
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  OnAfterFolderChange:  C:\Users\abr\AppData\Roaming\GPSoftware\Directory Opus
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  No valid qualifier key was used, exit...
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  OnAfterFolderChange:  C:\Users\abr\AppData\Roaming\GPSoftware\Directory Opus\ListerStyles
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  No valid qualifier key was used, exit...
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  OnAfterFolderChange:  C:\Users\abr\AppData\Roaming\GPSoftware\Directory Opus
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  No valid qualifier key was used, exit...
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  OnAfterFolderChange:  C:\Users\abr\AppData\Roaming\GPSoftware\Directory Opus\Logs
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  ----------------------------------------------------------------
 25.11.2016 14:34 LinkedTab_AutoOpen_Handler:  No valid qualifier key was used, exit...

Thanks. What are the script options set to?

Like following:

[imgur link broken]

I'm not seeing any sign of an infinite loop happening because of my script though. What visually happening in the destination when you run the command?

The log seems to be missing the beginning also, can you repeat the test or post the entire log. Also, what paths were you in when you ran the 'LinkedTab_AutoOpen RESET RESYNC' command? It looked like one run of the command worked at the top of the log.

Ohhhhhhhhhhh... thanks for posting the script options. You definitely shouldn't have 'LinkedTab_AutoOpen RESET RESYNC' in the 'OpenLinkedTab_Action' option. You're CAUSING the loop by doing that. Consider the following: with the settings above, if the script performs it's normal function and opens a linked tab, you are then asking the script to reset and resync the tabs, which then runs, and then resets and resyncs the tabs, again and again.

The 'OpenLinkedTab_Action' option was added to allow you to run some 'other' Opus command when the linked tab gets open. See my example where instead of using slaved tabs, you could enable Navlock, or maybe you want to change the folder format, or some other arbitrary thing.

The 'LinkedTab_AutoOpen' script command was added to give you a way of MANUALLY resetting the folder paths back to the paired folder tab paths specified in the script options. You had wanted this in case you had opened a sub-folder of one of the paired paths BEFORE enabling the script and wanted to get the paired folder path opened without having to go back to one of the trigger paths, then enable the script, then click back through the folders just to get back to where you were. This command is intended to be used manually via toolbar button or hotkey or whatever.

With the other script options you have set, you don't need either a button with environment variables OR a qualifer key to enable the script as it's currently set to 'Always_On'.

Hope that helps... Note: you also have what looks like an invalid folder in LinkedTabList - with double-quote marks around "H:\Fotografie2". It shouldn't hurt anything being there, but that folder pairing will just thrown an error and will never "work".

Ok, but if i remove the RESET RESYNC, nothing seems to happen.

This is stuff i would check, once i get the basics working. But yeah, interesting option.

Is there a way to be in one of the folders, which have a linked folder, just using a shortcut like Alt-L-I, which would open the partner folder in the destination, without any qualifier key at all? I also have no idea, which environment variables you mean.

Oh, thanks. I have removed those quotes, they must have been there by mistake.

Ok, so I suggest you do the following:

  • Leave DEBUG set to True
  • Leave OpenLinkedTab_Slaved set to False
  • Clear out the OpenLinkedTab_Action option (leave it blank)

Add this three-button to a toolbar:

<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none" type="three_button">
	<label>LinkedTab_AutoOpen</label>
	<icon1>#foldertabgrouplist</icon1>
	<button backcol="none" display="both" label_pos="right" textcol="none">
		<label>LinkedTab_AutoOpen (toggle)</label>
		<icon1>#foldertabgrouplist</icon1>
		<function type="normal">
			<instruction>@toggle:if $lst:linkedtab_autoopen</instruction>
			<instruction />
			<instruction>@ifset:$lst:linkedtab_autoopen</instruction>
			<instruction>@set lst:linkedtab_autoopen</instruction>
			<instruction />
			<instruction>@ifset:else</instruction>
			<instruction>@set lst:linkedtab_autoopen=true</instruction>
		</function>
	</button>
	<button backcol="none" display="both" label_pos="right" textcol="none">
		<label>LinkedTab_AutoOpen</label>
		<icon1>#foldertabgrouplist</icon1>
		<function type="normal">
			<instruction>@keydown:none</instruction>
			<instruction>linkedtab_autoopen reset</instruction>
			<instruction />
			<instruction>@keydown:ctrl</instruction>
			<instruction>linkedtab_autoopen reset resync</instruction>
			<instruction />
			<instruction>@keydown:shift</instruction>
			<instruction>linkedtab_autoopen resync</instruction>
		</function>
	</button>
</button>

Test with Always_On set to True: you don't need the toolbar button

  • Open folder R:\Filme
  • The script event handler should open the paired folder N:\Filme in a linked tab

Test with Always_On set to False: this disables the script, you'll enable it 'on-demand' using the toolbar button to toggle it's environment variable

  • Open folder R:\Filme
  • The script event handler should do nothing (it's disabled)

Toggle the script ON by normal Left-Click on the toolbar button (toggles the 'linkedtab_autoopen' lister scoped variable on)

  • Open folder R:\Filme again
  • The script event handler should open the paired folder N:\Filme in a linked tab (same behavior as when 'Always_On' was set to 'True')

Toggle the script OFF by Left-Clicking on the toolbar button again (toggles the 'linkedtab_autoopen' lister scoped variable off)

  • Create the same temporary subfolder structure in both R:\Filme and N:\Filme - say dir1\dir2\dir3

  • Open folder R:\Filme\dir1\dir2\dir3

  • The script event handler should do nothing (it's disabled again)

  • Right-Click on the toolbar button

  • The 'linktab_autoopen' script command does a RESET operation which sends just the source tab back to it's initial (parent) dir R:\Filme (based on seeing that your current dir is a subfolder of one of the entries specified in the scripts LinkedTabList option)

  • Open folder R:\Filme\dir1\dir2\dir3 again

  • The script event handler should do nothing (it's still disabled)

  • <Ctrl>+Right-Click on the toolbar button

  • The 'linktab_autoopen' script command does a RESET plus RESYNC operation which sends the source tab back to it's initial (parent) dir R:\Filme again, and also opens the paired folder N:\Filme in a linked tab

  • Close the new linked tab pointing to N:\Filme

  • Open folder R:\Filme\dir1\dir2\dir3 again

  • The script event handler should do nothing (it's still disabled)

  • <Shift>+Right-Click on the toolbar button

  • The 'linktab_autoopen' script command does a RESYNC operation (RESYNC=read by default) leaves the source tab unchanged (still in 'dir3') but opens the paired folder N:\Filme\dir1\dir2\dir3 in a linked tab. If the relative \dir1\dir2\dir3 path doesn't exist, you'll get an error of course, but there is also a script command option to do a RESYNC=create operation that attempts to create the missing relative folder path (\dir1\dir2\dir3) under the base parent paired folder path (N:\Filme).

As long as you get the same results as I've posted above - that should get you sorted out with how the script was intended to be used. And with that as a starting point I hope the use of the other options become apparent, but feel free to ask more questions and I hope it's useful :slight_smile:. Unless you read the root post as well as the post from Dec 29 2015 post I linked to - it might not be apparent that this script has two main components:

1.) an 'event handler' component that Opus runs on OnAfterFolderChange events
2.) a 'script command' that gets used in the toolbar button to take advantage of some of the scripts config options AFTER you've opened one of your paired folder paths, but didn't initially have the script 'enabled'

I'll update the root post so it fully explains what the script is all about with the latest changes and enhancements...

...just be sure to reset DEBUG back to False when you're done testing...

Sorry, it doesn't work. I have tested both, Always_On set to true, or to false, but the linked folder just doesn't open. I see Opus' animation in the source folder, though, indicating, that something is happening. It is version 1.2.2 alright, i've checked that a couple of times.

BUT here's the good news: If i define a qualifier key, it works! :thumbsup:

So here's where the fun part of the testing starts. I can easily live with using a qualifier key. :sunglasses:

I will report back some time later, thanks a bunch, steje!