4 Replies Latest reply on Apr 5, 2011 11:55 PM by mikeytttt

    [AS-CS5] locked property of a frame

    mikeytttt Level 1

      OK, i have an empty frame which is locked. I place an graphic in the frame. Now I can move the graphic around inside the frame.

       

      When looking at the locked status of the graphic, is says it is false, while for the frame is says it is true

       

      --given a locked frame with an jpeg image placed in it

      tell application "Adobe InDesign CS5"
          tell active document
              set myframe to item 1 of selection
              set theimage to item 1 of all graphics of myselect
              return locked of theimage --returns false
              return locked of myframe --returns true
          end tell
      end tell

       

      BUT, If I then unlock and re-lock the frame (manually or by script), I can no longer move the graphic within the frame, and the above script will return locked as being TRUE for both the frame and the image. OK, fair enough, but can i return to the previous state?

       

      I have tried to set locked of theimage to false but get the error: the property is not applicable in the current state.

       

      I'm assuming it's just not possible to return to the original state. That kind of makes sense as I don;t think you can do it manually in InDesign, but it seems odd that you can have the state of a locked frame and an unlocked image to start with, but then can't recreate that state if you unlock and then lock the frame at any stage.

        • 1. Re: [AS-CS5] locked property of a frame
          csm_phil Level 4

          Hi,

           

          I have followed the below mentioned process to check your requirement:

          1. create a empty frame.
          2. place the JPG image into the created frame.
          3. lock the frame after JPG placement.

           

          After following the above mentioned process and using the below mentioned script (provided in your post), i am unable to check the locked status of the placed image.

          tell application "Adobe InDesign CS5"
              tell active document
                  set myframe to item 1 of selection
                  set theimage to item 1 of all graphics of myframe
                  return locked of theimage --returns false
           
                return locked of myframe --returns true
              end tell
          end tell

           

          Can i know how do you got the locked status of the placed image.

          This will help me to help you.

           

          thx

          csm_phil

          • 2. Re: [AS-CS5] locked property of a frame
            mikeytttt Level 1

            Hmm, not sure - it finds the locked status of the image on mine. Do you have the frame selected when you run the script and (sorry if it's obvious) are you using ID5?

             

            As I mentioned the result given are:

            1) If the frame is locked BEFORE the image is placed, then locked of image returns false

            2) If the frame is locked AFTER the image is placed, the locked of image returns true

             

            In situtaion 2, I want to be able to change the the locked of image to false, while keeping the locked of frame to true, but it just doesn't seem possible to achieve this, even though that state can exist (as in situation 1)

             

            Here's the script in a bit more friendly way:

             

            tell application "Adobe InDesign CS5"
                tell active document
                    set myframe to item 1 of selection
                    set theimage to item 1 of all graphics of myframe
                   
                    set IsImageLocked to locked of theimage
                    set IsFrameLocked to locked of myframe
                   
                    return "The Image is locked= " & IsImageLocked & "   /   The frame is locked= " & IsFrameLocked
                   
                end tell
            end tell

            • 3. Re: [AS-CS5] locked property of a frame
              csm_phil Level 4

              Hi,

               

              it finds the locked status of the image on mine. Do you have the  frame selected when you run the script and (sorry if it's obvious) are  you using ID5?

               

               

              I have followed the same process by selecting the frame before running the script.

              I have checked in InDesign CS3,CS4,CS5 in MAC OS 10.4 & 10.5 and below is my comment.

              In InDesign CS5 once a frame is locked it is unable to place the image inside the locked frame (please check the layer also), but in InDesign CS3/CS4 it is possible to place the image inside the locked frame.

              However, using this script for CS3/CS4 we are unable to return the locked status of the image.

               

              thx

              csm_phil

              • 4. Re: [AS-CS5] locked property of a frame
                mikeytttt Level 1

                In CS5 you can place a pciture in a locked frame if the preferences have been set to allow selecting of locked frames.

                 

                This can be achieved manualy by going into the preferences, or can be added to the script with the following line:

                 

                       set properties of general preferences to {prevent selecting locked items:false}