Need help with script/macro

Larry56
Posts: 517
Joined: 05 Jul 10 5:57

Need help with script/macro

Post by Larry56 »

I've been looking at various scripts and macros in order to write my own but but I can't figure some things out and can't find any documentation to help me. Yes, I found the Macro help file but it still left questions.

To start with I'd like one that would display in a custom thumb whether the file is RAW or JPG. If RAW, display "RAW" in cyan and if JPG display "JPG" in yellow. I found an old macro to simply display "RAW" or "NOT RAW" based on %code result := iif(ImageItem.IsRAW, 'RAW','NOT RAW'); %/code but I can't figure out how to modify to display in selected color bases on results.

Can anyone give me some pointers?
Hert
Posts: 7870
Joined: 13 Sep 03 6:24

Re: Need help with script/macro

Post by Hert »

%FileExtension should do it. No need for scripting. Select it from the drop down.
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
Preston B
Posts: 216
Joined: 24 Feb 10 18:01
Location: Columbia, CA

Re: Need help with script/macro

Post by Preston B »

Larry, I use a custom thumb line that shows the following...

File Extension, File Size, Pixel Dimensions.

The file extension is 'white' text. The other two items are 'yellow' text.

Code: Select all

<font family="arial" size="12">%FileExtension{uppercase=y}</font><font family="arial" color="#80FFFF00">%ImageFileSizeShort  %ImageDimension px</font>
Unfortunately, I do not know how to change the file extension color conditionally, but this little bit of code may be useful for you.
--P
Preston Birdwell
Columbia, CA

Photo Supreme on Puget Systems Obsidian: Win 10-64 bit Intel i5Quad Core 3.3Ghz 32GB RAM, and Puget Systems Traverse Laptop. Chamonix 4x5 and Nikon D-7100.

Please visit my web site at www.gildedmoon.com
Larry56
Posts: 517
Joined: 05 Jul 10 5:57

Re: Need help with script/macro

Post by Larry56 »

Since my main goal was to highlight RAW files by having a different color I ended up with this:
<font color="cyan">%code result := iif(ImageItem.IsRAW, 'RAW', ''); %/code</font>
Since it won't display anything unless it's a RAW file I put at the end of a line otherwise there's an indention of the text line.

Originally I thought it would be nice to have different color based on RAW or not RAW indicator but my single colored "RAW" works for my purposes.

Thanks for the suggestions.
jgodfrey
moderator
Posts: 601
Joined: 17 Dec 05 4:03
Location: Missouri (USA)

Re: Need help with script/macro

Post by jgodfrey »

I think something like this should get you close to the original request...

Code: Select all

%code result := iif(ImageItem.IsRAW, '<font color="cyan">RAW</font>', '<font color="yellow">JPG</font>'); %/code
Larry56
Posts: 517
Joined: 05 Jul 10 5:57

Re: Need help with script/macro

Post by Larry56 »

Thank you jgodfrey. I'd tried several ways but never thought about your code. Thanks for posting.
Stephen
Posts: 676
Joined: 01 Oct 14 9:15

Re: Need help with script/macro

Post by Stephen »

These are professional coders :-)
A good idea to colour code the files in this way. I just hope that I can find this tip when I need it.
Never say never change, but using Mac since 2005. Photo Supreme 3.3.0.2605. I endorse the interoperability of files between applications and systems.
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Need help with script/macro

Post by weidmic »

hahaha, why don't you create a text file and paste those snipped in with some notes ;)
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
jtk
Posts: 49
Joined: 21 Feb 18 16:57
Location: Germany

Re: Need help with script/macro

Post by jtk »

hahaha, why we don't have a FAQ where to paste those tipps?

Edit:
I suggested the FAQ-idea in Mantis under "0003226: Creation of a FAQ", maybe people with the same interest can push this.
Photo Supreme beginner, former Aperture User
MacBook Pro with macOS BigSur
Hert
Posts: 7870
Joined: 13 Sep 03 6:24

Re: Need help with script/macro

Post by Hert »

This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Need help with script/macro

Post by weidmic »

I do like the idea of an FAQ better. I remember we had a Wiki, but that was very complicated to maintain. Not sure if it still exists.
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
snowman1
Posts: 394
Joined: 01 Jan 07 2:13

Re: Need help with script/macro

Post by snowman1 »

You can always bookmark this thread by clicking on the spanner icon at the foot of the page and clicking "bookmark topic".
Hert
Posts: 7870
Joined: 13 Sep 03 6:24

Re: Need help with script/macro

Post by Hert »

I still recommend to submit this to the repository. Why? Because in 4.1 it then appears in Photo Supreme when clicking the custom thumb info line’s drop down, right there where you’d use it :)
This is a user-to-user forum. If you have suggestions, requests or need support then please send a message
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Need help with script/macro

Post by weidmic »

aaaah! Well...
Then it makes sense :)

I will submit mine too
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
weidmic
moderator
Posts: 861
Joined: 04 Dec 06 21:21

Re: Need help with script/macro

Post by weidmic »

I assume, the resource file is in this case of a custum thumb script a regular txt file?
PSUServer 2024.x, PostgreSQL 12.x
My homepage http://www.michaelweidner.com
Post Reply