Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code referenced by variable runs but variable undefined




Le 8 juil. 2006, à 21:13, polibek a écrit :

Yvan, thanks for the follow-up but adding both variables to the return statement didn't change anything (for better or worse). The script still executes the code referenced by imgHalfSize and then exits with "The variable imgHalfSize is not defined". 
Also,  the "Event Log" doesn't look any different after adding the lines "return {imgHalfSize, imgGT1000}" and "set {imgHalfSize, imgGT1000} to my imgResize()". I don't know if that is significant.

As I wrote, I am unable to test your code.

I tested a stripped version:

on imgResize()
	set imgGT1000 to ((1200 > 1000))
	set imgHalfSize to 2300
	return {imgHalfSize, imgGT1000}
end imgResize

(*
set {imgHalfSize, imgGT1000} to my imgResize()
-- repeat while imgGT1000
{imgHalfSize, imgGT1000}
*)

set imgGT1000 to true
set cnt to 5

repeat while imgGT1000
	beep 1
	set cnt to cnt - 1
	if cnt = 0 then exit repeat
end repeat

and it works so, it seems that the problem doesn't rely with the status of the variables.

Are you sure that the instructions coded in the handler are correct.

I wonder about this one:

  set imgHalfSize to resize image current document height (docHeight * 0.5)

You may try some error check for see:

on imgResize()

      tell application "Adobe Photoshop CS"
             if (docHeight > docWidth) then
                    set imgGT1000 to ((docHeight > 1000))
 try
 set imgHalfSize to resize image current document height (docHeight * 0.5)
on error
display dialog "Oops 1"
end try


                else
                        set imgGT1000 to ((docWidth > 1000))
try
 set imgHalfSize to resize image current document width (docWidth * 0.5)
on error
display dialog "Oops 2"
end try
              end if
       end tell

        return {imgHalfSize, imgGT1000}
end imgResize


set {imgHalfSize, imgGT1000} to my imgResize()  repeat while imgGT1000 imgHalfSize


Yvan KOENIG _______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Code referenced by variable runs but variable undefined (From: polibek <email@hidden>)
 >Re: Code referenced by variable runs but variable undefined (From: Yvan KOENIG <email@hidden>)
 >Re: Code referenced by variable runs but variable undefined (From: polibek <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.