SC Command ::Make...

Features wanted...
admin
Site Admin
Posts: 50429
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: SC Command ::Make...

Post by admin »

1) will document
2) will fix
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

admin
Site Admin
Posts: 50429
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: SC Command ::Make...

Post 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;
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

klownboy
Posts: 3121
Joined: 28 Feb 2012 19:27

Re: SC Command ::Make...

Post 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 ""}

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

Re: SC Command ::Make...

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

admin
Site Admin
Posts: 50429
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: SC Command ::Make...

Post 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")
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

klownboy
Posts: 3121
Joined: 28 Feb 2012 19:27

Re: SC Command ::Make...

Post 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

admin
Site Admin
Posts: 50429
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: SC Command ::Make...

Post by admin »

Wow, cool idea. :appl:
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: SC Command ::Make...

Post 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.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 50429
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: SC Command ::Make...

Post 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.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: SC Command ::Make...

Post 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).
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 50429
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: SC Command ::Make...

Post by admin »

Okay, got it.

I'm currently working on the next killa featua. I might be able to squeeze yours in... :ninja:
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

admin
Site Admin
Posts: 50429
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: SC Command ::Make...

Post 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.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

PeterH
Posts: 2598
Joined: 21 Nov 2005 20:39
Location: Germany

Re: SC Command ::Make...

Post 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)?
W7(x64) SP1 German
( +WXP SP3 )

Marco
Posts: 2306
Joined: 27 Jun 2011 15:20

Re: SC Command ::Make...

Post 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.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

admin
Site Admin
Posts: 50429
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: SC Command ::Make...

Post by admin »

Well, this still has easteregg status for me.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

Post Reply