Path condition (@ifpath) without a Lister

I created a global shortcut to start a command prompt (conemu.exe).

My intention is to open the command prompt at the specified sourcepath.
If there is no Lister logically there is no sourcepath. In this case, the command prompt should be opened at predefined path.

I tried the following:

@ifpath:*
C:\Program Files\ConEmu\ConEmu.exe /Dir {sourcepath}
@ifpath:else
C:\Program Files\ConEmu\ConEmu.exe /Dir C:\

When a Lister exists, everything works as expected.
But if there is no Lister, nothing happens :frowning:

I tried it with

@ifpathr:'.+'

as well :frowning:

Any ideas?

Thanks in advance.

Buttons using @ifpath will only work if there is a source path, unfortunately.

Maybe this will work (since ConEmu.exe defaults to the current dir, and lets you run a command via /cmd, and it's OK to run "cd" on its own):

cd C:\ "C:\Program Files\ConEmu\ConEmu.exe" /cmd cd {sourcepath}

If that doesn't work, I'd probably use a little external script, passing {sourcepath} to it and having it decide what to run.

We'll probably have a more flexible version of @ifpath in a future version.

It does not work :frowning:

I will try a script :slight_smile:

Thanks leo

If @ifpath doesn't work without a lister - try other tests to achieve what you want:

This example worked for me:

@ifset:STATE=Source "C:\Windows\System32\cmd.exe" /s /k pushd {sourcepath} @ifset:else "C:\Windows\System32\cmd.exe" /s /k pushd C:\
...obviously, there is no SOURCE state if there is no lister.

HOWEVER, a possible gotcha that probably would have tripped you up even if your @ifpath attempt had worked, is that if there IS a lister window open (or even several), but minimized or otherwise just not in focus - and you hit your hotkey INTENDING for a command prompt to open to C:\ because no lister was on top... it wouldn't work. It would probably open the command prompt to whatever folder you have open in whatever lister is currently recognized as the SOURCE.

Note: if the gotcha above is in fact an issue for you - you could probably handle this very easily via an AutoHotkey script and key-binding...

Hey, this works fine :slight_smile: :thumbsup:

@ifset:STATE=Source "C:\Program Files\ConEmu\ConEmu64.exe" /Dir {sourcepath} @ifset:else "C:\Program Files\ConEmu\ConEmu64.exe" /Dir C:\

Thanks a lot :exclamation: :exclamation: :exclamation: