Math Confusion


i can't figure 1 out save life. document size 2592x3888. following code:

 

w=app.activedocument.width;
h=app.activedocument.height;

alert(1000-w);
alert(w-1000);
alert(1000-h);
alert(h-1000);

 

the alerts come out as

 

1592

1592

2888

2888

 

the first , third alerts should come out negative. don't. if change code w w/4 , h h/4, alerts follows:

 

-352

-352

-27.9999999999998

-27.9999999999998

 

not should first , third come out positive, last 2 should whole numbers.

 

what missing?

i think results depend on version of photoshop using , ruler unit settings.

 

if using cs4 , want w , h values in pixels this

 

w=app.activedocument.width.as('px');
h=app.activedocument.height.as('px');

alert(1000-w);
alert(w-1000);
alert(1000-h);
alert(h-1000)



More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO