10 Replies Latest reply on Apr 7, 2016 6:54 AM by Loic.Aigon

    Startupscript unable to "tell application" ?

    DBLjan Level 2

      Hi folks,
      need help with this task: Bringing the active document name to status messages of Messages.

      Since I failed with javascript (Messages status got changed but did not show up) I switched to Applescrip for this, which works, but:

       

      If I test my script without Indesign everything is fine ("…and executed"). But if I put it in startup scripts, the event gets fired ("fired…"), but the rest doesnt work anymore. Has InDesign a problem with firing other applications or what is wrong here??

       

      --Registers an event listener on the afterNew event.
      tell application "Adobe InDesign CS5.5"
          make event listener with properties {event type:"afterOpen", handler:my MessageStatus}
      end tell
      
      on MessageStatus()
          display dialog "fired…"
          
          set docName to "empty"
          tell application "Adobe InDesign CS5.5"
              try
                  tell active document
                      set docName to name of it as string
                  end tell
              end try
          end tell
          
          tell application "Messages"
              set the status message to "" & (random number from 1 to 99) & " " & docName
              display dialog "…and executed"
          end tell
          
      end MessageStatus