Change Values within Layers of Symbol based on Symbol Display Name 01, 02,

Looking for a way to reference and change the numerical values on the fly within the layers of a symbol based on the display name/number of a symbol in Hype.

Example: If there are 10 identical symbols (via copy) in the resources within each and every one of them there are layers such as below where 'XX' would be the number the change would occur based on the name of the symbol number.

[[{DESC_XX}]] for description
[[{PRICE_XX}]] for price
[[{SAVING_XX}]] savings amount
[[{RATING_XX}]] stars rating
[[{THUMB_XX}]] thumbnail display name
[[{ORIGPRICE_XX}]] original price

Would appreciate the help and can make a contribution/donation... for the time it takes to do this small but significant script task of renaming on the fly.

probably an example would help.

The

May help..

Sure
Example.zip (107.7 KB)

Where are the Prices description ect. coming from

I just need to change the value from XX to corresponding symbol numerical value.

Ok Think pretty easy to do.

The Symbol Overide Extension can probably do this by using its callback and you only would need one single symbol.

But will work with yours.

1 Like

Please provide an example based on example provided.

Would I do different.. :wink:

:stuck_out_tongue_winking_eye: just making sure

You can also use HypeDataMagic or HypeDataDecorator, but they can be more difficult for first usage.

Cool, would love to see both and pick the one that works best

As I just saw that Mark is already on the case and preparing an example if you are interested in the other approaches maybe look them up they are plenty of code examples on the forum. The solution from Mark is pretty cool and doesn’t have the overhead trying to do a live preview also it has been featured on YouTube by Tumult. Written on the road on phone.

@MarkHunte I wonder if I export the html would it still be renamed to appropriate values 01, 02, 03,... or do I need something like a Python export script to do this?

Here you go,

The symbols each have a class name the code searches for and each element inside the symbol that needs change is given the class name symTagged

Example_MHv1.hype.zip (109.6 KB)

I have kept it as simple as possible.

2 Likes

Yes if possible, you would need to do that with an export script.

It actually does export with the change made I see the small script you did which is perfect in this instance i just want to verify the images [[{THUMB_ XX }]] and [[{RATING_ XX }] are changed?

Sorry misunderstood ,

Thought you meant export as a static export without the code.

The export will naturally include the code as it is a Hype function and not a head function so will run on the exported doc when brought up in the browser regardless of if you use the exported html or not.

Any element you want changed inside the symbol must have the class name symTagged added

2 Likes

That did it, thank you! Exactly what I needed. Much appreciated would like to make a contribution for your efforts that is if your interested, will dm you shortly.

2 Likes