Page 3 of 5

Re: SC Command ::Make...

Posted: 10 Apr 2014 17:09
by admin
1) will document
2) will fix

Re: SC Command ::Make...

Posted: 10 Apr 2014 18:27
by admin
I think you can deduct usage from this example:

Code: Select all

// 20140410: select a file and show a pic below it
  $file = input("Enter filename (wildcards allowed)");
  $row = row($file);
  $column = "name";
  sel $row;
  $x = cell($row, $column, "x");
  $y = cell($row, $column, "y") + cell($row, $column, "h") - 10;  // 10 pixels up is better for this image
  makecoffee "<xyscripts>\katy.png", 1/5, $x, $y;

Re: SC Command ::Make...

Posted: 10 Apr 2014 19:49
by klownboy
I'm not adept yet at using the column script jargon yet, but after seeing Don's example above I tried this little script on any photo or picture. It will display the image half size below the file for a couple of seconds and then close. What I like is that it will work on any image in any mode not just details view.

Code: Select all

  $row = row(<curitem>);
  $column = "name";
  sel $row;
  $x = cell($row, $column, "x");
  $y = cell($row, $column, "y") + cell($row, $column, "h") - 10;  // 10 pixels up is better for this image
  if ((property("#11", "<curitem>")) == "Picture") {
    makecoffee "<curitem>", 1/2, $x, $y; wait 2000; makecoffee ""}

Re: SC Command ::Make...

Posted: 10 Apr 2014 20:30
by TheQwerty
cell(rowIdx, columnCaption, param);

param can be:
'w' width
'h' height
'x' x-position of left edge, relative to list's top-left.
'y' y-position of top edge, relative to list's top-left.
Anything else?

Re: SC Command ::Make...

Posted: 10 Apr 2014 22:10
by admin
Here is some XY source code that tells you the rest:

Code: Select all

    Select Case LCase$(sParams(2))
    Case "l", "left", "x":  sRet = CStr(rCell.Left)
    Case "t", "top", "y":   sRet = CStr(rCell.Top)
    Case "r", "right":      sRet = CStr(rCell.Right)
    Case "b", "bottom":     sRet = CStr(rCell.Bottom)
    Case "w", "width":      sRet = CStr(rCell.Right - rCell.Left)
    Case "h", "height":     sRet = CStr(rCell.Bottom - rCell.Top)
    End Select
Urgs, I just see how stupid I was in my example:
Instead of
cell($row, $column, "y") + cell($row, $column, "h")
I could have simply done
cell($row, $column, "b")

Re: SC Command ::Make...

