Page 1 of 1

Identifying Shortcut Target's Creation Date, Size

Posted: 23 Dec 2014 16:16
by vtnate02
I have a very simple problem. I have a folder full of shortcuts for which I can identify the SHORTCUT TARGET using the search column, but I also need to identify and list the SHORTCUT TARGET'S SIZE and Create/Modify Dates.

Any takers?

Re: Identifying Shortcut Target's Creation Date, Size

Posted: 23 Dec 2014 16:36
by bdeshi
Do you know how to add and show custom columns?

Re: Identifying Shortcut Target's Creation Date, Size

Posted: 23 Dec 2014 16:44
by vtnate02
I can get to the screen that allows me to edit an undefined custom column. But am admittedly out of my depth as far as the specifics that are required to create one with purpose.

Re: Identifying Shortcut Target's Creation Date, Size

Posted: 23 Dec 2014 16:53
by bdeshi
First, this is how you enable a custom column in the filelist.
* Main Menu -> View -> Columns -> Add Column.
* A new empty column is added to the filelist.
* Right click it's header, and choose "Select Custom Column".
[* then choose the desired custom column from the list that opens]

OK. Here goes.

==LINK TARGET SIZE==

Copy the following code.

Code: Select all

Snip: CustomColumn 1
  XYplorer 14.80.0000, 12/23/2014 9:59:18 PM
Action
  ConfigureColumn
Caption
  Target Size
Type
  3
Definition
   $format = 'KB';
  /*
  $format is the desired formatting of displayed size.
  It's value can be one of the following:
  FLEX : [Default] Flexible (best unit is auto-selected).
  FLEXR : FLEX, but rounded up.
  KB, MB, GB, TB, or PB : usual bytes unit.
  BB : Bytes (with unit)
  B : Bytes (no unit)
  KBR : KB, but rounded up.
  RAW: Raw number (no unit, no thousand separators).
  */
   $target = property('#LinkTarget', <cc_item>);
   if (exists($target)!=1){return ''}
   return formatbytes(filesize($target),$format)
Format
  0
Trigger
  0
Item Type
  0
Item Filter
  lnk
Now enter this into the addressbar of XY:

Code: Select all

::snippet <clipboard>;
A new custom column title "Link Target Size" will be created. Add it to filelist.

The steps are similar for the following columns. (1) copy code. (2) the ::snippet step. (3) show created column.

==LINK TARGET CREATION DATE==

Code: Select all

Snip: CustomColumn 1
  XYplorer 14.80.0000, 12/23/2014 9:58:51 PM
Action
  ConfigureColumn
Caption
  Target Creation Date
Type
  3
Definition
   $target = property('#LinkTarget', <cc_item>);
   if ($target){
    return property('#date.c', $target);
   }
Format
  3
Trigger
  0
Item Type
  0
Item Filter
  lnk
==LINK TARGET MODIFICATION DATE==

Code: Select all

Snip: CustomColumn 1
  XYplorer 14.80.0000, 12/23/2014 10:00:26 PM
Action
  ConfigureColumn
Caption
  Target Mod. Date
Type
  3
Definition
   $target = property('#LinkTarget', <cc_item>);
   if ($target){
    return property('#date.m', $target);
   }
Format
  3
Trigger
  0
Item Type
  0
Item Filter
  lnk

Re: Identifying Shortcut Target's Creation Date, Size

Posted: 23 Dec 2014 18:55
by vtnate02
Absolutely Genius. :appl: I am in your debt sir.

Will I have to run these scripts everytime in order to keep the custom columns or can I save the layout?

Re: Identifying Shortcut Target's Creation Date, Size

Posted: 23 Dec 2014 19:06
by bdeshi
My pleasure!
vtnate02 wrote: Will I have to run these scripts everytime in order to keep the custom columns or can I save the layout?
No, you do not have to run these scripts every time. They've been saved as Custom Column definitions.

by the way, the size information as I scripted is not very sorting-friendly. you might change the $format variable in the "Target Size" column. (the script has a comment that shows possible values) (edit: I've updated the LINK TARGET script above to be better sortable)