Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JonParis

macrumors newbie
Original poster
Oct 23, 2011
2
0
Applescript seems very powerful but hard to find answers to "simple" ?s it seems.

I'm trying to adapt a page numbering script for use with PDF Pen. I have managed to change the print location and text in the script as shown here:

tell application "PDFpen"
if (count documents) > 0 then
-- Get value for what should be prepended to beginning of numbering scheme.
set prepend_value to text returned of (display dialog ¬
"Enter numbering prefix:" with title ¬
"Bates Numbering" default answer ¬
"© Copyright Partner400, 2011 - xxxxxxx - Page: " buttons {"Cancel", "OK"} ¬
default button "OK")
set font of prepend_value to theFont
set size of prepend_value to (24)
set pageCount to count (pages of document 1)
repeat with pageNumber from 1 to pageCount
set thePage to page pageNumber of document 1
set currentPage to prepend_value & pageNumber & " of " & pageCount as rich text
make new text imprint at end of imprints of thePage with properties {rich text:currentPage, x position:60, y position:16, height:16, width:540}
end repeat
return pageCount
end if
end tell


The script works fine but I cannot find how to set the font and size. I have tried adding the lines:

set theFont to {"Arial"}
set font of prepend_value to theFont
set size of prepend_value to (24)

to the script but I just get error messages.

ANy hints as to what is wrong and/or where I can look for help.
 
Remove your lines "set font" and "set size"

Change your "make new text imprint" line to:

set theImprint to make new text imprint at end of imprints of thePage with properties {rich text:currentPage, x position:60, y position:16, height:16, width:540}

Then add the following right below it:

set font of attribute run 1 of rich text of theImprint to "Arial"
set size of attribute run 1 of rich text of theImprint to 24
 
Thank you so much - that works beautifully.

Could you point me in the direction where the setting of such properties are documented? I'm still having a real hard time finding good sources of information on Applescript.
 
Thanks I have been looking for this for a long time.

Is there a way to specify the text color?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.