Open Favorites in same or new tab depending on current tab

Hello, I'm new to Directory Opus scripting, so maybe anyone could help me?

I have a Folder Locations special button on a separate toolbar. I have it configured with Multifunc argument and it works fine:
MULTIFUNC KEYARGS "shift:none" "ctrl:NEW" "none:NEWTAB=findexisting"

Thing is I want to add a condition so that if currently open tab is "This PC", then the non-modified click will open favorite in the same tab. I'm struggling with the syntax. I copied a part from the default "Flat View" button, modified it a bit and here is what I got:
@if:{sourcepath}="This PC"
Favorites MULTIFUNC KEYARGS "shift:none" "ctrl:NEW" "none:none"
@if:else
Favorites MULTIFUNC KEYARGS "shift:none" "ctrl:NEW" "none:NEWTAB=findexisting"

As expected, this doesn't work, I don't even see the list of favorite locations, just the button. Can anyone help with the code or show me, where can a noob like me learn about scripting from scratch?

I don't think there is a way to do that with something like Favorites which generates a list of dynamic buttons.

It can be done with individual buttons for specific paths (i.e. where each button is created separately, and has the path it goes to inside the button itself, rather than coming from the Favorites list or similar).

@if:{sourcepath}="This PC" also won't work in general, but there is an @ifpath modifier for doing something similar. You'd need to use the /mycomputer alias to test for the This PC folder.

1 Like

Thanks again for a quick reply, it's a pity it can't be done with Favorite Locations menu, I just tried. And yes, the button solution works, though a bit time-consuming to setup.