Author Topic: Loading scripts Handlers  (Read 4814 times)

0 Members and 1 Guest are viewing this topic.

Offline larsen67

  • Sr. Member
  • ****
  • Posts: 459
  • Karma: 10
  • Gender: Male
Re: Loading scripts Handlers
« Reply #10 on: June 14, 2007, 03:40:56 AM »
Ah, now I find don't use smileys. Your quite correct as usual. I have had another look at the bleed thing and this now works as I wanted it to with the exception of setting as list.

001   tell application "QuarkXPress"
002        activate
003        tell document 1
004             -- set integer eg (3) for symmetric & list ({5, 4, 3, 2}) for asymmetric
005             my Bleeds({5, 4, 3, 2})
006        end tell
007   end tell
008   
009   using terms from application "QuarkXPress"
010        on Bleeds(|bleed|)
011             tell application "QuarkXPress"
012                  tell document 1
013                       if class of |bleed| is list then
014                            tell custom bleeds setup 1
015                                 set bleed type to asymmetric
016                                 set bleed to |bleed|
017                                 set bleed clipping to true
018                            end tell
019                       else
020                            tell custom bleeds setup 1
021                                 set bleed type to symmetric
022                                 set bleed to |bleed|
023                                 set bleed clipping to true
024                            end tell
025                       end if
026                  end tell
027             end tell
028        end Bleeds
029   end using terms from

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: Loading scripts Handlers
« Reply #11 on: June 14, 2007, 08:32:28 AM »
Ah, now I find don't use smileys. Your quite correct as usual. I have had another look at the bleed thing and this now works as I wanted it to with the exception of setting as list.

Not sure what you mean by that sorry.
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline larsen67

  • Sr. Member
  • ****
  • Posts: 459
  • Karma: 10
  • Gender: Male
Re: Loading scripts Handlers
« Reply #12 on: June 14, 2007, 11:39:00 AM »
What I meant was if I try shorten any apply like this then it fails.

001   tell application "QuarkXPress"
002        activate
003        tell document 1
004             my Bleeds({5, 4, 3, 2})
005        end tell
006   end tell
007   using terms from application "QuarkXPress"
008        on Bleeds(|bleed|)
009             tell application "QuarkXPress"
010                  tell document 1
011                       if class of |bleed| is list then
012                            set custom bleeds setup 1 to {bleed type:asymmetric, bleed:|bleed|, bleed clipping:true}
013                       else
014                            set custom bleeds setup 1 to {bleed type:symmetric, bleed:|bleed|, bleed clipping:true}
015                       end if
016                  end tell
017             end tell
018        end Bleeds
019   end using terms from

BTW my testing script for using this loading handlers is working fantastic… Thanks very much for the help.

Offline larsen67

  • Sr. Member
  • ****
  • Posts: 459
  • Karma: 10
  • Gender: Male
Re: Loading scripts Handlers
« Reply #13 on: June 15, 2007, 08:49:06 AM »
Well I've managed to make some ground this week. This is has only run some basic tests but I think in principle is getting there and is much improved over what I was doing before.

