Formating Variables

Started by sinus, September 02, 2014, 12:17:21 PM

Previous topic - Next topic

sinus

Hello,
I am trying to format some variables in the File Window, so that under or above each thumb displays some interesting text.
The help-file give us a lot of informations and I am impressed, how much we can do with variables and formating.

But I want achieve this goal:
The extension of each file should have, depending on the value, different colors, for example
NEF
JPG
TXT
INDD

This example from the help-file give us a good result:

<Run FontSize='10pt' Background='AliceBlue' Foreground='#000000'>{File.Ext}</Run>
The extenstion of a file in 10 points, on a blue background and in black letters.

And this here also is fine:
{File.Ext|is:nef,NEF,?}
This displays a NEF and if the extenstion has not a nef-Extension, then a ?

I have tried different things, but was not able to do so.

If it is too complicated (because it gives a lot of extensions), it would help, if I could say, make the most common image-extensions (nef,crw,jpg,psd,tif) in one color and all other (txt,doc,indd...) in another color.


Thanks for any ideas.
Best wishes from Switzerland! :-)
Markus

Mario

#1
That's quite easy, although may look messy when you do it for many formats. The general idea is (for NEF and JPG files in this case)

<Run Foreground='{File.Ext|is:NEF,#ff0000,}{File.Ext|is:JPG,#00ff00,}'>{File.Ext|to_upper}</Run>

Basically you open a Run

<Run Foreground='

then you set the color to use in the variables and the is: function

{File.Ext|is:NEF,Foreground='#ff0000',}
{File.Ext|is:JPG,Foreground='#00ff00',}

Note that you need to add an 'else' construction as the color variable, to catch all the extensions not explicitly in your list. Something like:

{File.Ext|contains:.,'#0000ff'}

because a file extension always contains a . and so this will always be true.

and close the first part of the run

'>

Now you add the file extension via variable (I used to_upper to force the display to upper case):

{File.Ext|to_upper}

and finally you close the Run:

</Run>
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Hi Mario

Phew, heavy ... and you call this "That's quite easy"  :o

That seems to be very good, your variable worked like a charm. Now I try to use it in a nice layout.

If this works fine, I will try something in the same kind for Attributes, means if a file has Attributes, a word or so would be under a thumb, if there are no entries, then something else would written there, and I think, also in different colors.

IF this works, and the speed does not too much suffering from this extra-calculations, then I would add these as near as possible to the thumb (last header or first footer), so that would mean for me having "a kind of icons for the poor man"  :) in addition to all native icons.

Because then a short view on a thumb is enough to see all relevant things (Collections, versions, write-back, Annotations, ratings, categories ... and with your formatted variables I can also see the format and if a file has Attributes or not.

BTW: the format is quite nice to see, because I have a lot of different files like nef, jpg, psd, indd, txt, doc, mp3 and so on and I have also long filenames.
It is easy to display the extension, but it helps me a lot, if I can create different colors, so I can see much quicker, if a thumb is a nef, a jpg or a mov (as an example).

Thank for your help!!!





Best wishes from Switzerland! :-)
Markus

Mario

#3
QuotePhew, heavy ... and you call this "That's quite easy"  :o

Yes. From a programmer's perspective. And from someone who has invented and implemented the variables for IMatch    

You can use images in your custom XAML markup, if you like. For example:



The syntax is:

<Image Source='file://c:\images\checkbox.png'/>

(Replace the file name with an icon name (PNG  preferred) of your liking. Don't forget the file:// in front.

As long as you make sure that the image can be found, and set the Size property for the header/footer to the size of the image (or a bit larger), IMatch can also show custom icons in the file window.

If you combine that with a "is:" or "hasvalue" you can show icons when the file has attributes. Or other metadata. Or whatever you need.

Geez. This stuff is cool and can do a lot  ::) :)

[attachment deleted by admin]
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

See also https://www.photools.com/community/index.php?topic=1459.msg8978#msg8978

This is what I use, and if it makes you feel any better, I find it heavy too:

<Run Foreground='{File.Ext|is:arw,#ff80ff,#FFFFFF,false}'>{File.Ext|is:arw,.ARW, ,false}</Run><Run Foreground='{File.Ext|is:avi,#999999,#FFFFFF,false}'>{File.Ext|is:avi,.AVI, ,false}</Run><Run Foreground='{File.Ext|is:crw,#ff8080,#FFFFFF,false}'>{File.Ext|is:crw,.CRW, ,false}</Run><Run Foreground='{File.Ext|is:dng,#999999,#FFFFFF,false}'>{File.Ext|is:dng,.DNG, ,false}</Run><Run Foreground='{File.Ext|is:jpg,#80ff80,#FFFFFF,false}'>{File.Ext|is:jpg,.JPG, ,false}</Run><Run Foreground='{File.Ext|is:nef,#800040,#FFFFFF,false}'>{File.Ext|is:nef,.NEF, ,false}</Run><Run Foreground='{File.Ext|is:pef,#999999,#FFFFFF,false}'>{File.Ext|is:pef,.PEF, ,false}</Run><Run Foreground='{File.Ext|is:psd,#808080,#FFFFFF,false}'>{File.Ext|is:psd,.PSD, ,false}</Run><Run Foreground='{File.Ext|is:raf,#808000,#FFFFFF,false}'>{File.Ext|is:raf,.RAF, ,false}</Run><Run Foreground='{File.Ext|is:tif,#80ffff,#FFFFFF,false}'>{File.Ext|is:tif,.TIFF, ,false}</Run>

