Indesign CC Placing an image from filemaker

I am able to create a box in applescript and place my image in it.

	tell myDocument
	set myRectangle to make rectangle with properties {geometric bounds:{1.5, 0.75, 11.5, 8}}
	try
		place alias (fPath) on myRectangle
		fit rectangle 1 given center content
		end try
	end tell

My question is how do I target an image box that is labeled (specPDF) in an InDesign template.
All of the solutions I have found are old.

Thanks
Rob

hi

something like this maybe

tell application "Adobe InDesign CC"
	set myDoc to active document
	tell myDoc
		set theRects to every item of all page items whose class is rectangle and label is "IMAGE"
		place fPath as alias on theRects
	end tell
end tell

Thank you. It works like a charm.

Rob

I’m having a problem with it. The script you gave me is a part of a loop.


on inDesign(tifPath2, adSize)
	tell application "Adobe InDesign CC"
		activate
		set myDocument to document 1
		tell myDocument
			set theRects to every item of all page items whose class is rectangle and label is "tifPath"
			place tifPath2 as alias on theRects
			fit theRects given center content
		end tell
		print myDocument using "PrintTiff" without print dialog
		delay 2
	end tell
end inDesign

When it places the next graphic, it sizes it to the original size of the first graphic. I would like them to print the original size. Everything else works in my loop except for this.

Rob

can you supply the whole repeat loop, it may give us an indication of why it’s not working

I got it to kind of work by closing the InDesign template on each time for the loop instead of just replacing in info in the template.

I would still like to know why it was not working by replacing in images in the template.



tell application "Finder"
	if not (exists disk "Pub-TLD") then
		beep 2
		activate
		display dialog "Please mount the Pub-TLD server before proceeding." buttons {"OK"} default button 1 with icon 1 giving up after 10
		return 0
	end if
end tell

tell application "FileMaker Pro"
	tell document "2015 GS_RVTG"
		beep
		display dialog "Print TIFF files for the current found set of records?" buttons {"No", "OK"} default button 2 with icon 1
		if button returned of result = "No" then
			AdobeInDesignCCCloses() of me
			return 0
		end if
		repeat with i from 1 to count of records
			set artName to cell "ART" of record i
			set advName to cell "ADVERTISER::ADV" of record i
			set repName to cell "REP::REP_NM" of record i
			set adSize to cell "AD_SZ" of record i
			set modDate to cell "PRD_FIL_MOD" of record i as string
			set currDate to cell "UTILITY::CUR_DATE" of record i
			set adTraffic to cell "AD_TRAF" of record i
			set adColor to cell "AD_COL" of record i
			set lstCity to cell "ADVERTISER::ALC" of record i
			set lstState to cell "ADVERTISER::ALST" of record i
			set adSTate to cell "AD_ST" of record i
			set adCity to cell "AD_TWN" of record i
			set tifPath2 to cell "PRD_FIL_PATH" of record i
			inDesign(lstCity, lstState, tifPath2, advName, artName, adSize, adColor, currDate, adTraffic, repName, modDate, adCity, adSTate) of me
			set cell "STATUS" of record i to "Proofer"
			set cell "ROUTE_TO" of record i to "Traffic"
		end repeat
		delay 1
		beep
		activate
		display dialog "Finished!" buttons {"OK"} default button 1 with icon 1 giving up after 5
	end tell
end tell



on inDesign(lstCity, lstState, tifPath2, advName, artName, adSize, adColor, currDate, adTraffic, repName, modDate, adCity, adSTate)
	tell application "Adobe InDesign CC"
		activate
		Template() of me
		set myDocument to document 1
		
		set contents of every text frame of myDocument whose label is "Artist" to artName
		set contents of every text frame of myDocument whose label is "Ad Size" to adSize
		set contents of every text frame of myDocument whose label is "Adv Name" to advName
		set contents of every text frame of myDocument whose label is "Color" to adColor
		set contents of every text frame of myDocument whose label is "Date" to currDate
		set contents of every text frame of myDocument whose label is "Ad Traffic" to adTraffic
		set contents of every text frame of myDocument whose label is "Rep Name" to repName
		set contents of every text frame of myDocument whose label is "Mod Date" to modDate
		set contents of every text frame of myDocument whose label is "Ad State" to adSTate
		set contents of every text frame of myDocument whose label is "Ad City" to adCity
		set contents of every text frame of myDocument whose label is "see listing" to "See listing " & lstCity & ", " & lstState
		
		tell myDocument
			set theRects to every item of all page items whose class is rectangle and label is "tifPath"
			place tifPath2 as alias on theRects
			fit theRects given center content
		end tell
		
		tell myDocument
			if adSize contains "F/P" then
				set tifPath to "Pub-TLD: Directory TemplatesÆ’:Ad Guides:FP.eps"
				set adGuide to every item of all page items whose class is rectangle and label is "Guide"
				place tifPath as alias on adGuide
				fit adGuide given center content
			else if adSize contains "2P" then
				set tifPath to "Pub-TLD: Directory TemplatesÆ’:Ad Guides:FP.eps"
				set adGuide to every item of all page items whose class is rectangle and label is "Guide"
				place tifPath as alias on adGuide
				fit adGuide given center content
			else if adSize contains "2 1/4" then
				set tifPath to "Pub-TLD: Directory TemplatesÆ’:Ad Guides:2-25.eps"
				set adGuide to every item of all page items whose class is rectangle and label is "Guide"
				place tifPath as alias on adGuide
				fit adGuide given center content
			else if adSize contains "1 1/2" then
				set tifPath to "Pub-TLD: Directory TemplatesÆ’:Ad Guides:1-1-2.eps"
				set adGuide to every item of all page items whose class is rectangle and label is "Guide"
				place tifPath as alias on adGuide
				fit adGuide given center content
			else if adSize contains "1/8-1" then
				set tifPath to "Pub-TLD: Directory TemplatesÆ’:Ad Guides:1-8-1.eps"
				set adGuide to every item of all page items whose class is rectangle and label is "Guide"
				place tifPath as alias on adGuide
				fit adGuide given center content
			else if adSize contains "" then
				set tifPath to "Pub-TLD: Directory TemplatesÆ’:Ad Guides:Blank.eps"
				set adGuide to every item of all page items whose class is rectangle and label is "Guide"
				place tifPath as alias on adGuide
			end if
		end tell
		
		print myDocument using "PrintTiff" without print dialog
		AdobeInDesignCCCloses() of me
	end tell
end inDesign

on Template()
	tell application "Adobe InDesign CC"
		open alias "Pub-TLD: GS Directory Ad TemplatesÆ’:indesign:Print TIFF TL 15.indt"
		zoom window 1 of document 1 given fit page
	end tell
end Template

on AdobeInDesignCCCloses()
	tell application "Adobe InDesign CC"
		if exists document 1 then
			close document 1 saving no
		end if
	end tell
end AdobeInDesignCCCloses

Rob

I may be missing something but I cant see anything that stands out, maybe some one else would like to chime in here
as I maybe missing the obvious.