quark get image name

Hi All,

Please see the code below I am not able to get Image name, where I am making mistake.


tell application "QuarkXPress"
	tell document 1
		set x to properties of generic box 1
		set y to properties of image 1 of generic box 1
		set ImageList to object reference of every generic box whose class is picture box
		repeat with Mymage in ImageList
			tell MyImage
				set file_name to get name of image 1 as text
				display dialog file_name
			end tell
		end repeat
	end tell
end tell


Thanks

Rajeev,

I don’t have quark at home, but it looks like what you have should work. One thought is that the first box that you are trying to process does not have an image in it. You need to make sure that the file path of image 1 of Myimage is not null before going any further. I the file path is null then the name will be blank, or it might error out on you.

Jerome

Hi Jerome,
I have checked with that option also, but it is showing dialog box without any names.


				if file path of image 1 is not null then
				set file_name to get name of image 1 as text
				display dialog file_name
				end if

Thanks

Hi Mac

getting exact same results here! Just an empty string.
Not sure why, you’ll have to get the name from the file path as a work round!!

I don’t have Quark available but if someone who does can run this script and post the results that are returned for the properties I might be able to figure out what is happening:

tell application "QuarkXPress"
   tell document 1
       set y to properties of image 1 of generic box 1
  end tell
end tell

Do this in a new document that has one page and only one picture box created that has a picture linked to it.

ok I can tell one of two things is going on either name of image broke with 6.52 or it broke with intel

You can get file path of image 1 of the box then extract the name form that though

tell application “QuarkXPress”
tell document 1
set theBoxes to every picture box
repeat with abox in theBoxes
try
set thepath to file path of image 1 of abox as string
set tid to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to “:”
set theName to text item -1 of thepath
set AppleScript’s text item delimiters to tid
if theName is not “null” then display dialog theName
end try
end repeat
end tell
end tell

Hi jerome

Results of your script:

{class:image, object reference:image 1 of generic box 1 of document "Project1" of application "QuarkXPress Passport", actual bounds:«data FRMS000000000000000101E0D3D302D13DBD», angle:«data FX° 00000000», bounds:{0, 0, 721, 481}, color:color spec "Black" of document "Project1" of application "QuarkXPress Passport", contrast:normal contrast, file path:alias "Steve's MacBook Pro:Users:stephenpartridge:Desktop:000_0120.tiff", file type:TIFF picture, greek pictures:false, image trap:default, image type:color 32 bit image, invert runaround:false, model:HSB model, name:"", missing:false, modified:false, modification date:date "Saturday, March 24, 2007 15:06:17", negative:false, offset:«data FPMS0000000100000000», scale:«data FP% 0000FFFF0000FFFF», screen:0, screen angle:«data FX° 002D0000», screen frequency:0, screen function:dot spot, shade:«data FX% 00010000», show half tone:false, skew:«data FX° 00000000», suppress printing:false}

mcgrailm is right, the name property is not assigned the file name so you will need to get it another way like he suggested or the this:

tell application "QuarkXPress"
	tell document 1
		set ImageList to object reference of every generic box whose class is picture box
		repeat with Mymage in ImageList
			tell MyImage
				tell application "Finder" to set file_name to name of thepath
				display dialog file_name
			end tell
		end repeat
	end tell
end tell