Variable of the drive XYplorer is run from

Discuss and share scripts and script files...
Post Reply
selukwe
Posts: 73
Joined: 02 Apr 2012 14:10

Variable of the drive XYplorer is run from

Post by selukwe » 13 Jun 2019 14:19

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?

highend
Posts: 8302
Joined: 06 Feb 2011 00:33

Re: Variable of the drive XYplorer is run from

Post by highend » 13 Jun 2019 14:35

' = no variable resolving inside of them.

Either quote it correctly or use the lax() command to avoid that...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

selukwe
Posts: 73
Joined: 02 Apr 2012 14:10

Re: Variable of the drive XYplorer is run from

Post by selukwe » 13 Jun 2019 14:43

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.

highend
Posts: 8302
Joined: 06 Feb 2011 00:33

Re: Variable of the drive XYplorer is run from

Post by highend » 13 Jun 2019 14:52

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^^
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

selukwe
Posts: 73
Joined: 02 Apr 2012 14:10

Re: Variable of the drive XYplorer is run from

Post by selukwe » 13 Jun 2019 14:58

These both work like a charm! MANY THANKS:)

Case closed.

jupe
Posts: 1240
Joined: 20 Oct 2017 21:14
Location: 1903 x64

Re: Variable of the drive XYplorer is run from

Post by jupe » 14 Jun 2019 08:48

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";

selukwe
Posts: 73
Joined: 02 Apr 2012 14:10

Re: Variable of the drive XYplorer is run from

Post by selukwe » 14 Jun 2019 09:00

Great! Thanks:)

Post Reply