"Open" command for toolbar button - trouble scripting

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
BrooksNYC
Posts: 26
Joined: 03 Feb 2013 17:31

"Open" command for toolbar button - trouble scripting

Post by BrooksNYC »

Could someone help me with a small scripting chore? I'd like to open the Firefox Profile Manager, using a new toolbar button.

- - - - - - - - - - - - - - - -

FOR THE RECORD....

I already have a working shortcut to the Profile Manager on my Windows desktop. From the shortcut's "Properties" window, here is a precise copy/paste of the target:

"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -profilemanager

- - - - - - - - - - - - - - - -

When I go to edit the new XYplorer toolbar button, I can't figure out what to type in the "On left click" field.

So far, I've tried:

open "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -profilemanager;
open "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -profilemanager";
open "C:\Program Files (x86)\Mozilla Firefox\firefox.exe -profilemanager";

No matter where I position those quote marks, clicking the new button spits up error messages. Can anyone see where I'm missing the boat? Kind thanks for the help.

Brooks
Win 7 Pro, x64
XYplorer 27.20.0100 (32-bit) 🔸 Windows 10 Pro x64 (v 22H2)

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: "Open" command for toolbar button - trouble scripting

Post by TheQwerty »

You need to quote the entire parameter you give to the open scripting command.
Plus since you're passing arguments to the Firefox executable you need to quote the executable (and its path) within the quoted parameter.

Thus you need either:

Code: Select all

open '"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -profilemanager';
Which uses single quotes to quote the parameter and double quotes to quote the executable.

Or:

Code: Select all

open """C:\Program Files (x86)\Mozilla Firefox\firefox.exe"" -profilemanager";
Which uses double quotes to quote the parameter and escaped double quotes to quote the executable. (In XY you escape quotes by doubling them up.)

In this case there is not much difference between the two but if you were to use variables within the parameter then you'd want to use the second to ensure they get resolved. The first treats them as literal strings and does not interpolate them.

BrooksNYC
Posts: 26
Joined: 03 Feb 2013 17:31

Re: "Open" command for toolbar button - trouble scripting

Post by BrooksNYC »

Thank you so much! I've been an XYplorer user since version 12.0, and this is the first time I've tried scripting. Old and feeble-minded as I am, I actually understand what you did!

NOTE: I've made a correction to my original post. Anyone CLAMORING for this shortcut Image will want to know that there's a space between "Files" and "(86)", so that the code reads:

Code: Select all

open '"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -profilemanager';
OR...

Code: Select all

open """C:\Program Files (x86)\Mozilla Firefox\firefox.exe"" -profilemanager";
Again, I'm very grateful for your help, and thanks.

Brooks
XYplorer 27.20.0100 (32-bit) 🔸 Windows 10 Pro x64 (v 22H2)

Post Reply