Page 1 of 1

How to make these 2 simple scripts?

Posted: 16 Nov 2010 06:30
by ghost zero
Anyone know how to make scripts for these 2 actions? I want to make 2 toolbar buttons out of them...

- switch to thumbnails view and sort by modified date [ascending]

- switch to list view and sort by name [ascending]

Re: How to make these 2 simple scripts?

Posted: 16 Nov 2010 07:59
by Stefan
ghost zero wrote:Anyone know how to make scripts for these 2 actions?
I want to make 2 toolbar buttons out of them...
For adding CTB ("Custom Toolbar Buttons")
you may use this how to: http://www.xyplorer.com/xyfc/viewtopic. ... 908#p40908

- switch to thumbnails view and sort by modified date [ascending]
For using internal function ("Command IDs")
this description may help:

First note that "switch to thumbnails view"
can be found in Menu "View > Current Tab > Views > thumbnails "

The corresponding script command ID
can be seen in the "Customize Keyboard Shortcuts"-Dialog (at the "Tools"-menu)

Select here the Category "View" (corresponding to the "View"-menu)
and then find the command at the same position as in the view menu too.

Click on one of the thumbnails commands, f.ex at "Thumbnails #1",
and you see "#306" at an button below in that dialog.
That is the script command for that internal function: #306
(note that an script command need an trailing semicolon, so use #306; here inside an script)
(Hint: use "[Options...] > Copy Cheat Sheet" for an print-out of all IDs)



They same for "sort by modified date", Modified = #326;

For to sort Ascending or Descending i think you have to use the script command "sortby()"
See help > Advanced Topics > Scripting Commands Reference:
//sortby [column], [order (|a|d|clk)]
sortby "Modified", a;


So your script would be as simple as: #306; sortby "Modified", a;


- switch to list view and sort by name [ascending]

If you have more questions just ask, someone may help :D

Re: How to make these 2 simple scripts?

Posted: 16 Nov 2010 10:12
by ghost zero
thanks, but how do i make it so that the list view won't toggle between list and details view when pressed multiple times? same for the thumbnails view?

currently, since CTB can't stay pressed, a button can risk accidently being pressed twice and causing undesired toggle behavior.

Re: How to make these 2 simple scripts?

Posted: 16 Nov 2010 11:54
by Stefan
Ohh, #306; is an toggle ?! Right! Didn't know that till now.

I think an solution could be the brand new get() parameter "View"... IF "View" != 4 Then #306;..., but i have no time right now....later, yes? :wink:

Re: How to make these 2 simple scripts?

Posted: 16 Nov 2010 14:28
by TheQwerty
I think this should do it... maybe... :?

Code: Select all

"Thumbnails 1 by Modified"
  if (Get('View') != 4) { #306; }
  if (Compare(Get('Sort'), 'Modified,a')) { SortBy('Modified', 'a'); }

"List by Name"
  if (Get('View') != 2) { #304; }
  if (Compare(Get('Sort'), 'Name,a')) { SortBy('Name', 'a'); }

Re: How to make these 2 simple scripts?

Posted: 17 Nov 2010 07:24
by ghost zero
seems to work great, thanks!