To be, or CSV, that is the delimiter

From time to time I receive emails requesting support for some of the scripts that I offer through the site. Since InDesign began to support semicolon separated text files for data merge, one particular issue began to receive more requests than normal.

The emails were consistent in nature – users had downloaded the data merge single or pro script and ran the script on files they had prepared. Instead of users being able to select from the fields to the left, all of the fields appeared in one line.

This behaviour usually occurs when the script runs a data merge database that had a CSV extension, but was actually separated by semicolons rather than commas. I’d explain this back to the user and ask them to try a different CSV export from Excel, or use my preferred file export of UTF-16 text from Excel.

However, many users who had exported from Excel to CSV said that this did not change the issue and the problem persisted. Usually the problem was that – despite choosing CSV from Excel’s export options, the software was still using semicolons as a delimiter rather than commas. Luckily, exporting to UTF-16 text usually resolved the issue.

On that note, I was uncomfortable with this issue and tried to replicate an Excel export from CSV that would use semicolons as delimiters rather than commas, but I couldn’t replicate this behaviour. But then I stumbled across the following article.

In short, the article says that Excel uses the user’s locale to determine what delimiter to use for CSV files. In short, if you use a comma to separate a dollar value from cents rather than a full-stop, then a CSV will likely export with semicolon delimiters rather than commas.

Adjusting this setting is not so simple, especially for Mac users like me – the adjustment is to change a system preference that uses the appropriate currency format, but that changes lots of other related information, so this isn’t an option.

Ultimately, if you are using the data merge to single record script, and are doing so with data exported from Excel, I highly recommend that you do so with a UTF-16 Unicode Text format.

I’ll admit this was a phenomenon I was unfamiliar with, and somewhat frustrated that a file format that itself stands for comma separated variables – isn’t actually separated by commas but is in fact separated by semicolons… depending on what system locale your computer is set to and that Microsoft Excel obeys.

Highlighting the benefit of GREP… literally

I’m a fan of the GREP feature of the Find/Change dialog box in Adobe InDesign as it allows me to search for patterns of characters within text based on regular expressions.

As handy as this feature is, I always require assistance writing my GREP searches, just in case my patterns are either too greedy; or not greedy enough. For example, I have a GREP search to find duplicate entries and remove them, but in InDesign the only way to know if I have this correct is to press the Find Next button in the search.

A better way to identify if I have my GREP search correct is to see it in real-time. Luckily, text editors such as BB Edit have this feature.

InDesign’s latest rival, Affinity Publisher, not only has its own flavour of GREP, but also shows all results in the Find and Replace dialog box, though I have to click on each result in this dialog to see where they are.

But it would be great if InDesign highlight the GREPs ahead of time like these two applications. The good news is that it can, but it requires the GREP editor script from Peter Kahrel that has been featured on Colecandoo before.

Thanks to Peter’s GREP editor, I’m now able to see that in this example there are three search results and they are all highlighted.

This tool comes in very handy as it assists me to write more complicated GREP searches, such as this one that is looking for time formatting. This lets me know in real-time if my selection is selecting too much information, or not enough – and in this example, it isn’t enough as the times without the minutes aren’t getting selected.

As for longer, more complicated chains of GREP code, there are resources out there that have pre-baked search chains that other users have already submitted to sites such as RegExLib.com or the Treasures of GREP Facebook group.

Stop Press!

After this article was initially published, I was alerted to another InDesign javascript by Kerntiff Publishing System that has a similar behaviour to Affinity Publisher’s search. The script is called GREP Xtra.

There is also an additional script released in 2013 by Roland Dreger that performs as a combination between Peter Kahrel’s script and the InDesign user interface. That script is called Highlight GREP.

Page Size Lies

UPDATE 2021-10-08: Enfocus Pitstop has released an update that now resolves the error that was brought about by the update of Adobe Acrobat DC. However, I will leave the article posted for posterity.

Have you ever received a client’s InDesign file and sent it to PDF or print, only to measure the document and realise it is a different size to the one that was in InDesign’s document setup?

What could cause this issue to arise?

The page tool has been used

It is likely that at some stage between the initial creation of the file and receiving the file, at least one page size in the document has been changed using the page tool.

Preflight should tell me… right?