Posted: 11 Apr 2014 17:16
by klownboy
Don, your makecoffee enhancenments work very nicely when you assign a default PFA for a PNG file especially since many tend to have the transparent background. Use a small script, something similar to the one I posted above (though that one could be slimmed down substantially especially if you're using it strictly for PNG files). It's better in some respects then opening the file with different viewer, at least when you're not in thumbnail view mode, since you only need to double-click on the file, the PNG pic displays and then disappears after a couple of seconds without you having to click to close the file. Very handy indeed.
Thanks,
Ken

Re: SC Command ::Make...

Posted: 11 Apr 2014 17:23
by admin
Wow, cool idea. :appl:

Re: SC Command ::Make...

Posted: 11 Apr 2014 18:00
by SkyFrontier
Guys,

I'm working on a way to quick display in a grid of thumbs several images spread over different source folders.

Any ideas on how to improve this?

Don, is it easy for you to confine different resolutions of images into a resolution for all thumbs?

Beta*:

Code: Select all

   $re = "";
   $x = 180;
   $y = 50;
   $max = 3;

   $x1 = $x;
   $y1 = $y;

   $a = get(selecteditemspathnames);
   foreach($tk, "$a", <crlf>) {

                              $ctrl++;
                              IF($ctrl == $max) { $x = $x1; $y = $y + 40; $ctrl = 0; }
                              ELSE {   }
                              $x = $x + 40;

// step;

                              $prop = property("#image.dimensions", $tk);
                              $p = gettoken($prop, 1, " x");
                              $fact = $p \ 100;
                              IF($fact <= 1) { $mult = 10; }
                              ELSEIF($fact == 2) { $mult = 9; }
                              ELSEIF($fact == 3) { $mult = 8; }
                              ELSEIF($fact == 4) { $mult = 7; }
                              ELSEIF($fact == 5) { $mult = 6; }
                              ELSEIF($fact == 6) { $mult = 5; }
                              ELSEIF($fact == 7) { $mult = 4; }
                              ELSEIF($fact == 8) { $mult = 3; }
                              ELSEIF($fact == 9) { $mult = 2; }
                              ELSEIF($fact >= 10) { $mult = 1; }
//                              ELSEIF($fact == ) { $mult = ; }
                              makecoffee "$tk", $mult/10, $x, $y;

                              }

/*

   $re = "";
   $x = 180;
   $y = 50;
   $max = 3;

   $x1 = $x;
   $y1 = $y;

   $a = get(selecteditemspathnames);
   foreach($tk, "$a", <crlf>) {

                              $ctrl++;
                              IF($ctrl == $max) { $x = $x1; $y = $y + 40; $ctrl = 0; }
                              ELSE {   }
                              $x = $x + 40;


//                              text property("#image.dimensions", $tk);
// step;
                              makecoffee "$tk", 1/5, $x, $y;

                              }
*/
*Works ok on same-res images, tho.

Re: SC Command ::Make...

Posted: 11 Apr 2014 18:09
by admin
SkyFrontier wrote:Don, is it easy for you to confine different resolutions of images into a resolution for all thumbs?
Explain a little more, please.

Re: SC Command ::Make...

Posted: 11 Apr 2014 18:18
by SkyFrontier
If different resolution images are selected as source for my script and I apply '1/10' to all of them, the generated thumbs will not have a common resolution under which each thumb is displayed.

So a fixed resolution, user defined, could be supported as stretchfactor (BESIDES current method, not replacing it! - it´s good as it is for specifc purposes).

Re: SC Command ::Make...

Posted: 11 Apr 2014 18:43
by admin
Okay, got it.

I'm currently working on the next killa featua. I might be able to squeeze yours in... :ninja:

Re: SC Command ::Make...

Posted: 12 Apr 2014 12:06
by admin
This column will show a preview pic below the name for 2 seconds on click:

Code: Select all

Snip: CustomColumn 1
  XYplorer 13.90.0107, 12.04.2014 12:05:31
Action
  ConfigureColumn
Caption
  Preview
Type
  3
Definition
  // 20140412: on click: show a preview pic below the name for 2 seconds
    $file = <cc_item>;
    $row = row($file);
    $column = "name";
    $x = cell($row, $column, "x");
    $y = cell($row, $column, "b");
    makecoffee $file, $x, $y, 200, 200;
    wait 2000; makecoffee "";
Format
  0
Trigger
  2
Item Type
  0
Item Filter
  jpg;png;gif
Note that in the current beta v13.90.0107 there is still a bug where the Click column is completely generated after you select it into a new column (you will get a slideshow :) ). Fix comes.

Re: SC Command ::Make...

Posted: 12 Apr 2014 12:46
by PeterH
Maybe the "show a picture" - functionality of makecoffe will most be used to show a picture? So the command maybe should be renamed to something like "showpicture" before too much scripts exist with makecoffe?

And is it possible to add a display-time as a new operand (instead of having to code Wait to delete it)?

Re: SC Command ::Make...

Posted: 12 Apr 2014 12:53
by Marco
PeterH wrote:So the command maybe should be renamed to something like "showpicture" before too much scripts exist with makecoffe?
Well, maybe "showpicture" could be added as an alias to makecoffee, much like rtfm for help.

Re: SC Command ::Make...

Posted: 12 Apr 2014 14:06
by admin
Well, this still has easteregg status for me.