sinus

Quote from: Mario on September 02, 2014, 03:37:48 PM
Geez. This stuff is cool and can do a lot  ::) :)
I have not thought, that even such things with icons are possible.

Boah, REALLY cool!!!


Since we can put almost all metadata and even single fields from the Attributes, this gives a lot of possibilites. On one view, because (if we not overload it) these informations or icons are under or over each thumb.

This is so important (for me), because I can see it almost, when I twinkle my eyes. Like the red sentence here, you will see it very quickly, and if you want know more, you can read the smaller sentences.
That is why I like icons or SHORT words!  8)

Thanks a lot for your help.
Best wishes from Switzerland! :-)
Markus

Richard

Quote from: Mario on September 02, 2014, 03:37:48 PM
Geez. This stuff is cool and can do a lot  ::) :)
No doubt about it, IMatch 5 is powerful and can do a lot of cool things.

Quote from: Ferdinand on September 02, 2014, 03:43:44 PM
This is what I use, and if it makes you feel any better, I find it heavy too:
Knowing that you find it heavy does not make me feel better at all. It makes me feel about as smart as a box of rocks and thankful that there are IMatch 5 users willing to invest the time to learn how to make use of the awesome power of IMatch 5 and point the way for others.

sinus

Quote from: Ferdinand on September 02, 2014, 03:43:44 PM
See also https://www.photools.com/community/index.php?topic=1459.msg8978#msg8978

This is what I use, and if it makes you feel any better, I find it heavy too:

Thank you, Ferdinand!
And yes, in contrary to Richard, I feel a little bit better   ;D
Best wishes from Switzerland! :-)
Markus

Mario

Quote from: Richard on September 02, 2014, 06:28:34 PM
Knowing that you find it heavy does not make me feel better at all. It makes me feel about as smart as a box of rocks and thankful that there are IMatch 5 users willing to invest the time to learn how to make use of the awesome power of IMatch 5 and point the way for others.

It thankfully looks a lot easier when you break it up:

<Run Foreground='{File.Ext|is:arw,#ff80ff,#FFFFFF,false}'>{File.Ext|is:arw,.ARW, ,false}</Run>
<Run Foreground='{File.Ext|is:avi,#999999,#FFFFFF,false}'>{File.Ext|is:avi,.AVI, ,false}</Run>
<Run Foreground='{File.Ext|is:crw,#ff8080,#FFFFFF,false}'>{File.Ext|is:crw,.CRW, ,false}</Run>
...

Just a <Run Foreground='color value'> for each file extension to control the color.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

Quote from: Richard on September 02, 2014, 06:28:34 PM
Quote from: Ferdinand on September 02, 2014, 03:43:44 PM
This is what I use, and if it makes you feel any better, I find it heavy too:
Knowing that you find it heavy does not make me feel better at all. It makes me feel about as smart as a box of rocks and thankful that there are IMatch 5 users willing to invest the time to learn how to make use of the awesome power of IMatch 5 and point the way for others.

Wasn't my intent, sorry.  I agree about the other users - this is one of those things that I would have struggled to work out myself.

mgm1965

I'm also doing some color formatting in my panel.
There is a table in the help file with the "name / value" of the colors that can be used?
I haven't found it.

So, I've found this: http://www.w3schools.com/html/html_colornames.asp

but a lot of color name here reported don't work.

Peraphs work only "The 17 standard colors are: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow."?

Thanks

Marco

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

#12
sorry folks, I opened another thread for this:

https://www.photools.com/community/index.php?topic=3298.msg21508#new

[attachment deleted by admin]
Best wishes from Switzerland! :-)
Markus

ColinIM

I've added what I hope will be a helpful 'Tip' on the FAQ, Workflow, Tutorials, Tips & Tricks board, about a free utility program which streamlines the job of choosing 'workable' colour combinations.

Choosing and assessing colour combinations throughout IMatch

I cross-referred to this post in my 'Tip' because the dialogue here nicely illustrates how much fun we can have with colours  :)

But it was the ironic frustration of having "too much choice" with the colours here which reminded me about that little program I'd first used around 2008 ... so I searched it out ... and I'm glad I did.

It's called a Colour Contrast Analyser and happily it's been updated a few times since 2008! Most recently in 2012.

Colin P.

sinus

Best wishes from Switzerland! :-)
Markus