PLANET QUARK

by Quark users for Quark users

Category: JavaScript

Sort text (paragraphs) in QuarkXPress 2018

July 2, 2018July 4, 2018How-to, JavaScript, QuarkXPress 2018No Comments

You have text in a text box in QuarkXPress that needs to be sorted?

A list that needs to be in alphabetical order?

In QuarkXPress 2018 it is easy to sort text (paragraphs), using a sample JavaScript:

Sort text in QuarkXPress using a simple JavaScript

  1. Open the JavaScript palette in QuarkXPress 2018 and navigate to “Samples > Typography”
  2. Select the text box that you need sorted
  3. Run the JavaScript “Sort Paragraphs.js”
  4. Enter whether you want the data to be sorted Ascending or Descending
  5. Enter whether you sort text or numbers

Done.

Of course this is undoable.

Remember that this is a script that you can edit and change yourself, should you want to make changes. E.g. you could make a script that doesn’t prompt you about ascending/descending or text/numbers and just runs.

Restrictions

  • As QXML (the text formatting accessible by JavaScript) does not support every construct in text, you will loose features which are not yet supported by QXML such as Callouts, Footnotes, Endnotes, Cross References, Anchors etc. from the selected box.
  • The Script sorts the entire content of the selected text box, not just a selection.

Quick video showing this example


More sample JavaScripts for QuarkXPress on github

Quark has created a page on github to share more sample scripts and to encourage users to share their scripts:

https://github.com/qxpjs

Matthias Guenther

Both an engineer and a layout artist, Matthias bridges the gap between technology and people. Before joining Quark in 1997, Matthias pioneered print, Web, and multimedia products for multiple German publishing companies. He is an active participant in design and publishing communities and represented Quark in the Ghent PDF Workgroup.

From 1997 until 2019 Matthias played a central role in shaping Quark’s desktop, mobile and enterprise software. From February 2014 until January 2019 he headed Quark’s Desktop Publishing business unit; and was therefore responsible for QuarkXPress.

Matthias does not work for Quark anymore. If you want to connect with him, please visit his LinkedIn profile on https://www.linkedin.com/in/mguenther/

https://twitter.com/HamburQ

QuarkXPress 2018 – Recensione di un designer italiano

May 28, 2018May 29, 2018Digital Publishing, JavaScript, QuarkXPress 2018, Typography2 Comments

Quark rilascia Xpress 2018 (v. 14.0). Versione ricca di novità e soprattutto perpetua.

Questo primo video introduttivo (Guarda) propone una panoramica generale delle principali novità che sono decisamente interessanti. Il consiglio è quello di guardarlo magari dopo aver scorso questo articolo che vuole introdurre in maniera sommaria le principali novità.

Le due più importanti sono sicuramente la possibilità di aprire file IDML e di creare, tramite JavaScript, funzionalità e automatismi personalizzati. Fra gli script inclusi, per esempio, quello che permette di ordinare alfabeticamente più paragrafi (Sort Paragraphs.js).

Continue reading “QuarkXPress 2018 – Recensione di un designer italiano”

Andrea Astolfi

Andrea Astolfi is a creative professional with over 25 years of experience in electronic publishing. Andrea is based in Italy and specializes in the production of books and long documents, characterized by the presence of many images and illustrations.

—

Andrea Astolfi, grafico impaginatore con esperienza ventennale nel settore dell’editoria elettronica. Specializzato nella realizzazione di libri con molte pagine caratterizzate dalla presenza di molte immagini e illustrazioni.

http://www.totem-dtp.eu/

Mail Merge with QuarkXPress

May 8, 2018May 8, 2018JavaScript, QuarkXPress 20181 Comment

You need to send out a letter to your customers, which is personalized? Or you have a client that needs you to create a template to send out hundreds of personalized letters?

This task becomes time-consuming once you have several hundred addresses and you want each letter to use different content, such as text and pictures. Often, this requirement is described as mail merge.

With QuarkXPress 2018 and a sample JavaScript this is easily done:

Mail Merge using a simple JavaScript in QuarkXPress 2018

QuarkXPress 2018 offers a sample script that solves this simple mail merge problem and you are done in a few minutes. If you have more complex scenarios, feel free to modify and enhance the sample JavaScript, its code is open.

Step 1: Define you data

Define your data, either by using spreadsheet (e.g. Microsoft Excel), a database or a simple text editor.

You can use images and text. In the sample script we use one image per letter and several fields, like name, salutation, subject and greeting.

First, in the first row define the names of the fields. You can use any name for your field names, it is better for troubleshooting if you use self-explanatory names.

In our example we use:

URIRecipients NameAddress line 1Address line 2StateZIP CodeSubjectSenders NameSenders Title

Then, starting in the second row you enter the data:

URIRecipients NameAddress line 1Address line 2StateZIP CodeSubjectSenders NameSenders Title
Images\photo1.pngPeter PersonPenthouse 1Some LanePrime CityPA 12345Did you know?Marvin the MartianSVP Technology
Images\photo2.pngMatthew Manand so on…
and so on…

Of course you can also just use a text editor like Atom or TextEdit.

Now we need the data as a CSV (comma-separated values) file. You can use different separators, tabs, commas, semicolons, just make sure that you always use the same one to separate data. If you used MS Excel to create your data, you can save as CSV and specify your separator. Make sure that you do not use a separator that’s within your data.

In our example we are going to use a comma:

