Copy link to clipboard
Copied
I'm currently working on a script to automatically export my working files as a scaled down jpeg.
I want to be able to run the script, type in the percentage to be scaled down to and then have the script handle the rest.
I have most of the script working fine...... the only piece that I'm struggling with is getting it to parse the number I enter in the prompt box and use it as the percentage value to be scaled down to.
here are the relevant lines of code in my script.
app.preferences.rulerUnits = Units.PERCENT;
var Blah = prompt("percentage", "50");
newdoc.resizeImage(Blah, null, 300, ResampleMethod.BICUBICAUTOMATIC);
I can't figure out how to get it to use the number I type into the prompt box (var Blah) as the percentage to resize it.
if I type the number in here like this for example,
newdoc.resizeImage(88, null, 300, ResampleMethod.BICUBICAUTOMATIC);
as a number 88. I get expected results. it resizes my image to 88%
but if I typed 88 (or anything for that matter) in my "percentage" prompt box and try to use Blah as the first argument it just ends up resizing to 1px x 1px, no matter what I type.
Am I missing something here? I'm really at a loss, any help would be greatly appreciated!
Try...
newdoc.resizeImage(Number(Blah), null, 300, ResampleMethod.BICUBICAUTOMATIC);
This will convert a string to a number.
Copy link to clipboard
Copied
Try...
newdoc.resizeImage(Number(Blah), null, 300, ResampleMethod.BICUBICAUTOMATIC);
This will convert a string to a number.
Copy link to clipboard
Copied
Thanks SuperMerlin, that's all I needed!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now