@ifpath:This PC/My Computer/Computer

I want to change the Backspace hotkey so it will not go up if the current folder is "This PC/My Computer/Computer". I tried this:

@ifpath:This PC @ifpath:else go up back

It doesn't work.

On the topic Preventing Directory Opus from showing "Computer", Leo suggests that something like that can be done with a script and Tbone shared this:

@script jscript function OnClick(data){ var pathNow = new String(data.func.sourcetab.path); //current path is drive root? if (pathNow.length==3 && pathNow.substring(1,3)==":\\"){ //drive root, do nothing but return return; } data.func.command.RunCommand("Go UP BACK"); }

Before I delve myself in scripting for Opus (something I tried before, but I am not used to), I am going to ask you for help: do you guys know how I could accomplish what I want using @ifpath or with a modified version of that script?

If you run this

function OnClick(clickData) { sourcePath = clickData.func.SourceTab.Path; DOpus.Output(sourcePath) }

when in This PC, it will print the GUID name for the path:

::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

You should be able to use that as the path string you compare against in TBone's script to make it do something different when in This PC.

I'm not sure there is a way to do it using @ifpath.

This should do it:

[code]@script jscript

function OnClick(data){
var pathNow = new String(data.func.sourcetab.path);
if (pathNow == "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"){
//computer, my pc
return;
}
data.func.command.RunCommand("Go UP BACK");
}
[/code]

1 Like

Thank you, that did it, exactly what I needed.