Variable of the drive XYplorer is run from

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

Variable of the drive XYplorer is run from

Post 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?

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

Re: Variable of the drive XYplorer is run from

Post by highend »

' = 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

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

Re: Variable of the drive XYplorer is run from

Post 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.

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

Re: Variable of the drive XYplorer is run from

Post 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^^
One of my scripts helped you out? Please donate via Paypal

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

Re: Variable of the drive XYplorer is run from

Post by selukwe »

These both work like a charm! MANY THANKS:)

Case closed.

jupe
Posts: 2757
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Variable of the drive XYplorer is run from

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

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

Re: Variable of the drive XYplorer is run from

Post by selukwe »

Great! Thanks:)

Post Reply