2 Replies Latest reply on Jun 12, 2010 2:10 AM by Poo_Del

    AppleScript--IDCS4--Label

    Poo_Del

      Dear All,

      Please see below code to create one text frame and label it.

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

       

       

       

      tell application "Adobe InDesign CS4"

              try

                         set myFont to font "Arial"

              end try

              set user interaction level of script preferences to never interact

              set myDocument to active document

              tell myDocument

                         set myString to "Ad Name:" & tab & "item 2 of argv" & return & "Advertiser:" & tab & "item 5 of argv" & return & "Run Date:" & tab & "item 6 of argv" & return & "Size:" & tab & "item 3 of argv X item 4 of argv" & return & "Color:" & tab & "item 7 of argv" & return & "Sales Rep:" & tab & "item 8 of argv" & return & "Status:" & tab & "item 9 of argv"

                         set myBounds to my myGetBounds(myDocument, page 1)

                         set myPage to page 1 of myDocument

                         tell myPage

                                   set myTextFrame to make text frame with properties {geometric bounds:my myGetBounds(myDocument, myPage), contents:myString}

                                   set label of myTextFrame to "myRemoveFrame"

                         end tell

                         set myStory to parent story of myTextFrame

                         tell text 1 of myStory

                                   try

                                             set applied font to myFont

                                   end try

                                   set point size to 6

                                   convert to table

                         end tell

              end tell

      end tell

       

      on myGetBounds(myDocument, myPage)

              tell application "Adobe InDesign CS4"

                         tell document preferences of myDocument

                                   set myPageWidth to page width

                                   set myPageHeight to page height

                         end tell

                         tell margin preferences of myPage

                                   if side of myPage is left hand then

                                             set myX2 to left

                                             set myX1 to right

                                   else

                                             set myX1 to left

                                             set myX2 to right

                                   end if

                                   set myY1 to top

                                   set myY2 to bottom

                         end tell

                         set myX2 to myPageWidth - myX2

                         set myY2 to myPageHeight - myY2

                         return {"-5pt", myX1, "-59pt", myX2}

              end tell

      end myGetBounds

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

      In Event log it is showing applied but when I am trying below code for deleting this frame it is not identifying this text frame.

       

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

      tell application "Adobe InDesign CS4"

              tell document 1

                         try

                                   set myPageItems to page item "myRemoveFrame" of page 1

                                   repeat with aFrame in myPageItems

                                             if class of aFrame is text frame then delete aFrame

                                   end repeat

                         end try

              end tell

      end tell

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

      Regards,

      Poo

        • 1. Re: AppleScript--IDCS4--Label
          Poo_Del Level 1

          Guys it was all are my fault.

          Below is the corrected code and working fine. Now I want to convert this below code for vbscript. I am not experienced in vbscripting part.

           

          tell application "Adobe InDesign CS4"

                  tell document 1

                             try

                                       set myPageItems to page item "myRemoveFrame"

                                       repeat with aFrame in myPageItems

                                                 if class of aFrame is text frame then delete aFrame

                                       end repeat

                             end try

                  end tell

          end tell

           

          Regards,

          Poo

          • 2. Re: AppleScript--IDCS4--Label
            Poo_Del Level 1

            Please help me by finishing up this my work any one can provide me javascript also for the above pice of code.

             

            Regards,

            Poo