Hello-
Posted a few times before, still attempting to fully automate the creation of overhead transparenices. This script is adapted from several sources - thanks to all who have helped so far.
The task is to grab a folder full of images, place them, and then surround them with appropriate text boxes. The below works pretty well, but I have some questions about how to implement some further improvements…
- If the graphic inserted is wider than it is tall, I would like for it to be rotated 270 degrees before it is expanded to fill up the image box. If it’s not too complicated, I would like for the orientation of some of the text boves to change if this is the case.
- I would like the “Graphic Title” text box to suck diagram titles from a list in excel (or even a plain text file). These would be ordered to correlate one to one with the images.
- I don’t think I quite understand how content for the various text boxes should be metted out. The copyright info is ending up in the “Title” box.
- I would like the “Transparency #” to increase sequentially with each new slide.
tell application "QuarkXPress"
activate
set thepath to (choose folder with prompt "Choose Folders") as text
set ItemList to list folder thepath without invisibles
set fileList to {}
tell default document 1
set page height to "215.9 mm"
set page width to "279.4 mm"
set left margin to "12.7 mm"
set right margin to "12.7 mm"
set top margin to "12.7 mm"
set bottom margin to "12.7 mm"
set automatic text box to false
set guides showing to true
set guides in front to true
set horizontal measure to millimeters
set vertical measure to millimeters
end tell
make document at beginning
tell document 1
set bounds to {22, 50, 1150, 200}
set view scale to 35
end tell
-- Insert figure/table
tell spread 1 of master document 1
make picture box at beginning with properties ¬
{bounds:{"34.445 mm", "12.7 mm", "194.263 mm", "266.7 mm"}, color:"None"}
end tell
-- Graphic Title
tell spread 1 of master document 1
make text box at beginning with properties ¬
{bounds:{"19.638 mm", "12.7 mm", "32.691 mm", "266.7 mm"}}
tell text box 1
set color to "none"
end tell
tell story 1 of text box 1
set contents of it to (item 1 of ItemList) as text
set size to 14
set leading to 20
set justification to centered
end tell
end tell
-- Graphic Title small
tell spread 1 of master document 1
make text box at beginning with properties ¬
{bounds:{"196.027 mm", "138.289 mm", "209.55 mm", "266.7 mm"}}
tell text box 2
set color to "none"
end tell
end tell
-- Copyright
tell spread 1 of master document 1
make text box at beginning with properties ¬
{bounds:{"196.027 mm", "12.7 mm", "209.55 mm", "120.65 mm"}}
tell text box 3
set color to "none"
end tell
tell story 1 of text box 3
set contents of it to ("Copyright © Houghton Mifflin Company. All rights reserved.") as text
set size to 14
set leading to 20
set justification to centered
end tell
end tell
-- Transparency #
tell spread 1 of master document 1
make text box at beginning with properties ¬
{bounds:{"161.807 mm", "266.7 mm", "205.551 mm", "274.461 mm"}}
tell text box 4
set color to "none"
end tell
end tell
set ThisItem to item 1 of ItemList
try
tell page 1 of document 1
set image 1 of picture box 1 to alias (thepath & (ThisItem))
set bounds of image 1 of picture box 1 to proportional fit
end tell
on error
beep
end try
repeat with x from 2 to count of ItemList
set ThisItem to item x of ItemList
tell document 1
make new page at end
set page x to current page
try
set image 1 of picture box x to alias (thepath & (ThisItem))
set bounds of image 1 of picture box x to proportional fit
tell story 1 of text box 1 of page x
set contents of it to (item x of ItemList) as text
end tell
on error
beep
end try
end tell
end repeat
set guides showing of document 1 to true
end tell
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060214 Camino/1.0
Operating System: Mac OS X (10.3.9)