Hi There,
I’ve put together a script that will list all the names of images within picture boxes in Quark. A report containing these filenames is then created on the desktop.
One thing I’ve noticed with the report is that after the first filename and path I get a blank line after the first item in the list and then all the others are ok.
pic 1
<< The report generated has a space here???
pic 2
pic 3
pic 4
Can anyone tell me why I get this space? And, can anyone tell me how I can get just the filename of the pic and not the path too.
Thanks in advance
Nick
Here’s the code:-
on open (someitems)
set LogFile to a reference to (path to desktop as string) & "FolderContentsList.txt"
set savedTextItemDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {return}
set picList to {}
tell application "QuarkXPressª"
activate
repeat with theitem in someitems
open theitem remap fonts no use doc prefs yes
get the count of every page in document 1
set pagecount to the result
repeat with pc from 1 to pagecount -- page loop
set picBoxCount to the count of every picture box of page pc of document 1 -- pic box loop
repeat with i from 1 to picBoxCount
tell picture box i of page pc of document 1
set ItemName to (file path of image 1) as text
if ItemName is not equal to "null" then
set picList to (picList & ItemName & return as text)
end if
end tell
end repeat
end repeat
set total to the count of picList
close document 1 saving no
end repeat
end tell
try
open for access file LogFile with write permission
set eof of file LogFile to 0
write picList to file LogFile
close access file LogFile
on error errText number errNum
close access file LogFile
display dialog errText
end try
set AppleScript's text item delimiters to savedTextItemDelimiters
end open