• 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
Code referenced by variable runs but variable undefined
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code referenced by variable runs but variable undefined


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

I'm having a problem  with an applescript that is exiting with a "variable ... is not defined" message. 

Two variables  are included in a top level "global" statement and are "set" in a handler. The handler is called from within a "tell" block and the code in the first variable runs. Then code in the second variable runs but after it has run the script exits complaining that the second variable is undefined. Besides wanting to fix this I would like to understand what is different between the two variables (ie why the first is defined and the second isn't). And also why the code in the second variable runs and then the script complains about it being undefined. It seems like the code wouldn't be run at all if the variable referencing it were undefined.

Here's the handler. imgGT1000 is the variable that works, imgHalfSize is the one that is "undefined". I've been testing with a horizontal
image (2106 pixels wide) so the "else" section is the one that runs.

    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
    end imgResize


The handler call and the variables are used in a photoshop tell block and occur in this order:

  

         my imgResize()
         repeat while imgGT1000
  imgHalfSize

    


The end of the "Event Log" shows that the image is resized  then variable imgHalfSize is found
to be undefined:
         resize image current document width 1053.0
current application
"The variable imgHalfSize is not defined."
 _______________________________________________
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: Emmanuel <email@hidden>
    • Re: Code referenced by variable runs but variable undefined
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: Date manipulation
  • Next by Date: Re: Date manipulation
  • Previous by thread: Re: Date manipulation
  • Next by thread: Re: Code referenced by variable runs but variable undefined
  • Index(es):
    • Date
    • Thread