Shapes are a fundamental iWork object and exist in all three iWork applications. In addition to inheriting the properties of iWork items, such as locked and opacity, shapes have the following shape-related properties:
The iWork Suite shape Class
shapen [inh. iWork item ] : A shape container.
elements
contained by iWork containers such as: slides.
properties
background fill type ( no fill / color fill / gradient fill / advanced gradient fill / image fill / advanced image fill, r/o ) : The background, if any, for the shape.
object text ( rich text ) : The text contained within the shape.
opacity ( integer ) : The percentage of opacity of the shape, from 0 (none) to 100 (full).
reflection showing ( boolean ) : Is the shape displaying a reflection?
reflection value ( integer ) : The percentage of reflection of the shape, from 0 (none) to 100 (full).
rotation ( integer ) : The rotation of the shape, in degrees from 0 to 359.
responds to
delete, exists.
IMPORTANT: The current scripting implementation of Keynote does not support the setting of the background fill type by a script. The value of this property can be accessed by a script, but not changed.
Script Examples
Here’s a simple script that creates a full-slide shape, on the current slide, using default fill, color, and borders:
Create Full-Slide Shape
01
tellapplication "Keynote"
02
activate
03
if not (existsdocument 1) then errornumber -128
04
tell the frontdocument
05
setdocumentWidthto itswidth
06
setdocumentHeightto itsheight
07
tell thecurrent slide
08
setthisShapeto ¬
09
makenewshapewith properties ¬
10
{position:{0, 0} ¬
11
, width:documentWidth ¬
12
, height:documentHeight ¬
13
, opacity:100}
14
end tell
15
end tell
16
end tell
Shapes can contain text. Here’s a script that creates a text-filled shape on the current slide:
Create Text Filled Shape
01
propertyplaceholderText : "Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a pharetra augue. Vestibulum id ligula porta felis euismod semper. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
02
03
Cras mattis consectetur purus sit amet fermentum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Maecenas sed diam eget risus varius blandit sit amet non magna. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.
04
05
Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh ultricies vehicula ut id elit."
06
07
tellapplication "Keynote"
08
activate
09
if not (existsdocument 1) then errornumber -128
10
tell the frontdocument
11
setdocumentWidthto itswidth
12
setdocumentHeightto itsheight
13
tell thecurrent slide
14
setshapeWidthto (documentWidth * 0.75)
15
setshapeHeightto (documentHeight * 0.75)
16
setshapeHorizontalto (documentWidth - shapeWidth) div 2
17
setshapeVerticalto (documentHeight - shapeHeight) div 2
Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. MACOSXAUTOMATION.COM assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. MACOSXAUTOMATION.COM provides this only as a convenience to our users. MACOSXAUTOMATION.COM has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and MACOSXAUTOMATION.COM assumes no responsibility in this regard. Please understand that a third-party site is independent from MACOSXAUTOMATION.COM and that MACOSXAUTOMATION.COM has no control over the content on that website. Please contact the vendor for additional information.