Well, that depends. If you are using either of InDesign’s default preflights (i.e. [Basic] or Digital Publishing) then preflight will not flag a warning.

I’ve discussed my frustrations with InDesign’s default preflights in Episode 19 over on the Colecandoo Youtube channel. However, if you are using a more comprehensive preflight such as the VIGC profiles, then this is detected as an issue:

More comprehensive preflights such as the VIGC profiles look for much more than InDesign’s default preflights e.g.:

As a side-note, the Document portion of the Preflight Profiles dialog box is also handy for authors who are making saddle stapled publications that must have page-counts in multiples of four (an issue I’ve faced several times) e.g.:

Or for larger offset publications where folded page signatures are likely to be prepared in minimum multiples of eight e.g.:

There are also scripts to highlight this

I’m working on a startup script that – upon export or print – should provide an alert dialog box warning that there are size discrepancies… but in the meantime there are some other scripts that work by providing alerts to a document’s page sizes, or a script hosted over on Kasyan Servetsky’s curated list that makes a list of the page sizes in a document (look for “Check all pages” once the link loads).

What I think would ultimately help everyone would be if the Document Setup window would change once page sizes in a document were no longer the same, such as this mockup e.g.:

Shortcut to rotate in fractions

A colleague of mine recently had a task of inserting lineart scans into an InDesign file and then rotating the images so that they were straight on the page.

During this process, he’d asked:

What’s the shortcut for rotating an image by a fraction of a degree?

While I can remember many of the shortcuts used in InDesign, I couldn’t remember a shortcut for this item, and after consulting my InDesignSecrets shortcut poster I realised that there isn’t one. There is a shortcut to increase the angle from 1 degree to 5, but not smaller increments… which I thought was something that people would have asked for by now.

For the task he was doing, he definitely needed one, otherwise the workflow was:

  1. Select the item to rotate;
  2. Go to the rotate tool;
  3. Type the fraction and click OK
  4. Check the result and if further adjustment was required, click back into the rotate tool and type a new fraction and try again until acceptable.

A shortcut would definitely make this easier.

Tomaxxi to the rescue

Luckily, one was easy to find online. Scripter Marijan Tompa (whom some may know by the name Tomaxxi) wrote an article on how to write such a script.

In my colleague’s case, the script only needed to be adjusted by changing the angle from 45 in Marijan’s example to 0.1 like so:

var myTrans = app.transformationMatrices.add({counterclockwiseRotationAngle:0.1});
var myObj = app.selection[0];
myObj.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.CENTER_ANCHOR, myTrans);

The script was saved as rotateAnticlockwise.jsx and added to the scripts. A second copy was made but this time adjusted from counterclockwise to clockwise like so:

var myTrans = app.transformationMatrices.add({counterRotationAngle:0.1});
var myObj = app.selection[0];
myObj.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.CENTER_ANCHOR, myTrans);<code>

This too was saved as rotateClockwise.jsx. and added to the scripts.

From here, my colleague could then go to the scripts palette and run the scripts as required.

Similarly, my colleague could make sure that scripts was checked from the quick apply menu.

And from here, go to quick apply by pressing Command + Return and typing the first few letters of the script. This choice would stay in the quick apply so need only be done once.

But the title of the article was a shortcut, so shortcuts had to be applied. That is easily done though by going to the Edit Menu and selecting Keyboard Shortcuts.

In the next dialog box, choose Scripts from the Product Area, navigate to the appropriate script, then place the cursor in the New Shortcut text field in the bottom right and press the keys to become the new shortcut. If the type beneath says [unassigned] it means it won’t interfere with other shortcuts, so click Assign. Do the same for both scripts, choosing different shortcuts for both.

Done. My colleague now had his shortcuts and could rotate the images without having to keep moving his cursor to the rotate panel and manually key in entries.

Given the scripts now had their own shortcuts, these were also visible in the scripts panel, just in case my colleague forgot what the shortcuts were.

But importantly because shortcuts were assigned, they could also be hot-keyed to his ergonomic mouse. Similarly, the commands could be hot-keyed to other inputs such as those discussed in a previous article.

On that note, I thought a shortcut like this would exist, given the amount of other shortcuts that allow for nudging/moving in smaller units. What are your thoughts? Let me know in the comments whether this is a specific use-case, or something to be pursued over at the InDesign suggestions.

%d bloggers like this: