How to make these 2 simple scripts?

Discuss and share scripts and script files...
Post Reply
ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

How to make these 2 simple scripts?

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

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: How to make these 2 simple scripts?

Post 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
Last edited by Stefan on 27 Jan 2011 12:41, edited 2 times in total.

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: How to make these 2 simple scripts?

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

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: How to make these 2 simple scripts?

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

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

Re: How to make these 2 simple scripts?

Post 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'); }

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: How to make these 2 simple scripts?

Post by ghost zero »

seems to work great, thanks!

Post Reply