I’ve a got a simple script that copies the project name of a Quark document to the layout name, and I’m trying to truncate the file extension from that layout name.
the standard addition – offset of someString – lets me do this until I activate Quark. It looks as tho Quark has a “same name” class that interferes. Is there any way I can override the Quark class, and use the std addition instead? Outside the “tell” the code works fine. Obviously, I haven’t done any of this in a while. Code follows. I marked the problem lines with “–>”
Thanks in advance,
Christine
tell application “QuarkXPress”
activate
try
-- This line will ensure that a document is open, before proceeding
if not (exists document 1) then error "No document is open."
set X to count every layout space of project 1
repeat with i from 1 to X
--set testText to "Testfile585460.qxp"
set finalText to ""
set testOffset to 0 as integer
set testText to name of document 1
set name of layout space i of project 1 to testText
if testText ends with ".qxp" then
set numberChar to count of testText
—>set testOffset to offset of “.qxp” in testText
display dialog "The offset of .qxp is " & testOffset
set newFilename to (characters 1 thru (testOffset - 1)) of testText
display dialog "The new filename is " & newFilename
else if testText ends with ".qxd" then
set numberChar to count of testText
—>set testOffset to offset of “.qxd” in testText
set newFilename to (characters 1 thru (testOffset - 1)) of testText
display dialog "The new filename is " & newFilename
end if
end repeat
end try
end tell