Skip to main content
sarfrazm7834471
Inspiring
November 25, 2015
Answered

how to insert images from external folder into text frame using AppleScript

  • November 25, 2015
  • 1 reply
  • 517 views

set myFile to null

tell application "Finder"

  set ArtFolder to choose folder with prompt "Select Art Folder: ---->>"

  set chap1 to (get folder 1 of folder ArtFolder)

  set myFile to (get file 1 of folder (chap1 as alias))

end tell

tell application "Adobe InDesign CS5.5"

  set myDoc to active document

  tell myDoc

       set figureNode to XML element 1 of XML element 2 of XML element 1 of myDoc

       set myFrame to make text frame with properties {geometric bounds:{3, -13, 13, -3}}

       tell text frame myFrame to place (file (myFile))

       markup myFrame using figureNode

  end tell

end tell


==========================================

Requirement: I want to insert image from external folder & contents of current document node into text frame...

I am using above code, But belowe line not working....

          :- tell text frame myFrame to place (file (myFile))

Anyone can help me please.....

Thanks

This topic has been closed for replies.
Correct answer sarfrazm7834471

Problem solved by below code:===>>

tell application "Adobe InDesign CS5.5"

       set myDoc to active document

       tell myDoc 

            set figureNode to XML element 1 of XML element 2 of XML element 1 of myDoc

            set ArtFrame to make text frame with properties {geometric bounds:{3, -13, 13, -3}} -- {y,w,h,x} 

            select ArtFrame

            place (myArtFile as alias) on ArtFrame

            tell myFrame to fit given frame to content 

       end tell

end tell

1 reply

Peter Spier
Community Expert
Community Expert
November 25, 2015

Scripting questions are best asked in the scripting forum. I've moved your question for you.

sarfrazm7834471
Inspiring
November 25, 2015

OK Thanks...

sarfrazm7834471
sarfrazm7834471AuthorCorrect answer
Inspiring
December 2, 2015

Problem solved by below code:===>>

tell application "Adobe InDesign CS5.5"

       set myDoc to active document

       tell myDoc 

            set figureNode to XML element 1 of XML element 2 of XML element 1 of myDoc

            set ArtFrame to make text frame with properties {geometric bounds:{3, -13, 13, -3}} -- {y,w,h,x} 

            select ArtFrame

            place (myArtFile as alias) on ArtFrame

            tell myFrame to fit given frame to content 

       end tell

end tell