Code for menu design

Engaged ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

 

Greetings to all of you
I am currently working on the menu design
I'm having trouble typing the item and entering the description
I want an icon that marks the main element in the font size.. and describes the element in a smaller font size based on an input number of the font size
I attached an example to illustrate the idea to be implemented

 

Before and after.jpg

TOPICS
Actions and scripting

Views

74

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

If I understand correctly, it sounds like you might want to set up some Paragraph Styles:

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

@Myra Ferguson 

Thank you for the reply
But I'm working on many paragraphs and it's hard for me to do it manually..
There is a script that does this but I don't know how to do it

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 01, 2022 Aug 01, 2022

Copy link to clipboard

Copied

No, this is why you use paragraph styles. This would also be easier in Illustrator or InDesign.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

There was an post before that coloring the lines

https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-color-the-elements-texts-and-s... 

first line in color
The second line is a different color
I want this code to change the font size of fonts in a sequential manner
I just want to modify the code
Change the font size of the fonts instead of changing the color

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

TextItem.font is what you need to use.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

yes , i want to change font size same way change text color

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

@Mohamed Hameed 

 

As others have said, this is easier in InDesign. Here are the general steps:

  • Create a paragraph style for each: "Items" and "Descriptions"
  • In the paragraph style for "Items", set the Next Style to be Descriptions
  • Select all relevant text
  • In the Paragraph Styles panel, right-click the "Items" style and from the context sensitive menu, select “Apply Items then next style” 

Details here:

https://creativepro.com/where-is-apply-__-then-next-style/

 

Photoshop is a fantastic image editor, but it was never made for text heavy documents and it only has a fraction of the type controls that InDesign has.

 

PRO TIP: If you are going to put a dash in front of the text, do not use a hyphen. Learn about the three types of dashes and their proper usage:

https://grammar.yourdictionary.com/punctuation/3-types-of-dashes-and-correct-usage-in-writing.html

 

Jane

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

I know this and I know Design does it because it's a script and it's very good at professional magazine and book production and text handling.
But I couldn't work on it

In general, thanks for your interest

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
2 hours ago 2 hours ago

Copy link to clipboard

Copied

LATEST

I modified this code but it didn't work for me..I don't know where the problem is
Is there anyone who can solve this problem for me, I will be very grateful

 

var newColors = ['ff0000', '1200ff', '0f9505', 'c44500'],
var size=['50', '20'],

     s2t = stringIDToTypeID;
 (r = new ActionReference()).putProperty(s2t('property'), p = s2t('textKey'));
 r.putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
 if (executeActionGet(r).hasKey(p)) {
     var textKey = executeActionGet(r).getObjectValue(p),
         sList = textKey.getList(s2t('textStyleRange')),
         l = new ActionList(),
         styleSheet = [],
         lines = textKey.getString(s2t('textKey')).split('\r');
     for (var i = 0; i < sList.count; i++) {
         styleSheet.push({
             from: sList.getObjectValue(i).getInteger(s2t('from')),
             to: sList.getObjectValue(i).getInteger(s2t('to')),
             style: sList.getObjectValue(i).getObjectValue(s2t('textStyle'))
         })
     };
     var from = 0;
     var Size=30;
     for (var i = 0; i < lines.length; i++) {
         var to = from + lines[i].length + 1,
            cur = function (s, idx) { for (var i = 0; i < s.length; i++) if (s[i].from <= idx && s[i].to > idx) return s[i].style }(styleSheet, from),
             color = function (h) { var c = new SolidColor; c.rgb.hexValue = h; newColors.push(h); return c }(newColors.shift());

 var d = new ActionDescriptor();
         var d3 = new ActionDescriptor();
               
         
         with (color.rgb) {
             d.putDouble(s2t('red'), red)
             d.putDouble(s2t('green'), green)
             d.putDouble(s2t('blue'), blue)
             d3.putUnitDouble(s2t('size'), s2t('pointsUnit'), size)
             cur.putObject(s2t('color'), s2t('RGBColor'), d)
             cur.putObject(s2t('textStyle'), s2t('textStyle'), d3)
         }
         d = new ActionDescriptor();
         d.putObject(s2t('textStyle'), s2t('textStyle'), cur)
         d3.putObject(s2t('textStyle'), s2t('textStyle'),  cur)
         d.putInteger(s2t('from'), from) ; d3.putInteger(s2t('from'), from)
         d.putInteger(s2t('to'), to) ; d3.putInteger(s2t('to'), to)
         l.putObject(s2t('textStyleRange'), d) ; l.putObject(s2t('textStyleRange'), d3)
         from = to
     }
     textKey.putList(s2t('textStyleRange'), l);
     (r = new ActionReference()).putEnumerated(s2t('layer'), s2t('ordinal'), s2t('targetEnum'));
     (d = new ActionDescriptor()).putReference(s2t('target'), r);(d3 = new ActionDescriptor()).putReference(s2t('target'), r)
     d.putObject(s2t('to'), s2t('textLayer'), textKey); d3.putObject(s2t('to'), s2t('textLayer'), textKey);
     executeAction(s2t('set'), d, DialogModes.NO);executeAction(s2t('set'), d3, DialogModes.NO);
 }

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines