Re: script QXP
Re: script QXP
- Subject: Re: script QXP
- From: Luca Pozzato <email@hidden>
- Date: Thu, 28 Dec 2000 19:08:19 +0100
hello Helmut
The reason why you are getting just "DUMMY.eps" images is because you talk
to "picture box 1" twice
tell picture box 1
try
set image 1 of picture box 1 to alias --remove "of picture box 1"
topImagePath
on error
set image 1 to alias (theEPSpath &
"DUMMY.eps")
end try
end tell
Regards
Luca Pozzato
>
From: Helmut Pfeiffer <email@hidden>
>
Date: Thu, 28 Dec 2000 17:19:41 +0100
>
To: <email@hidden>
>
Subject: Re: script QXP
>
>
Hello,
>
>
first - thank you very much for your kindly help. I tried to do my stuff
>
with the hints from Jason, but it doesn't work.
>
What I have to do are 16 QXP-documents with 32 eps-files (not 16 Pages on
>
one document). 16 pictures on 8 docs with an angle of 90, 16 with an angle
>
of -90 and the docs saved with a numbered name. But a look at the script is
>
perhaps better than my explains:
>
>
Here is my complete script:
>
>
on run
>
set topNum to 1 as integer
>
set bottomNum to 32 as integer
>
set epsBaseName to "Seite " as string
>
set theEPSpath to "AVNr.1:_test:test1:" as string
>
>
set topNumText to topNum as text
>
if (count of characters in topNumText) = 1 then
>
set topNumText to ("0" & topNumText) as string
>
end if
>
>
set bottomNumText to bottomNum as text
>
if (count of characters in bottomNumText) = 1 then
>
set bottomNumText to ("0" & bottomNumText) as string
>
end if
>
>
set topImagePath to (theEPSpath & epsBaseName & topNumText) as string
>
set bottomImagePath to (theEPSpath & epsBaseName & topNumText) as string
>
>
tell application "Finder"
>
activate
>
set the chosen_folder to (choose folder with prompt "test2")
>
set theDOCpath to chosen_folder as string
>
open the chosen_folder
>
set size of container window of chosen_folder to {230, 360}
>
set position of container window of chosen_folder to {920, 90}
>
set view of container window of chosen_folder to name
>
end tell
>
>
tell application "QuarkXPress"
>
activate
>
tell default document 1
>
set oldHeight to page height
>
set oldWidth to page width
>
set oldAutoTextBox to automatic text box
>
set oldGuidesShowing to guides showing
>
set xDocMeasure to horizontal measure
>
set yDocMeasure to vertical measure
>
set page height to "474 mm"
>
set page width to "324 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
>
>
repeat with n from 1 to 16 by 2
>
set x to 0 + n
>
>
tell application "QuarkXPress"
>
make document at beginning
>
tell document 1
>
set view scale to fit page in window
>
end tell
>
tell page 1 of document 1
>
make horizontal guide at end with properties
>
{position:"231 mm"}
>
make horizontal guide at end with properties
>
{position:"243 mm"}
>
tell page 1 of document 1
>
make picture box at beginning with properties
>
{bounds:{"0 mm", "0 mm", "231 mm", "324 mm"}, color:"wei_"}
>
tell picture box 1
>
try
>
set image 1 of picture box 1 to alias
>
topImagePath
>
on error
>
set image 1 to alias (theEPSpath &
>
"DUMMY.eps")
>
end try
>
end tell
>
tell image 1
>
set angle to 90
>
set bounds to exact fit
>
end tell
>
make picture box at end with properties
>
{bounds:{"243 mm", "0 mm", "474 mm", "324 mm"}, color:"wei_"}
>
tell picture box 2
>
try
>
set image 1 of picture box 2 to alias
>
bottomImagePath
>
on error
>
set image 1 to alias (theEPSpath &
>
"DUMMY.eps")
>
end try
>
end tell
>
tell image 2
>
set angle to 90
>
set bounds to exact fit
>
end tell
>
save document 1 in (theDOCpath & x & "tz0000TZ")
>
end tell
>
end tell
>
end tell
>
set topNum to (topNum + 1) as integer
>
set bottomNum to (bottomNum - 1) as integer
>
>
end repeat
>
>
repeat with n from 2 to 16 by 2
>
set x to 0 + n
>
>
tell application "QuarkXPress"
>
make document at beginning
>
tell document 1
>
set view scale to fit page in window
>
end tell
>
tell page 1 of document 1
>
make horizontal guide at end with properties
>
{position:"231 mm"}
>
make horizontal guide at end with properties
>
{position:"243 mm"}
>
tell page 1 of document 1
>
make picture box at beginning with properties
>
{bounds:{"0 mm", "0 mm", "231 mm", "324 mm"}, color:"wei_"}
>
tell picture box 1
>
try
>
set image 1 of picture box 1 to alias
>
topImagePath
>
on error
>
set image 1 to alias (theEPSpath &
>
"DUMMY.eps")
>
end try
>
end tell
>
tell image 1
>
set angle to -90
>
set bounds to exact fit
>
end tell
>
make picture box at end with properties
>
{bounds:{"243 mm", "0 mm", "474 mm", "324 mm"}, color:"wei_"}
>
tell picture box 2
>
try
>
set image 1 of picture box 2 to alias
>
bottomImagePath
>
on error
>
set image 1 to alias (theEPSpath &
>
"DUMMY.eps")
>
end try
>
end tell
>
tell image 2
>
set angle to -90
>
set bounds to exact fit
>
end tell
>
save document 1 in (theDOCpath & x & "tz0000TZ")
>
end tell
>
end tell
>
end tell
>
end repeat
>
end tell
>
>
end run
>
>
It works very fine - the docs are saved with the rihgt name but i get
>
allways the "DUMMY.eps" and not the eps-file i need.
>
>
Mit freundlichen Gruessen
>
>
Helmut Pfeiffer
>
Muenchener Zeitungs-Verlag
>
>
> Von: Jason Toews <email@hidden>
>
> Datum: Tue, 26 Dec 2000 12:06:42 -0800
>
> An: email@hidden, "'Helmut
>
> Pfeiffer'"<email@hidden>
>
> Betreff: RE: script QXP
>
>
>
> I just finished doing something really similar to this.
>
>
>
> First off - BEFORE you begin the repeat loop, set two variables, one for the
>
> number of the top photo, one for the bottom:
>
>
>
> set topNum to 1 as integer
>
> set bottomNum to 32 as integer
>
>
>
> ... and a variable for the page number:
>
>
>
> set pageNum to 1 as integer
>
>
>
> ...and a variable for the base part of the EPS filename:
>
>
>
> set epsBaseName to "Seite_" as string
>
>
>
> ...and one for the rest of the path to the EPS files:
>
>
>
> set epsFilePath to "Server:volume:directory:" as string
>
>
>
> At this point, your repeat loop would begin. Each time through the repeat
>
> loop, construct the complete pathname of each of the two images. First, add
>
> a leading zero if necessary:
>
>
>
> set topNumText to topNum as text
>
> if count of characters in topNumText =1 then
>
> set topNumText to ("0" & topNumText) as string
>
> end if
>
>
>
> set botttomNumText to bottomNum as text
>
> if count of characters in botttomNumText =1 then
>
> set botttomNumText to ("0" & botttomNumText) as string
>
> end if
>
>
>
> Then compile all the variables into the full pathname of each image:
>
>
>
> set topImagePath to (epsFilePath & epsBaseName & topNumText) as
>
> string
>
> set bottomImagePath to (epsFilePath & epsBaseName & botttomNumText)
>
> as string
>
>
>
> After you've created the photo boxes, place the top image in the top box,
>
> bottom image in the bottom box:
>
>
>
> set image 1 of picture box 1 of page pageNum to alias topImagePath
>
> set image 1 of picture box 2 of page pageNum to alias
>
> bottomImagePath
>
>
>
> just before the end of the repeat loop, increment and decrement your
>
> counters:
>
>
>
> set topNum to (topNum + 1) as integer
>
> set bottomNum to (bottomNum -1) as integer
>
> set pageNum to (pageNum + 1) as integer
>
>
>
> if you've reached the final page, the "topNum" variable will be equal to or
>
> greater than the "bottomNum" variable. If so, exit the repeat loop:
>
>
>
> if topNum 3 bottomNum then
>
> exit repeat
>
> end if
>
>
>
>
>
>
>
> That's a VERRRRY rough outline. It can be tightened up quite a bit, error
>
> trapping added, etc. Hopefully, this will point you in the right direction.
>
>
>
> Jason
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users