Prevent opening non-existing path (do nothing)

This button command would open the actual %CLOUDPATH%, if set up as environment var - otherwise open C:\Program Files\GPSoftware\Directory Opus\%CLOUDPATH% (a path that doesn't exist) :

Go PATH="%CLOUDPATH%" NEWTAB=findexisting,tofront OPENINLEFT
Set FOCUS=left

My question is wether it's possible to prevent opening a path that doesn't exist per latter scenario. I.e. do nothing.

If not, I'd like to request an existingpath for the Go command that supresses missing paths.

Rationale being that I don't have a location at /onedrive since I'm using OneDrive for schools and organizations on this machine. However on other machines I might have the 'private' version of OneDrive and I want to make my DOpus portable.

@ifexists modifier: https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Command_modifier_reference.htm

Nice! Although I'm struggling finding a way to string together a proper command. None of these work.

Go PATH=@ifexists:"%CLOUDPATH%" NEWTAB=findexisting,tofront OPENINLEFT
Set FOCUS=left

...opens a path containing th estring "@ifexists"...

@ifexists:"%CLOUDPATH%"
Go PATH=%CLOUDPATH% NEWTAB=findexisting,tofront OPENINLEFT
Set FOCUS=left

...does nothing.

The second attempt looks fine. Try adding quotes:

Go PATH="%CLOUDPATH%" NEWTAB=findexisting,tofront OPENINLEFT

Hi lxp, my favorite DOpus community fellow. Hope you're doing great! :wink:

I was actually using that exact same line including quotes. But if you were to use it in a button, it would open the following non-existing path assuming you haven't set an Environment Path for %CLOUDPATH%:

C:\Program Files\GPSoftware\Directory Opus%CLOUDPATH%

I don't know how important this may be for other users (including me) but I have this niche case where the buil-in short path /onedrive will not open my OneDrive folder. And that's because I'm using my 'organization-version' of OneDrive which adds a bunch of letters eg. *\OneDrive - Högskolan Väst\ in my case.

I do however plan to use my private OneDrive as well, and switch between those. Or actually I don't (hehe), I thought I would. But it piqued my interest nevertheless to see if it's possible to suppress opening a path that don't exist. Which seems to be the case looking at Leo's answer. I just don't know how I'd format my line using the @ifexist modifier. :confused:

I'm sure it's not that complicated integrating the modifier, but my brain seems unable to figure it out.

Adding the quotes to your 2nd example (as Lxp suggests) seems to work:

@ifexists:"%CLOUDPATH%"
Go PATH="%CLOUDPATH%" NEWTAB=findexisting,tofront OPENINLEFT
Set FOCUS=left

That doesn't do anything if %CLOUDPATH% isn't defined.

That's it, Leo. And now I know how to use conditional modifiers! Thank you so much.

By the way. Does that condition count for all the lines below the modifier line? Would it be terminated if I copy the same bit and changed %CLOUDPATH% to let's say %CLOUDPATH2%?

To clarify my question: How do modifiers work: operate only on the first line below, or any lines.

Anwering my own question that I could've just looked up myself: Yes, modifiers operate on any number of consecutive lines :slight_smile: Consider this thread done here.