• Global community
• Language:
• Deutsch
• English
• EspaĆ±ol
• FranĆ§ais
• PortuguĆŖs
• ę„ę¬čŖć³ćć„ććć£
Dedicated community for Japanese speakers
• ķźµ­ ģ»¤ė®¤ėķ°
Dedicated community for Korean speakers
• Can I do math in a photoshop script?

# Can I do math in a photoshop script?

Explorer ,
Jan 12, 2023 Jan 12, 2023

Copied

I want to compute some object components based on a "prompt" input.

Thanks

TOPICS
Actions and scripting

Views

108

Likes

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 Expert , Jan 12, 2023 Jan 12, 2023

Some references to common JS math methods:

https://www.w3schools.com/js/js_math.asp

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math

Two things to keep in mind:

1) Adobe ExtendScript does not support "modern" features

2) Digits entered into a prompt are returned as a string, not a number:

``````var input = prompt("enter a number", "2");

However, in practice, JS often deals with this gracefully:

``var input = prom``
...

Likes

Community Expert ,
Jan 12, 2023 Jan 12, 2023

Copied

LATEST

Some references to common JS math methods:

https://www.w3schools.com/js/js_math.asp

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math

Two things to keep in mind:

1) Adobe ExtendScript does not support "modern" features

2) Digits entered into a prompt are returned as a string, not a number:

``````var input = prompt("enter a number", "2");

However, in practice, JS often deals with this gracefully:

``````var input = prompt("enter a number", "2");
var result = input * 2;

Hope this helps.

Likes

Report

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