Page 1 of 1

Variable of the drive XYplorer is run from

Posted: 13 Jun 2019 14:19
by selukwe
I am trying to add a custom program to a XYplorer's toolbar and I need a variable to always load it from the drive from where XYplorer is started, so that it would allow automatic portability if it is run from different drives. Variable <xydrive> as advised in the XYplorer Help doesn't work. I tried the following pattern in a Custom Button | On left click:

Code: Select all

run '"<xydrive>\My Folder\My Program.exe"';
No go.

Anyone able to help?

Re: Variable of the drive XYplorer is run from

Posted: 13 Jun 2019 14:35
by highend
' = no variable resolving inside of them.

Either quote it correctly or use the lax() command to avoid that...

Re: Variable of the drive XYplorer is run from

Posted: 13 Jun 2019 14:43
by selukwe
I can of course hard code it as :

Code: Select all

run '"C:\My Folder\My Program.exe"';
But then when I run XYplorer from a flashdisk at work from drive e.g. F:, then it doesn't work, obviously.

Is there a way to make it work from any drive XYplorer is run from automatically?

I also tried just:

Code: Select all

run '"\My Folder\My Program.exe"';
but while this works OK for a separately assigned program's icon, My Program sometines loads OK, sometimes the script ends with error. I couldn't establish what affects this.

Re: Variable of the drive XYplorer is run from

Posted: 13 Jun 2019 14:52
by highend
Emmmm....

Code: Select all

    run """<xydrive>\<some path on xys drive>\<some file>.exe""";
    run lax("<xydrive>\<some path on xys drive>\<some file>.exe");
What I said above^^

Re: Variable of the drive XYplorer is run from

Posted: 13 Jun 2019 14:58
by selukwe
These both work like a charm! MANY THANKS:)

Case closed.

Re: Variable of the drive XYplorer is run from

Posted: 14 Jun 2019 08:48
by jupe
For anyone reading this that ever has problems with quoting/variables resolving, you may find it easier to use runq instead.

eg: runq "<xydrive>\My Folder\My Program.exe";

Re: Variable of the drive XYplorer is run from

Posted: 14 Jun 2019 09:00
by selukwe
Great! Thanks:)