001   property myPrintSetups : load script ((path to library folder as Unicode text) & "Scripts:Handlers:Printing Set Ups 2.scpt" as text) as alias
002   property myPrint : load script ((path to library folder as Unicode text) & "Scripts:Handlers:Printing.scpt" as text) as alias
003   property myDistill : load script ((path to library folder as Unicode text) & "Scripts:Handlers:Distill.scpt" as text) as alias
004   
005   property RunCount : 0
006   property LastRun : ""
007   property LastError : ""
008   
009   -- Check the loaded scripts version numbers are correct if "NOT" don't run…
010   if my myPrintSetups's VerNum is not 1.0 then
011        set LastError to "Incorrect version of Printing Set Ups Script"
012        error "Incorrect version of Printing Set Ups Script"
013   else if my myPrint's VerNum is not 1.0 then
014        set LastError to "Incorrect version of Printing Script"
015        error "Incorrect version of Printing Script"
016   else if my myDistill's VerNum is not 1.0 then
017        set LastError to "Incorrect version of Distill Script"
018        error "Incorrect version of Distill Script"
019   end if
020   
021   -- File paths to folder locations
022   property PS_Folder : (path to desktop as Unicode text) & "Press PDF's:In:" as text
023   property PDF_Folder : (path to desktop as Unicode text) & "Press PDF's:Out:" as text
024   property DJO_Folder : (path to desktop as Unicode text) & "Press PDF's:Settings:" as text
025   property LOG_Folder : (path to desktop as Unicode text) & "Press PDF's:Logs:" as text
026   
027   -- Acrobat Job Option names
028   property JobOptions : "Press Quality(1).joboptions" as text
029   
030   tell application "QuarkXPress"
031        activate
032        set |name of document| to name of document 1
033        tell document |name of document|
034             set |width| to ((width of bounds of page 1) as millimeter units) as real
035             set |height| to ((height of bounds of page 1) as millimeter units) as real
036             set |count of pages| to count of pages
037             -- Create empty lists for later processes
038             set |PostScript list| to {}
039             -- Set print set up
040             -- Width(i,r), Height(i,r), Spreads(b), Colour Space(c), Resolution(i), Screen(i)
041             my myPrintSetups's PS_printSetUp(|width|, |height|, false, composite CMYK, 2400, 400)
042             try
043                  repeat with i from 1 to |count of pages|
044                       tell page i
045                            if i mod 2 = 0 then -- Even (right of spread)
046                                 -- Set custom bleeds setup 1
047                                 -- set (ir) for symmetric, ({T, L, B, R}) list as (i,r) for asymmetric
048                                 my myPrintSetups's Bleeds({3, 0, 3, 3})
049                            else
050                                 my myPrintSetups's Bleeds({3, 3, 3, 0}) -- Odd (left of spread)
051                            end if
052                            set fileNum to ""
053                            repeat until (length of (fileNum as text)) = (length of (|count of pages| as text))
054                                 if fileNum = "" then
055                                      set fileNum to i
056                                 else
057                                      set fileNum to "0" & fileNum
058                                 end if
059                            end repeat
060                            set FilePath to PS_Folder & |name of document| & "_Page_" & fileNum & ".ps"
061                            copy (FilePath as text) to end of |PostScript list|
062                            print PostScript file FilePath
063                       end tell
064                       delay 10
065                  end repeat
066             end try
067        end tell
068   end tell
069   --
070   set mySettings to DJO_Folder & JobOptions as text
071   
072   -- sourcePath(t) or sourcePaths(l), destinationPath(t), adobePDFSettingsPath(t)
073   my myDistill's Distiller(|PostScript list|, PDF_Folder, mySettings)
074   
075   -- Record the current printer & set to new printer choice
076   set PreviousPrinter to my myPrint's setPrinter("DC_3535_DC3535_Print")
077   
078   -- Run Acrobat Print Script (just got to put this together)
079   
080   -- Set the printer back to the recorded printer
081   my myPrint's ResetPrinter(PreviousPrinter)
082   
083   set RunCount to RunCount + 1
084   set LastRun to current date

I still need to sort some error trapping with the bleeds yet.