URI,Recipients Name,Address line 1,Address line 2,State, ZIP Code,Subject,Senders Name,Senders Title
Images\photo1.png,Peter Person,Penthouse 1,Some Lane,Prime City,PA 12345,Did you know?,Marvin the Martian,SVP Technology
Images\photo2.png,Matthew Man,Mansion 1,Some other Lane,Metro,MA 67890,Act now!,Alberto the larger Martian,SVP Technology
Images\photo3.png,Rudi Random,Residence 1,Yet Another Lane,Rural area,RA 11111,Surprising offer!,Easter the Egg,SVP Technology

Step 2: Create a template

Now in QuarkXPress 2018 create a template, so just a QuarkXPress document with your letter.

Whenever you have variable data (the address, the image) make sure that you put these boxes, text box or picture box, on a master page.

You can find the sample template (qpt file) here: https://github.com/qxpjs/Mail-merge/tree/master/mailmerge-data

Step 3: Insert placeholders

Wherever you need variable data, e.g. the personalized subject line, don’t type the data. Instead, type the field name (header name) that you used in the CSV file, surrounded by two brackets.

In our example type:

Subject: <<Subject>>

So the first word “Subject” will appear like this in your final output. The word “<<Subject>>” will be replaced by the data.

Of course you could also just use the placeholder by itself:

<<Subject>>

As this is just text, style it manually or use style sheets for the placeholder.

Step 4: Run the script

This “mail merge” script is contained with QuarkXPress 2018 as a script.

Open your “JavaScript” palette (Window menu). Navigate to to the Samples folder (in the JavaScript palette) and then to the “Automation” folder.

Double click the “Mail Merge.js” or select it and click on the Run button.

QuarkXPress will now create pages, one for each record defined in your CSV file.

Please note that QuarkXPress has a limitation of 2000 pages per layout, so if you have more records, first split the data to chunks of not more than 2000.

Step 5: Export PDF

You can now either print the layout containing all pages (or create one large PDF).

Alternatively you can create one PDF per page, by choosing the appropriate output option “Export pages as separate PDFs” in the PDF Export dialog:

Quick video showing this example


More sample JavaScripts for QuarkXPress on github

Quark has created a page on github to share more sample scripts and to encourage users to share their scripts:

https://github.com/qxpjs


 

Matthias Guenther

Both an engineer and a layout artist, Matthias bridges the gap between technology and people. Before joining Quark in 1997, Matthias pioneered print, Web, and multimedia products for multiple German publishing companies. He is an active participant in design and publishing communities and represented Quark in the Ghent PDF Workgroup.

From 1997 until 2019 Matthias played a central role in shaping Quark’s desktop, mobile and enterprise software. From February 2014 until January 2019 he headed Quark’s Desktop Publishing business unit; and was therefore responsible for QuarkXPress.

Matthias does not work for Quark anymore. If you want to connect with him, please visit his LinkedIn profile on https://www.linkedin.com/in/mguenther/

https://twitter.com/HamburQ

Search this site

How to quickly convert PDF to editable objects:

Categories

Sponsored

The five most helpful posts

The Non-Rental Suite for Creative Pro’s

How to delete preferences in QuarkXPress

How to test Mojave (10.14) – and how to revert to your previous version of MacOS

IDML import in use: why this is huge

Where is the free QuarkXPress Document Converter?

 

Recent News

  • Since October 18, 2018, QuarkXPress is available in the Mac App Store. It's called "QuarkXPress 2018 Pro". Read about the differences to QuarkXPress and what features it offers.Read more
  • QuarkXPress 2018 October Update adds a "dark theme" on MacOS to seamlessly integrate with Mojave's Dark Mode.Read more
  • Quark Software announced on September 17th a new software bundle offer that will save designers Read more
  • The (free) QuarkXPress 2018 October Update will add Mojave support and adds an "auto fit image" feature. Additionally you can "fill", so fill a box with an image. Both can be done manually (command key) or automatically, so even when you resize the box.Read more
  • Design on your iPad wherever you are with DesignPad, the iPad app that puts grid-based design control in the palm of your hand. No need to own InDesign or QuarkXPress. New 2018 version available now!Read more
  • Automatic hyphenation is an important tool to help you make text look good. See how QuarkXPress 2018 can help you create even better hyphenation with the new strictness level. Of course available for many languages, like Dutch, English, French, German, Italian, Spanish and more.Read more
  • Due to popular demand, the first update for QuarkXPress 2018 adds back the font sub menus on MacOS. The free update further adds new JavaScript methods and further improves stability, quality and performance.Read more

Most popular posts this week

  • How to discover the UDID of an iPad without having iTunes 46.00 views per day
  • See Everything Your Mac Printed 20.50 views per day
  • How to open older QuarkXPress Documents 12.00 views per day
  • 132 ppi? 72 dpi? 144? 264 ppi? What image resolution should you use for the new iPad with Retina display? 10.50 views per day
  • Where is the free QuarkXPress Document Converter? 9.00 views per day
  • Fantastic Color Guide for Printing Uncoated CMYK 8.83 views per day
  • The Correct Use of Apostrophes in Dates 8.67 views per day

Tags

Apple App Studio AVE Publishing Bootable Backup Business models color Digital Publishing eBooks El Capitan ePub exporting Flash Font html HTML5 HTML5 Publications images integration iPad iphone JavaScript layout long docs macOS OS X PDF printing QID Quark QuarkXPress QuarkXPress 7 QuarkXPress 8 QuarkXPress 9 QuarkXPress 10 QuarkXPress 2015 QuarkXPress 2016 QuarkXPress 2017 QuarkXPress 2018 Review Self Publishing tables text Tip Typography Video Tutorial
Proudly powered by WordPress | Theme: Doo by ThemeVS.
This website uses cookies to improve your experience on our website. By continuing to browse this site you are agreeing to our use of cookies. You can disable cookies in your browser settings at any time.Accept CookiePrivacy Policy