Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Illustrator won't direct print edited document with Applescript.

$
0
0

G'day

 

I've struck a problem where edited documents won't print using Applescript direct printing, instead generating a 'can't print illustration' error.

 

The error message is untrappable in Applescript.

 

My code, with the direct print commented out, is ...

 

Does anyone know how to direct print an edited document, please?

 

Regards

 

Santa

 

propertytheLargePagePrinter : "Quark Printer"

propertytempName : "test"

propertydiditPrint : false

propertyPreserveFileName : "This is the name part"

propertylargePaperSize : "A4"

myprintIllustrator()

 

onprintIllustrator()

  try

  setTempAttachmentNameto "(2015 03  05 121212Z)"

  tellapplication "Adobe Illustrator"

  try

  activate

  tellcurrent applicationtodelay 0.1

  setaddBarCodetofalse

  tellapplication "Finder"

  setmytempNameto "This is a test" astext

  endtell

  repeat 2 times

  try

  tellapplication "System Events" totellprocess "Adobe Illustrator"

  clickbutton "Continue" ofwindow 1

  endtell

  endtry

  endrepeat

  setxto 0

  repeatuntilexistsdocument 1

  setxtox + 1

  tellcurrent applicationtodelay 0.1

  endrepeat

  setaddBarCodetofalse

  ifmytempNamedoes notcontain "_UEI ftpSaving" thensetaddBarCodetotrue

  setpto 1

  ifaddBarCodethen

  setpto 1.1

  setbbtovisible boundsofdocument 1

  setpto 2

  setPaperSizetocrop marksofdocument 1

  setpto 3

  telldocument 1

  setpto 4

  setntonumberoflayers

  repeatwithxfrom 1 ton

  setpto 5

  setlockedoflayerxtofalse

  endrepeat

  endtell

  setpto 6

  #

  # Text Frame 1

  #

  makenewtext frameindocument 1 with properties {name:"AreaText", contents:TempAttachmentName, position:{(item 1 ofbb), ((item 2 ofbb) + 40)}}

  setpto 6.1

  try

  makenewcharacter styleindocument 1 with properties {name:"BarCodeBox"}

  endtry

  setpto 6.2

  setthesizeofcharacter style "BarCodeBox" ofdocument 1 to 10

  setpto 6.3

  apply character stylecharacter style "BarCodeBox" ofdocument 1 tothetext rangeoftext frame "AreaText" ofdocument 1

  setpto 6.4

  setthetext fontoftext rangeoftext frame "AreaText" ofdocument 1 totext font "IDAutomationHC39M"

  #

  # Text Frame 2

  #

  makenewtext frameindocument 1 with properties {name:"AreaTextTwo", contents:myPreserveFileName, position:{(item 1 ofbb), ((item 2 ofbb) + 21)}}

  setpto 7.1

  try

  makenewcharacter styleindocument 1 with properties {name:"NameBox"}

  endtry

  setpto 7.2

  setthesizeofcharacter style "NameBox" ofdocument 1 to 12

  setpto 7.3

  apply character stylecharacter style "NameBox" ofdocument 1 tothetext rangeoftext frame "AreaTextTwo" ofdocument 1

  setpto 7.4

  setthetext fontoftext rangeoftext frame "AreaTextTwo" ofdocument 1 totext font "Cochin"

  endif

  setpto 16

  try

  (*set printerName to my theLargePagePrinter as string

  set paperOptions to {class:paper options, name:largePaperSize}

  set jobOptions to {class:job options, designation:all layers} # , print options:printOptions}

  set colorOptions to {class:color management options, profile kind:printer profile, intent:perceptual}

  set flatOpts to {class:flattening options, clip complex regions:true, gradient resolution:360, rasterization resolution:360}

  set printOptions to {class:print options, printer name:printerName, paper settings:paperOptions, flattener settings:flatOpts, job settings:jobOptions, color management settings:colorOptions}

  #

  # If this can't print, the resultant dialog box is unreadable

  #

  print document 1 options printOptions

  on error errmsg number errnum

  tell application "System Events" to display dialog "Error in direct printing illustrator document. " & errmsg & " number " & errnum giving up after 40*)

  activate

  tellapplication "System Events" totellprocess "Adobe Illustrator"

  keystroke "p" usingcommand down

  tellcurrent applicationtodelay 0.4

  keystroke (character 1 of (mytheLargePagePrinterastext)) astext

  repeat 18 times

  keystroketab

  tellcurrent applicationtodelay 0.1

  endrepeat

  keystroke (character 1 of (mytheLargePagePrinterastext)) astext

  keystrokereturn

  endtell

  onerrorerrmsgnumbererrnum

  tellapplication "System Events" todisplay dialog "Error in printing illustrator document. " & errmsg& " number " & errnumgiving up after 40

  endtry

  tellcurrent applicationtodelay 0.5

  onerrorerrmsgnumbererrnum

  setmydiditPrinttofalse

  tellapplication "System Events" todisplay dialog "printIllustrator actual printing " & errmsg& return& errnum& " P = " & pgiving up after 40

  endtry

  endtell

  endtry

 

endprintIllustrator


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>