• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Code referenced by variable runs but variable undefined
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code referenced by variable runs but variable undefined


  • Subject: Re: Code referenced by variable runs but variable undefined
  • From: polibek <email@hidden>
  • Date: Sat, 8 Jul 2006 14:13:51 -0500

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.



On Jul 8, 2006, at 1:23 PM, Yvan KOENIG wrote:


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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Code referenced by variable runs but variable undefined
      • From: Yvan KOENIG <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>)

  • Prev by Date: Re: Intel gets bad height and width
  • Next by Date: Indesign layer stacking method? / is there a over 31 characters file path handler? / up one folder command?
  • Previous by thread: Re: Code referenced by variable runs but variable undefined
  • Next by thread: Re: Code referenced by variable runs but variable undefined
  • Index(es):
    • Date
    • Thread