001   property VerNum : 1.0
002   property RunCount : 0
003   property LastCall : ""
004   property LastError : ""
005   --
006   using terms from application "QuarkXPress"
007        -- Set up the front Quark document for printing to postscript files
008        on PS_printSetUp(|width|, |height|, |print spreads|, |print colors|, |resolution|, |halftone screen|)
009             -- Check the classes of suppiled parameters
010             if class of |width| is in {integer, real} and class of |height| is in {integer, real} and class of |print spreads| is boolean and class of |print colors| is constant and class of |resolution| is integer and class of |halftone screen| is integer then
011                  try
012                       tell application "QuarkXPress"
013                            tell document 1
014                                 set print setup to {separation:false, print spreads:|print spreads|, collate:false, include blank pages:true, print thumbnails:false, back to front:false, page sequence:all pages, registration marks:centered, registration marks offset:8.504, tiling:off, absolute overlap:false, printer type:"Adobe PDF", paper size:"Custom", paper width:(|width| + 20) as millimeter units, paper height:(|height| + 20) as millimeter units, reduce or enlarge:100, fit in area:false, page position:center position, orientation:portrait, paper offset:0, page gap:0, print colors:|print colors|, resolution:|resolution|, halftone screen:|halftone screen|, flip horizontal:false, flip vertical:false, invert image:false, print quality:normal, data format:binary data, full res rotated objects:false}
015                            end tell
016                       end tell
017                  on error
018                       set LastError to "PS print setup failed."
019                       error "PS print setup failed."
020                  end try
021             else
022                  set LastError to "The PS parameters are incorrect."
023                  error "The PS parameters are incorrect."
024             end if
025        end PS_printSetUp
026        -- Set up the front Quark document for printing to Xerox 3535
027        on Xerox_printSetUp(|print spreads|, |paper size|, |reduce or enlarge|, |fit in area|, |orientation|, |print colors|)
028             -- Check the classes of suppiled parameters
029             if class of |width| is in {integer, real} and class of |height| is in {integer, real} and class of |print spreads| is boolean and class of |print colors| is constant and class of |resolution| is integer and class of |halftone screen| is integer then
030                  try
031                       tell application "QuarkXPress"
032                            tell document 1
033                                 set print setup to {separation:false, print spreads:|print spreads|, collate:false, include blank pages:true, print thumbnails:false, back to front:false, page sequence:all pages, registration marks:centered, registration marks offset:8.504, tiling:off, absolute overlap:false, printer type:"Xerox DocuColor3535", paper size:|paper size|, reduce or enlarge:|reduce or enlarge|, fit in area:|fit in area|, page position:center position, orientation:|orientation|, paper offset:0, page gap:0, print colors:|print colors|, resolution:1200, halftone screen:100, flip horizontal:false, flip vertical:false, invert image:false, print quality:normal, data format:binary data, full res rotated objects:false}
034                            end tell
035                       end tell
036                  on error
037                       set LastError to "Xerox print setup failed."
038                       error "Xerox print setup failed."
039                  end try
040             else
041                  set LastError to "The Xerox parameters are incorrect."
042                  error "The Xerox parameters are incorrect."
043             end if
044        end Xerox_printSetUp
045        -- Set custom bleeds setup 1
046        -- set (ir) for symmetric, ({T, L, B, R}) list as (i,r) for asymmetric
047        on Bleeds(|bleed|)
048             try
049                  tell application "QuarkXPress"
050                       tell document 1
051                            if class of |bleed| is list then
052                                 tell custom bleeds setup 1
053                                      set bleed type to asymmetric
054                                      set bleed to |bleed|
055                                      set bleed clipping to true
056                                 end tell
057                            else
058                                 tell custom bleeds setup 1
059                                      set bleed type to symmetric
060                                      set bleed to |bleed|
061                                      set bleed clipping to true
062                                 end tell
063                            end if
064                       end tell
065                  end tell
066             on error
067                  set LastError to "Custom bleeds setup 1 failed."
068                  error "Custom bleeds setup 1 failed."
069             end try
070        end Bleeds
071        -- Set custom bleeds setup 1
072        -- set (ir) for symmetric, ({T, L, B, R}) list as (i,r) for asymmetric
073        on EPS_Bleeds(|bleed|)
074             try
075                  tell application "QuarkXPress"
076                       tell document 1
077                            if class of |bleed| is list then
078                                 tell custom bleeds setup 1
079                                      set EPS bleed type to asymmetric
080                                      set EPS bleed to |bleed|
081                                      set bleed clipping to true
082                                 end tell
083                            else
084                                 tell custom bleeds setup 1
085                                      set EPS bleed type to symmetric
086                                      set EPS bleed to |bleed|
087                                      set bleed clipping to true
088                                 end tell
089                            end if
090                       end tell
091                  end tell
092             on error
093                  set LastError to "EPS Custom bleeds setup 1 failed."
094                  error "EPS Custom bleeds setup 1 failed."
095             end try
096        end EPS_Bleeds
097   end using terms from
098   --
099   set RunCount to RunCount + 1
100   set LastCall to current date

Offline EricGagnon

  • Visitor
  • Posts: 2
  • Karma: 0
Re: Loading scripts Handlers
« Reply #14 on: July 09, 2007, 11:30:06 AM »
You can also give a look to http://applemods.sourceforge.net/

I dont like very much the "scripting server" application showing up in the toolchest when loading the libraries, but i think it's a nice framework to work with...

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: Loading scripts Handlers
« Reply #15 on: July 09, 2007, 12:36:37 PM »
Hi Eric and welcome to this forum

Funny seeing you here, what ever brought you in our midst?
« Last Edit: July 09, 2007, 12:38:24 PM by Publi-Script »
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline larsen67

  • Sr. Member
  • ****
  • Posts: 459
  • Karma: 10
  • Gender: Male
Re: Loading scripts Handlers
« Reply #16 on: July 10, 2007, 07:56:37 AM »
I recognize the name from the Adobe Photoshop forum Im sure?

Offline EricGagnon

  • Visitor
  • Posts: 2
  • Karma: 0
Re: Loading scripts Handlers
« Reply #17 on: July 13, 2007, 02:55:12 PM »
Yes, i'm also using Adobe's forums...

I noticed the creation of this forum when Quark's one had problems... I dont have alot of time for posting, but try to keep a eye on the forums.. (to look out for solutions or learn new stuff).

I have have done alot of developpement with applescript/Indesign over the last two weeks...

Offline rayl

  • Newbie
  • *
  • Posts: 16
  • Karma: 0
  • Gender: Male
    • totalworks
Re: Loading scripts Handlers
« Reply #18 on: July 16, 2007, 06:43:26 AM »
For one reason or another, many of us are forced to develop for InDesign and other Adobe products. Ah yes they run on Windows too. So we are forced to develop with Javascript.
Raymond Lareine • MacBook CoreDuo • Mac OS 10.6.8 • Totalworks (retired)