• 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
QXP Experts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

QXP Experts


  • Subject: QXP Experts
  • From: Scott Lewis <email@hidden>
  • Date: Thu, 27 Feb 2003 08:44:06 -0400

Is there a command in QXP to center images in picture box via AppleScript?
Here is how I am currently doing this: (of course this is within the proper
tell QXP and tell page and tell picture box blocks).

Note: theWidth and theHeight are extracted from the images comment which
Photoshop adds when saving the image file.

set image 1 to alias loResFile
set the bounds of image 1 to exact fit
set imageScaleList to {}
set imageScaleList to the scale of image 1 as list
set vScale to item 1 of imageScaleList as string
set charCount to ((count of characters of vScale) - 1)
set vScale to characters 1 thru charCount of vScale as string
set vScale to vScale as real
set vScale to round (vScale) rounding up
set hScale to item 2 of imageScaleList as string
set imageScaleList to {}
set charCount to ((count of characters of hScale) - 1)
set hScale to characters 1 thru charCount of hScale as string
set hScale to hScale as real
set hScale to round (hScale) rounding up
if vScale > hScale then
set imageScale to vScale
else
set imageScale to hScale
end if
set newScale to {}
set the end of newScale to imageScale
set the end of newScale to imageScale
tell image 1
set scale to newScale
end tell
set newScale to {}
set scalePercent to imageScale / 100
set qWidth to theWidth * scalePercent
set qWidth to qWidth - 5.375
set xOffset to qWidth / 2
set xOffset to 0 - xOffset
set qHeight to theHeight * scalePercent
set qHeight to qHeight - 7.25
set yOffset to qHeight / 2
set yOffset to 0 - yOffset
set imgOffset to {yOffset, xOffset}
set the offset of image 1 to imgOffset
set imgOffset to {}

My code is really long and I am hoping there is a quicker way to do this. If
not, this works but I thought I could trim some fat if there is.


Scott Lewis
email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: QXP Experts
      • From: Hans Haesler <email@hidden>
  • Prev by Date: Re: more power
  • Next by Date: Re: QXP Experts
  • Previous by thread: Re: more power
  • Next by thread: Re: QXP Experts
  • Index(es):
    • Date
    • Thread