first of all, nice to be a part of this community
It is as it is. I have a question concerning a applescript I wrote to access QuarkXpress-documents to process them in a batch with the find and replace function of QuarkXPress.
System: OS X 10.7.5
Here is the applescript:
--choose directory containing quark files tell application "Finder" activate set source_folder to choose folder with prompt "Select folder:" set source_files to (files of entire contents of source_folder whose file type is "XPRJ") set source_files to sort source_files by name set source_files to (sort source_files by name) as alias list end tell --loop through quark documents set findString to "\\?\\?\\?,\\?\\? â‚¬" set replacestring to "000,00 â‚¬" tell application "QuarkXPress" activate repeat with i from 1 to length of source_files set quarkfile to item i of source_files open quarkfile as alias use doc prefs yes remap fonts no without reflow tell document 1 set (text of every story whose it is findString) to replacestring end tell save document 1 close document 1 saving no end repeat end tell
This applescript works as long as findstring is a plain text, but the findstring need to be “???,?? â‚¬” (Explanation: in Quark ? is a placeholder for 1 character (roughly like in a regex pattern!)).
I have to escape the backslash, because applescript uses the backslash itself as a escape character.
If I escape the backslash as you can see above in the applescript, I get the following result:
Applescript Error message box:
žQuarkXPress" found an error:can’t set ževery text of every story of document 1 whose it = “\?\?\?,\?\? â‚¬”" to ž"000,00 â‚¬"".
Results pane message:
error “žQuarkXPress” found an error:can’t set ževery text of every story of document 1 whose it = "\\?\\?\\?,\\?\\? â‚¬"" to ž"000,00 â‚¬"“.” number -10006 from every text of every story of document 1 whose it = “\?\?\?,\?\? â‚¬”
I tried everything to escape the backslash even with “ASCII character (92)” but with the same result.
Does anybody know what I am doing wrong or how I can use the placeholder pattern in QuarkXpress 8.5.1 find and replace via applescript?
I appreciate any help anyone can give.
Thanks in advance.
Model: Mac Pro (Early 2009)
Browser: Safari 537.36
Operating System: Mac OS X (10.7)