set ctSwatches to 12
set pdfDok to "macHd:wbf:test2.pdf" as string
set pdfBreite to 280
set pdfHoehe to 220.7
set inddBreite to 450
set breiteOft to round (inddBreite / pdfBreite) rounding down
set hoeheOft to round (inddBreite / pdfHoehe) rounding down
set pdfHoeheZ to round (ctSwatches / breiteOft) rounding down
if pdfHoeheZ * breiteOft is less than ctSwatches then set pdfHoeheZ to pdfHoeheZ + 1
if breiteOft is greater than 1 or hoeheOft is greater than 1 then
if ctSwatches is greater than 1 then
--set pdfDok to ((filePath as string) & (dokName) & "Dr.pdf") as string
if breiteOft is equal to hoeheOft then
if pdfBreite is less than pdfHoehe then
my erstIndd(inddBreite, pdfHoehe, pdfBreite, pdfHoeheZ, ctSwatches, pdfDok, 1, breiteOft)
else
my erstIndd(inddBreite, pdfHoehe, pdfBreite, pdfHoeheZ, ctSwatches, pdfDok, 2, hoeheOft)
end if
else if hoeheOft is not greater than breiteOft then
my erstIndd(inddBreite, pdfHoehe, pdfBreite, pdfHoeheZ, ctSwatches, pdfDok, 1, breiteOft)
else
my erstIndd(inddBreite, pdfHoehe, pdfBreite, pdfHoeheZ, ctSwatches, pdfDok, 2, hoeheOft)
end if
end if
end if
on erstIndd(inddBreite, pdfHoehe, pdfBreite, pdfHoeheZ, ctSwatches, pdfDok, ausr, erg)
tell application "Adobe InDesign CC 2017"
set indd to make new document at beginning
tell indd
tell document preferences to set properties to {page width:inddBreite, page height:(pdfHoehe + 5) * pdfHoeheZ}
repeat with i from 1 to ctSwatches
set reEck to make rectangle of page 1 with properties {geometric bounds:{0, 0, pdfHoehe, pdfBreite}}
set stroke color of reEck to item 1 of swatches
my PlacePDF(i, indd, pdfDok, reEck)
if ausr is 2 then tell reEck to set rotation angle to 90
move parent of reEck of page 1 to my moveBounds(i, erg, pdfHoehe, pdfBreite, pdfHoeheZ)
end repeat
end tell
end tell
end erstIndd
on PlacePDF(seite, indd, pdfDok, reEck)
tell application "Adobe InDesign CC 2017"
set page number of PDF place preferences to seite
tell indd
place alias (pdfDok as string) on reEck
end tell
end tell
end PlacePDF
on moveBounds(zeahler, erg, pdfHoehe, pdfBreite, pdfHoeheZ)
set {pl1, pl2} to {0, 0}
--if zeahler is greater than 1 then
-- repeat with i from 1 to pdfHoeheZ
-- if zeahler is greater than 1 then
--
-- end if
-- end repeat
-- repeat with i from 1 to erg
-- if zeahler is greater than 1 then
--
-- end if
-- end repeat
--end if
--if zeahler is greater than 1 then
-- set {pl1, pl2} to {(pdfBreite + 5) * zeahler, 0}
--else if zeahler is not greater than erg then
--
--else if zeahler is not greater than erg then
-- set {pl1, pl2} to {(pdfBreite + 5) * zeahler, 0}
--else if i is not greater than 2 * erg then
-- set {pl1, pl2} to {(pdfBreite + 5) * zeahler, pdfHoehe + 5}
--else if i is not greater than 3 * erg then
-- set {pl1, pl2} to {(pdfBreite + 5) * zeahler, (pdfHoehe + 5) * 2}
--else if i is not greater than 4 * erg then
-- set {pl1, pl2} to {(pdfBreite + 5) * zeahler, (pdfHoehe + 5) * 3}
--else if i is not greater than 5 * erg then
-- set {pl1, pl2} to {(pdfBreite + 5) * zeahler, (pdfHoehe + 5) * 4}
--else if i is not greater than 6 * erg then
-- set {pl1, pl2} to {(pdfBreite + 5) * zeahler, (pdfHoehe + 5) * 5}
--else if i is not greater than 7 * erg then
-- set {pl1, pl2} to {(pdfBreite + 5) * zeahler, (pdfHoehe + 5) * 6}
--end if
return {pl1, pl2}
end moveBounds