Le 8 juil. 2006, à 19:08, polibek a écrit :
Thanks for the reply Yvan. I tried your suggested changes but they didn't fix the problem; didn't make it worse either- the script ran and exited at the same point.
On Jul 8, 2006, at 11:20 AM, Yvan KOENIG wrote
In your original code,the "local variable" imgHalfSize is seen in the handler mut not outside.
I was thinking it was something like this but I can't understand why one variable is seen outside the handler and the other isn't. Also, if the problem variable isn't
seen outside the handler how is it that the code it references gets executed? I thought explicitly declaring the variables global would cause them to be seen in all scopes and
that seemed to work for imgGT1000 but not for imgHalfSize.
Hello
It's my fault, I forgot to return two values.
on imgResize()
tell application "Adobe Photoshop CS"
if (docHeight > docWidth) then
set imgGT1000 to ((docHeight > 1000))
set imgHalfSize to resize image current document height (docHeight * 0.5)
else
set imgGT1000 to ((docWidth > 1000))
set imgHalfSize to resize image current document width (docWidth * 0.5)
end if
end tell
return {imgHalfSize, imgGT1000}
end imgResize
set {imgHalfSize, imgGT1000} to my imgResize()
repeat while imgGT1000
imgHalfSize
Now I'm quite sure that it will be OK. I can't check because I don't own Photoshop.
Yvan KOENIG