Script to export all text in old. qxp archive

Discuss AppleScripting for QuarkXPress 2015, 2016 & 2017.

Script to export all text in old. qxp archive

Postby Reimagine » 23 Aug 2016, 20:25

I have about 200 old quark files (many going back to 3.3 created in the mid 90s) of a newspaper layout with about 10 stories in each issue. I am looking for a script to go from box to box and export text either into one file or multiple files in word/rtf format but text only would be doable. Also to open, save all images, open save as pdf

1. In other words just go from text box to text box collecting all the text in each story. The photo, caption, headline and subhead information would preferably be captured in a single file, but it wouldn't be too hard to merge them back together in word.
2. use the export images feature which works well to export all images and convert to jpeg
3. save file as pdf

Three different scripts fine. Or a single one.

I have a Quark 8.5.1 running on Maco OS 10 8.5 So far it successfully opens all the old files i have tested (once i and qxd extension)

It looked to me like some existing applescripts could be expanded to do these functions and suggestions? Leads/ offers.)

We have a very limited budget so suggestions about a very low cost programmer who could do this, or an outsourcing shop would be helpful if no-one on here has script suggestion
Reimagine
 
Posts: 2
Joined: 13 Aug 2016, 17:11

Re: Script to export all text in old. qxp archive

Postby Rohit Bajaj (Quark) » 24 Aug 2016, 22:36

Hello Reimagine,

Kindly find the required AppleScript below: This will save the text of different boxes of QXP layout to different word documents.
Please create a folder "text" on your desktop and change the Username (username of your system on which you are running the script) in the below script.

on zero_pad(value, string_length)
set string_zeroes to ""
set digits_to_pad to string_length - (length of (value as string))
if digits_to_pad > 0 then
repeat digits_to_pad times
set string_zeroes to string_zeroes & "0" as string
end repeat
end if
set padded_value to string_zeroes & value as string
return padded_value
end zero_pad

tell application "QuarkXPress"
set textFormat to {"TEXT", "HTML", "XPress Tags", "Rich Text Format", "Word document"}
set fileExtension to {"txt", "html", "xtg", "rtf", "docx"}
tell document 1
set pagecount to 1
repeat with s from 1 to number of spread
repeat with p from 1 to number of page of spread s
repeat with tb from 1 to number of text box of page p of spread s
--set rndindex to random number from 1 to 5
set rndindex to 5
set filePath to "Users:<UserName>:Desktop:text:" & my zero_pad(pagecount, 3) & "_b" & tb & "." & item rndindex of fileExtension
--get text of text box tb of page p of spread s
save text of text box tb of page p of spread s in filePath as item rndindex of textFormat
end repeat
set pagecount to pagecount + 1
end repeat
end repeat
end tell
end tell

Thanks
Rohit
Rohit Bajaj (Quark)
Quarkian
Quarkian
 
Posts: 88
Joined: 15 Jul 2015, 06:40

Re: Script to export all text in old. qxp archive

Postby Reimagine » 30 Aug 2016, 15:31

Thanks! I will give this a try. I've never used applscript and haven't written code since college although i do my fair share of html and css. In reading through this I don't see how it specifies which quark document to select. I will try running it with a quark document open
Reimagine
 
Posts: 2
Joined: 13 Aug 2016, 17:11

Re: Script to export all text in old. qxp archive

Postby helle » 04 May 2017, 11:51

Hello Rohit,

I tried your script and it worked well in the discribed manner, i.e. it produces a new textfile for each text frame of the XPress document. However I'm not familiar with scripting. So please, could you tell me which changes in the script would be necessary to export the contents of all text frames in a single file? As far as I can see, there is no XPress version specified in the script. So it works with all versions (10.5, 12.2 etc.)?

Thank you in advance.

Best regards,
helle
helle
 
Posts: 1
Joined: 04 May 2017, 09:49


Return to QuarkXPress 20xx: Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron