Applescript to deal with diacritics

Discuss AppleScripting for QuarkXPress 10, 9 & 8 (and before)
rgbherman
Posts: 0
Joined: 15 Jan 2007, 14:37

Applescript to deal with diacritics

Post by rgbherman » 01 Mar 2013, 06:39

Yes, all search characters in the script are in the Diacritical font. The script will be searching ONLY in that font.
Our typesetting modified the original diacritical font for efficiency using Fontographer I think so that the standard keyboard for Diacritical that we used is not standard. We cheated. So the lig character "fi" (one character) was used for an exotic diacritical.
To summarize, I have a list of letters in the diacritical font that need to be replaced. Replacement font doesn't matter because I am exporting the content out of Quark. The search font must be specified as Diacritical. Our wacky "solution" worked for years while the game was print only. Now we are taking the content into epub we have to make the switch.
Is this clear now?

rgbherman
Posts: 0
Joined: 15 Jan 2007, 14:37

Applescript to deal with diacritics

Post by rgbherman » 01 Mar 2013, 07:06

Not sure my reply was sent properly so resending.
We modified in-house the diacritical font (only to make room for exotic diacritics that were not available in the standard keyboard) for efficiency. Worked great for years while the game was print. Now we need to export content out of Quark for epub and these characters have come back to haunt us.
So search font is always Diacritical. It is not every character in the font. In the example I gave you I was trying show that the word "first", in lets say Garamond, is correct (ligature for fi) but this character was used in the diacritical font for the e with a special diacrit. Can't search/replace the one without the other if all characters are in the same font.
In sum: have to search in Diacritical font, replace with a new character. As many as several dozen characters. Will immediately export out of Quark. Many, many old files that want to be in ebooks. Everyone happy.

rgbherman
Posts: 0
Joined: 15 Jan 2007, 14:37

Applescript to deal with diacritics

Post by rgbherman » 01 Mar 2013, 07:22

Example--
From Quark document as pastes:
MarienbadMarinsk Lzne, Czech Republic.


The way it appears in our Quark doc and needs to export"
MarienbadMarinsk Lzne, Czech Republic.

This happened in the past because we messed with the font (as I said orked great for years) and we need to fix it in this new e-environment.

Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

Applescript to deal with diacritics

Post by Jean-Marie Schwartz » 04 Mar 2013, 06:03

Sorry! I'm not forgetting about you, it's just that I have other jobs to honor prior to this one. If you can still wait. If not, I'll try to work on it tomorrow.

rgbherman
Posts: 0
Joined: 15 Jan 2007, 14:37

Applescript to deal with diacritics

Post by rgbherman » 04 Mar 2013, 08:12

I am very grateful for your help. I am happy to wait. When it is convenient, I look forward to picking this up.

Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

Applescript to deal with diacritics

Post by Jean-Marie Schwartz » 05 Mar 2013, 02:31

Please can you give this code a shot?
propertyTheSearchList: {"`", "", ""} -- here is the list of every glyph you'll want to be changed
propertyTheReplaceList: {"", "", ""} -- here is the list of every new glyph accordingly


tellapplication"QuarkXPress95"
telldocument1
telleverystory
setmy_listtoobject referenceofeverytext style range[b]whosefont[b]is"Diacritical"
[b]setx[b]tolength[b]ofmy_list
[b]repeat[b]withi[b]fromx[b]to1[b]by-1
[b]setthe_text_to_be_replaced[b]toitemi[b]ofmy_list
tellthe_text_to_be_replacedsetfontto"Times New Roman"setcontentstomyReplaceChars(the_text_to_be_replaced)endtellendrepeatmyBip(2)endtellendtellendtellonReplaceChars(the_text_to_be_replaced)ifthe_text_to_be_replacedisinTheSearchListthensetCharOffsettooffsetofthe_text_to_be_replacedinTheSearchListasstringsetTheNewChartoitemCharOffsetinTheReplaceListreturnTheNewCharendifendReplaceCharsonBip(x)beepxendBip

rgbherman
Posts: 0
Joined: 15 Jan 2007, 14:37

Applescript to deal with diacritics

Post by rgbherman » 05 Mar 2013, 11:54

In the interest of thoroughly disclosing, I am running/testing in 8.5.1 so I changed to "tell application "QuarkXPress". The techs who will use this script will be running 9.
The script returned this error: error "QuarkXPress got an error: Cant make some data into the expected type." number -1700 to item
Also the word "contents" in this line was highlighted: set contents to my ReplaceChars(the_text_to_be_replaced)

Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

Applescript to deal with diacritics

Post by Jean-Marie Schwartz » 05 Mar 2013, 20:49

Hum! It works like a charm here with my config (QuarkXPress 9.5, OS 10.6.8). I shall dig a bit deeper later on. In the meantime can you have the script tested by the techs running v9?
EDIT: It is part of Scripting Addition osax. Can you check wether it is or not installed on your machine?

rgbherman
Posts: 0
Joined: 15 Jan 2007, 14:37

Applescript to deal with diacritics

Post by rgbherman » 06 Mar 2013, 11:48

I am running Quark 8.5.1. I ran the script on the 9.5 computer with the exact error message and highlighted word in the line of script.
I consulted network admin (a mac guy...) and he said that both computers had OSX (10.6.8) and the applescript is built in. So he did not think there could be some sort of functionality missing in our Applescript program. If this is some special Applescript add-on that doesn't load with the OS, perhaps you could point me in the right direction...
Your code looks great. Any additional thoughts on how to get it to run here?

Jean-Marie Schwartz
Posts: 1174
Joined: 23 Nov 2004, 04:30

Applescript to deal with diacritics

Post by Jean-Marie Schwartz » 06 Mar 2013, 23:37

Then can you try again appending "of it" (without quotes) after the word contents?
It's always hard to troubleshoot that kind of thing when everything's OK on coder end. Maybe someone else would know the reason why it's not working on your side.

Post Reply

Return to “QuarkXPress 8, 9 & 10: AppleScript”