@ifsel:else with @label command does not work correctly?

I have a button that is supposed to Open a Folder in Windows Explorer. If a single folder is selected, Windows Explorer opens that folder, else it opens the source file display folder.

Here is the code:

//@nodeselect

@ifsel:numdirs=1,numfiles=0
@evalalways:Path=(selpath)
@label:"Open Windows Explorer in Subfolder: <b>" + Path
"/windows\Explorer.exe" /e, {filepath}

@ifsel:else
@evalalways:Path=(source)
@label:"Open Windows Explorer in the Source: <b>" + Path
"/windows\Explorer.exe" /e, {sourcepath}

From what I can tell, it is correctly entering the "else" clause and opens the correct folder in Windows Explorer but the @label:"Open Windows Explorer in the Source: <b>" + Path is never displayed only the

@evalalways:Path=(selpath)
@label:"Open Windows Explorer in Subfolder: <b>" + Path

Any ideas why?

Opus ignores @if modifiers when computing @label and @evalalways modifiers. The second will overwrite the first one.


Evaluator all the way :wink:

@evalalways:inSF = FileCount(true, "dirs:*") == 1 && FileCount(true, "files:*") == 0
@evalalways:p = inSF ? selpath : source
@label:"Open Windows Explorer in " + (inSF ? "Subfolder" : "the Source") + ": <b>" + p

/windows\Explorer.exe /e, {=p=}
XML
<?xml version="1.0"?>
<button backcol="none" display="label" textcol="none">
	<label>59686</label>
	<icon1>#newcommand</icon1>
	<function type="normal">
		<instruction>@evalalways:inSF = FileCount(true, &quot;dirs:*&quot;) == 1 &amp;&amp; FileCount(true, &quot;files:*&quot;) == 0</instruction>
		<instruction>@evalalways:p = inSF ? selpath : source</instruction>
		<instruction>@label:&quot;Open Windows Explorer in &quot; + (inSF ? &quot;Subfolder&quot; : &quot;the Source&quot;) + &quot;: &lt;b&gt;&quot; + p</instruction>
		<instruction />
		<instruction>/windows\Explorer.exe /e, {=p=}</instruction>
	</function>
</button>

@lxp As usual, thanks muchly.

I remain confused as the following commands with the same general structure do work without the second one overwriting the first:

@nodeselect

@ifsel:numdirs=1,numfiles=0
@evalalways:Path=(selpath)
@label:"Create a New Subfolder in the Selected Folder in the Source: <b>" + Path
@Set FolderName={dlgstringS|Create a New Subfolder within {sourcepath}{file}.\n\nPlease enter the new subfolder name.|{file}}
FileType NEW=directory NEWNAME=norename:"{$FolderName}" PATH="{filepath}"

@ifsel:else
@evalalways:Path=(source)
@label:"Create a New Folder in the Source: <b>" + Path
@Set FolderName={dlgstringS|Create a New Subfolder within {sourcepath}.\n\nPlease enter the new subfolder name.}
FileType NEW=directory NEWNAME=norename:"{$FolderName}" PATH="{sourcepath}"

@ifsel:Common
Play "C:\DOpus\Speech Misrecognition.wav" QUIET

Ideas?

And rightfully so. My apologies :blush:

While my original statement was technically correct, it wasn't the right explanation in this context.

That said, I don't think your second button behaves as intended either. It briefly displays the second label when a file is selected, but then reverts to the first label.

Opus also stops evaluating modifiers once it encounters the first actual command. If you comment out the FileType lines, only the second label is shown.

The flickering appears to be caused by the @ifsel:common part. Unfortunately, I don't have a solid explanation for this.

The takeaway: @label gets evaluated very frequently, @ifsel only at runtime.

Thanks for the explanation.