Need help with script/macro

Larry56
Posts: 371
Joined: 05 Jul 10 6:57

Need help with script/macro

Post by Larry56 » 31 Mar 18 0:13

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: 20940
Joined: 13 Sep 03 7:24

Re: Need help with script/macro

Post by Hert » 31 Mar 18 9:21

%FileExtension should do it. No need for scripting. Select it from the drop down.
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

Preston B
Posts: 400
Joined: 24 Feb 10 19:01
Location: Columbia, CA

Re: Need help with script/macro

Post by Preston B » 31 Mar 18 16:56

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: 371
Joined: 05 Jul 10 6:57

Re: Need help with script/macro

Post by Larry56 » 02 Apr 18 17:33

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: 5372
Joined: 17 Dec 05 5:03
Location: Warrensburg, MO (USA)

Re: Need help with script/macro

Post by jgodfrey » 08 Apr 18 22:06

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: 371
Joined: 05 Jul 10 6:57

Re: Need help with script/macro

Post by Larry56 » 10 Apr 18 4:20

Thank you jgodfrey. I'd tried several ways but never thought about your code. Thanks for posting.

Stephen
Posts: 553
Joined: 01 Oct 14 10:15

Re: Need help with script/macro

Post by Stephen » 10 Apr 18 4:34

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: 4419
Joined: 04 Dec 06 22:21

Re: Need help with script/macro

Post by weidmic » 10 Apr 18 17:56

hahaha, why don't you create a text file and paste those snipped in with some notes ;)
PSUServer 4.x, PostgreSQL 10.x
My homepage http://www.michaelweidner.com
PSU Tips and Tricks http://www.michaelweidner.com/WP/psu/

jtk
Posts: 30
Joined: 21 Feb 18 17:57

Re: Need help with script/macro

Post by jtk » 10 Apr 18 18:19

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 High Sierra

Hert
Posts: 20940
Joined: 13 Sep 03 7:24

Re: Need help with script/macro

Post by Hert » 10 Apr 18 18:46

This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

weidmic
moderator
Posts: 4419
Joined: 04 Dec 06 22:21

Re: Need help with script/macro

Post by weidmic » 10 Apr 18 21:49

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 4.x, PostgreSQL 10.x
My homepage http://www.michaelweidner.com
PSU Tips and Tricks http://www.michaelweidner.com/WP/psu/

User avatar
snowman1
Posts: 329
Joined: 01 Jan 07 3:13
Location: UK

Re: Need help with script/macro

Post by snowman1 » 10 Apr 18 22:23

You can always bookmark this thread by clicking on the spanner icon at the foot of the page and clicking "bookmark topic".
Snowman1
http://www.flickr.com/photos/snowman-1/
--------------------------------------

Hert
Posts: 20940
Joined: 13 Sep 03 7:24

Re: Need help with script/macro

Post by Hert » 11 Apr 18 4:37

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 which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

weidmic
moderator
Posts: 4419
Joined: 04 Dec 06 22:21

Re: Need help with script/macro

Post by weidmic » 11 Apr 18 5:37

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

I will submit mine too
PSUServer 4.x, PostgreSQL 10.x
My homepage http://www.michaelweidner.com
PSU Tips and Tricks http://www.michaelweidner.com/WP/psu/

weidmic
moderator
Posts: 4419
Joined: 04 Dec 06 22:21

Re: Need help with script/macro

Post by weidmic » 11 Apr 18 6:42

I assume, the resource file is in this case of a custum thumb script a regular txt file?
PSUServer 4.x, PostgreSQL 10.x
My homepage http://www.michaelweidner.com
PSU Tips and Tricks http://www.michaelweidner.com/WP/psu/

Post Reply