Applescript Help Needed

Discussion in 'Mac Basics and Help' started by JonParis, Oct 23, 2011.

  1. JonParis macrumors newbie

    Joined:
    Oct 23, 2011
    #1
    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.
     
  2. ffrog macrumors newbie

    Joined:
    Nov 10, 2011
    #2
    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
     
  3. JonParis thread starter macrumors newbie

    Joined:
    Oct 23, 2011
    #3
    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.
     
  4. focaton macrumors newbie

    Joined:
    Nov 17, 2011
    #4
    Thanks I have been looking for this for a long time.

    Is there a way to specify the text color?
     

Share This Page