Vexed by simplest "moveto" script

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
aurumdigitus
Posts: 1075
Joined: 30 May 2008 21:02
Location: Lake Erie

Vexed by simplest "moveto" script

Post by aurumdigitus »

Know upfront scripting is new to me.

This moveto E:\Emitter\ runs perfectly from Scripting|Try Script but when used as a Catalog item (with the prepositional ::) it yields a "Nothing selected or what is selected cannot be moved".

The vexation comes not from that something is wrong but that it operates in the former case but not the latter.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Vexed by simplest "moveto" script

Post by jacky »

That would be because when you click on the Catalog item, focus is on Catalog and therefore command moveto relates to the Catalog item you just clicked. To prevent that, simply add focus; before, to send the focus back to List:

Code: Select all

::focus; moveto "E:\Emitter\";
Proud XYplorer Fanatic

aurumdigitus
Posts: 1075
Joined: 30 May 2008 21:02
Location: Lake Erie

Re: Vexed by simplest "moveto" script

Post by aurumdigitus »

jacky wrote:That would be because when you click on the Catalog item, focus is on Catalog and therefore command moveto relates to the Catalog item you just clicked. To prevent that, simply add focus; before, to send the focus back to List:

Code: Select all

::focus; moveto "E:\Emitter\";
Little Grasshopper humbly accepts you instruction oh great xywiki Master.

Still, it seems a little disingenuous that the code works in Try Script without any warning of possible pitfalls using it elsewhere. But that is the price tyros have to pay.

And also thank you for the alacrity of response!

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

Re: Vexed by simplest "moveto" script

Post by TheQwerty »

Alternately, you could use the GetInfo function to include the selected list item paths and ignore the focused control entirely using:

Code: Select all

::MoveTo("E:\emitter",GetInfo("SelectedItemsPathNames","|"));

aurumdigitus
Posts: 1075
Joined: 30 May 2008 21:02
Location: Lake Erie

Re: Vexed by simplest "moveto" script

Post by aurumdigitus »

TheQwerty wrote:Alternately, you could use the GetInfo function to include the selected list item paths and ignore the focused control entirely using:

Code: Select all

::MoveTo("E:\emitter",GetInfo("SelectedItemsPathNames","|"));
Thanks for the code segment which clearly utilizes advanced features. It will be filed away for reference when scripting has been better comprehended. :lol:

Post Reply