Questions about /path=

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
highend
Posts: 9101
Joined: 06 Feb 2011 00:33

Re: Questions about /path=

Post by highend » 29 Mar 2016 20:03

Ah, ok.

Just escape the parentheses in your $exec command like:

Code: Select all

$exec("%PROGRAMFILES(X86)%\XYplorer\XYplorer.exe" /script="::echo exists$('%1'$)")
http://www.voidtools.com/support/everyt ... le_manager

explains how to escape chars like $, (, )...

E.g.:

Code: Select all

$exec("%PROGRAMFILES(X86)%\XYplorer\XYplorer.exe" /script="::if $(exists$('%1'$) == 1$) ${ goto '%1'; sel '+0'; focus; $} else ${ goto gpc$('%1', 'parent'$); selectitems gpc$('%1', 'file'$); sel '+0'; focus; $}")
Be careful, you'll get in trouble trying to open paths / files with an ' in it^^
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

reyaz
Posts: 18
Joined: 29 Feb 2016 17:15

Re: Questions about /path=

Post by reyaz » 30 Mar 2016 01:32

I see. There is a workaround for that limitation, sorry for ignoring the possibility of that.

I've tried your script. Indeed, troubles with ' are rather serious for me because I have enough names with it. If anything, it makes it an improper solution. Of course I'm still grateful for it.

Also, there seems to be a problem with handling folders. E.g. I'm trying to open "C:\masm32\macros" folder, here is the error message:

Code: Select all

Path 'C:\Program Files (x86)\XYplorer\masm32' could not be accessed.
goto
masm32
Seems like this can be fixed by changing 'parent' to 'path':

Code: Select all

$exec("%PROGRAMFILES(X86)%\XYplorer\XYplorer.exe" /script="::if $(exists$('%1'$) == 1$) ${ goto '%1'; sel '+0'; focus; $} else ${ goto gpc$('%1', 'path'$); selectitems gpc$('%1', 'file'$); sel '+0'; focus; $}")

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

Re: Questions about /path=

Post by highend » 30 Mar 2016 07:35

You can save a few characters by changing it to:

Code: Select all

$exec("%PROGRAMFILES(X86)%\XYplorer\XYplorer.exe" /script="::if $(exists$('%1'$) == 1$) ${ goto '%1'; $} else ${ goto gpc$('%1', 'path'$); selectitems gpc$('%1', 'file'$); $}; sel '+0'; focus;")
Maybe the problems with the ' character can be changed with a more intelligent use of quotes / double quotes and escaping them (Everything seems to be picky about using to surround the script part (while exchanging the single with double quotes there)). Haven't tried that though. An alternative would be a wrapper (in .ahk), that takes care of all of it)...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

admin
Site Admin
Posts: 49053
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Questions about /path=

Post by admin » 31 May 2016 11:41

reyaz wrote:1. XYplorer seem to not always selecting correct files when /path= command is used. See:
  1. When XYplorer is executed with

    Code: Select all

    XYplorer.exe /path="C:\Docs\file16.pdf"
    It should open a tab with C:\Docs\ and select file16.pdf.
  2. If XYplorer's last location was C:\Docs\ and last selected file was doc2015.txt, the same command line will just open the last view, it won't select file16.pdf.
  3. If XYplorer's last location was not C:\Docs\, the same command line will work as expected.
  4. If XYplorer is opened, it will re-open this location and properly select file16.pdf.
Is this a bug or is there an option to make it behave as I expect, to fix (b) point?
It was indeed a bug. Next beta should work as expected.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Wear a mask! 😷

Post Reply