Quark Art Automation

Hello,

I have automate importing artwork, Here is logic.

File name and capion wll be in text file with needed coding say {[[Fig 1.2]] (((Caption goes here)))} We can code it differently if it works better.

I have to get the name of file from this text grep the caption and do the following actions.


get image name() HelpMe
select folder of image() OK
place image in width of page() OK
place caption box below or above() Incomplete
place source box below() StillToDo
group image and caption box() StillToDo


Is there any one who can complete this or give me other suggestions.

Scratch code is below:

property TypeList : {"BMP ", “EPSF”, “GIFf”, “JPEG”, "PDF ", “PICT”, “PNGf”, “TIFF”} – File types of your graphic files
property LabelHeight : 16 – Height of the Label Box (in points)
property HorSpace : 6 – Gutter between column (in points)
property VerSpace : 12 – Gutter between rows (in points)

property BoxWidth : 20 – will be defined at run time
property BoxHeight : 10 – will be defined at run time
property SourceFolder : “” – will be defined at run time
property Xor : 0 – will be defined at run time
property Yor : 0 – will be defined at run time
property LabelSpace : 12 – will be defined at run time
property MarginTop : 0 – will be defined at run time
property MarginBottom : 0 – will be defined at run time
property MarginLeft : 0 – will be defined at run time
property MarginRight : 0 – will be defined at run time
property DocName : “” – will be defined at run time

tell application “Finder”
set theFolder to (choose folder) as text
end tell

tell application “QuarkXPress”
activate
tell document 1
–// get image_name_caption_Source()
–tell page 1
–tell current text box
–copy contents of (paragraph 1 as text) to theCon
set theImagePath to theFolder & theCon as text
repeat with i from 1 to (count of theFolder)
Make_PicBox(theImagePath)
Make_CaptionBox(ThisCaption)
Group_Both()
end repeat
end tell
–end tell
–end tell
end tell

on Make_PicBox(theImagePath)
tell application “QuarkXPress”
tell document DocName
tell «class CUPG»
set Y to Yor
set x to Xor
set NewBox to make new «class PICB» at beginning with properties {bounds:{Y, x, Y + BoxHeight, x + BoxWidth}}
tell «class PICB» 1
set «class IMAG» 1 to file ((theImagePath) as text)

			end tell
			set HH to «class hegt» of bounds of «class IMAG» 1 of NewBox
			set height of bounds of NewBox to HH
			
		end tell
		
	end tell
end tell

end Make_PicBox

on Make_CaptionBox(ThisCaption)
tell application “QuarkXPress”
set ParaStyle to «class posp» of «class stsh» “Label” of document DocName
tell document DocName
tell «class CUPG»
set CaptionBox to make new «class TXTB» at beginning with properties {bounds:{Y + BoxHeight + L, x, Y + BoxHeight + LabelHeight, x + BoxWidth}}
tell LabelBox
set contents of text flow 1 to ThisCaption
set «class ssht» of paragraph 1 of text flow 1 to ParaStyle
end tell
end tell
end tell
end tell
end Make_CaptionBox