🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.photoshop.scripting
Article #101

Re: ResizeImage using dimensions read from text file

#101
From: try67
Date: Tue, 10 Mar 2009 16:51
8 lines
1231 bytes
The text read from from the file is what's known as a String, meaning it's a piece of text, not a Number.
Luckily for you, JavaScript is very lenient and allows conversion (casting) from one type to another quite easily. One way of converting a string into a number is by multiplying it with 1. For example:

var test = "123"; // This is a string
var test1 = 123; // This is a number
var test2 = (test*1)+1; // This will be a number

test2 will now be 124. HOWEVER, if 'test' was equal to something that can not be converted to a number (like "123a"), test2 will be equal to NaN (Not a Number), so you should be a bit careful.
Technical Details
Message-ID: <59b82c0d.3@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
References: <59b82c0d.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,4e7306c2b43f139b
X-Google-Attributes: gidf5839,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: try67 <try6767@gmail.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.photoshop.scripting
Subject: Re: ResizeImage using dimensions read from text file
Message-ID: <59b82c0d.3@webcrossing.la2eafNXanI>
Date: Tue, 10 Mar 2009 09:51:59 -0700
References: <59b82c0d.-1@webcrossing.la2eafNXanI>
Lines: 13
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit