(I’ve sent a similar mail to ASUL, but I wanted to add some background here).
Last year, @ShaneStanley wrote a wonderful Illustrator script that has helped me tremendously for work. The original script was written on an Adobe support forum, in Javascript, but Shane greatly improved it’s functionality, and most importantly wrote it in AppleScript .
Basically, it extracts all the text boxes contents to variables and I can then save the variables to XML, translate them and the open the new variable list to have the translation automatically be reflected in the text boxes. If you know people in the translation industry, let them know that’s the way to got (I wish InDesign could be dealt with that way but it seems way more complex).
Anyway, I had a 24 pages layout to translate, with about 950 text boxes and the script took 2 hours to complete, taking an average 7 seconds for each box.
So, I’m wondering what would be the way to drastically improve the performance of that script…
On Jan 23, 2017, at 7:18, Shane Stanley sstanley@myriad-com.com.au wrote:
On 23 Jan 2017, at 1:51 am, Jean-Christophe Helary jean.christophe.helary@gmail.com wrote:
The process is a bit slowYou can probably speed it up a bit by either running it from AI’s menu, or wrapping it in a script object:
script addVariables
tell application id "com.adobe.illustrator" -- Adobe Illustrator
tell document 1
set theSel to selection
my addVariablesFor:theSel
end tell
end tell
on addVariablesFor:listOfItems
tell application id "com.adobe.illustrator" -- Adobe Illustrator
tell document 1
repeat with anItem in listOfItems
set theClass to class of anItem
if theClass is text frame then
set theVar to make new variable at end with properties {kind:textual}
set anItem's content variable to theVar
else if theClass is group item then
(my addVariablesFor:(page items of anItem))
end if
end repeat
end tell
end tell
end addVariablesFor:
end script
tell application id "com.adobe.illustrator" -- Adobe Illustrator
run script addVariables
end tell