5 Replies Latest reply on Jun 3, 2009 3:47 AM by sstanleyau

    (AS) Having trouble with units in dialog box

    Charlieheinz

      Hi all,

       

      I'm having trouble with showing the right units in my dialog box: In the "measurement edit box" it will allways say the value in pts.

      Even if I add ", edit units:millimeters}" it goes wrong, because then it will show the converted values of 210 and 297.

       

      I would simply like it to display, AND USE, 210 mm.

       

      The other problem is that if I press Cancel, the script will go on and give an error about myPageWidth not defined.

       

       

      Below is the current script:

       

      -----------------------------------

       

       

      tell application "Adobe InDesign CS4"

       

      tell view preferences

      set horizontal measurement units to millimeters

      set vertical measurement units to millimeters

      end tell

       

       

      set myDialog to make dialog with properties {name:"Test"}

      tell myDialog

       

       

      make dialog column

      tell the result

       

      make border panel

      tell the result

      make dialog column

      tell the result

      make static text with properties {static label:"Size"}

      end tell

      make dialog column

      tell the result

      make static text with properties {static label:"Width:"}

      make static text with properties {static label:"Height:"}

      end tell

      make dialog column

      tell the result

      set myPageWidthField to make measurement editbox with properties {edit value:210}

      set myPageHeightField to make measurement editbox with properties {edit value:297}

      end tell

      end tell

      end tell

      end tell

       

       

       

      --Show dialog

       

       

      set myResult to show myDialog

      if myResult is true then

      --Get the values from the various editboxes.

      set myPageWidth to edit value of myPageWidthField

      set myPageHeight to edit value of myPageHeightField

      else

      destroy myDialog

      end if

       

      --Make the document

       

      set myDocument to make document

       

      tell document preferences of myDocument

      set page height to myPageHeight

      set page width to myPageWidth

      set pages per document to 1

      --Bleed

      set document bleed bottom offset to "0"

      set document bleed top offset to "0"

      set document bleed inside or left offset to "0"

      set document bleed outside or right offset to "0"

      --Slug

      set slug bottom offset to "20mm"

      set slug top offset to "0"

      set slug inside or left offset to "0"

      set slug right or outside offset to "0"

       

       

      end tell

       

      ---Bleed and margin---

       

      tell master spread 1 of myDocument

      tell margin preferences of pages

      set top to 10

      set left to 10

      set bottom to 10

      set right to 10

      end tell

      end tell

       

       

      end tell

       

      Message was edited by: Charlieheinz (Added AS to title)