Re: Quark ps-file Thanks
Re: Quark ps-file Thanks
- Subject: Re: Quark ps-file Thanks
- From: Alberto Salvagnini <email@hidden>
- Date: Wed, 13 Jun 2001 18:31:59 +0100
is really nice to learn how many possibilieties we have :)
I was trying "fileIsBusy", it works but as soon as another application is running
at the same time (Acrobat Distiller for example) it takes too long time to create
the ps-file, so I get an error becouse the moving file command doesnot find the
file. Jason had another suggestion checking the status of the printer and it works,
slower but it works:
tell application "Desktop Printer Manager"
set statCheck to false
repeat while statCheck is false
delay 2
get queue status of the default printer
if result is idle then
set statCheck to true
end if
end repeat
ignoring application responses
quit
end ignoring
end tell
end tell
end tell
anyway My script finally works. One time I got the usual error (-48) on another
machine (shit happens :)).
Hier my script for enybody could need:
===============================
on open (docList)
set theDisk to (path to startup disk) as text
tell application "Desktop Printer Manager"
set the default printer to desktop printer "VirtalPrinter"
end tell
copy "" to logText
repeat with CurrentFile in docList
copy AppleScript's text item delimiters to oldtextDel
set AppleScript's text item delimiters to ":"
copy last text item of (CurrentFile as string) to FileName
set AppleScript's text item delimiters to oldtextDel
tell application "Finder"
copy creator type of CurrentFile to CreatorType
end tell
if CreatorType * "XPR3" then
copy logText & "FEHLER = " & FileName & "--> is not a Quark document!" & return
to logText
else
try
tell application "QuarkXPress 3.32r5"
activate
open CurrentFile use doc prefs yes remap fonts no do auto picture import no
tell document 1
if facing pages = false then --wenn die Doppelseiten angeklickt ist
set paper width of print setup to (page width as real) as string
else
set paper width of print setup to ((page width as real) * 2 + 20) as string
end if
set printer type of print setup to "Acrobat Distiller 4.0"
set reduce or enlarge of print setup to "100%"
set orientation of print setup to portrait
set resolution of print setup to 2400
set include blank pages of print setup to false
set font substitution of print setup to true
set print spreads of print setup to true
set registration marks of print setup to center
set use PDF screen values of print setup to true
set halftone screen of print setup to 100
end tell
set theDoc to name of document 1
print document 1 PostScript file (theDisk & "Desktop Folder:" & (theDoc as
string) & ".ps")
copy (theDisk & "Desktop Folder:" & (theDoc as string) & ".ps") to PsDokument
close document 1 saving no
copy AppleScript's text item delimiters to oldtextDel
set AppleScript's text item delimiters to ":"
copy last text item of (PsDokument as string) to PSFileName
set AppleScript's text item delimiters to oldtextDel
--delay bis die datei geschrieben ist
tell application "Desktop Printer Manager"
set statCheck to false
repeat while statCheck is false
delay 2
get queue status of the default printer
if result is idle then
set statCheck to true
end if
end repeat
ignoring application responses
quit
end ignoring
end tell
copy logText & "OK = " & FileName & " --> " & PSFileName & return to logText
end tell
on error
copy logText & "ERROR = " & FileName & "--> could not be printed!" & return to
logText
end try
end if
tell application "Finder"
move alias PsDokument to alias (theDisk & "Hot Folder:In:")
--delete alias PsDokument
--empty trash
end tell
end repeat
tell application "Finder"
copy the name of startup disk to diskName
if not (exists item (theDisk & "Report Folder")) then
make new folder at startup disk with properties {name:"Report Folder"}
end if
end tell
copy (open for access file (theDisk & "Report Folder:Report PDF") with write
permission) to fileRef
try
write logText starting at (get eof fileRef) + 1 to fileRef
close access fileRef
on error
close access fileRef
end try
end open
===============================
Greetings from Hamburg
Alberto
JJ schrieb:
>
> manual (without script): I can see how the computer writes the file
>
> * with script: it prints like with background printing: the script is over and
>
> the ps-file is still not ready !
>
> * and in this case I get problems if I want to move a big file to another
>
> place becouse
>
> * the script is too quick compared to the writing of the file (ok I could rate
>
> a delay but I not always know how big a ps-file will be)
>
>
Every computer is a different world.
>
If you want move your ps files when they are "ready", then you should use a
>
very simple command from Jon's Commands:
>
>
fileIsBusy alias
>
Result: boolean -- Whether the file is open or not.
>
>
I. e.
>
>
tell application "Finder"
>
set the_ps to alias "HD:Desktop Folder:your.ps"
>
set its_final_destination to alias "HD:Desktop Folder:Dest_folder:"
>
>
set move_file to false
>
>
repeat while move_file = false
>
if (fileIsBusy the_ps) = false then
>
set move_file to true
>
end if
>
end repeat
>
>
move the_ps to its_final_destination
>
end tell
>
>
It's better use two different scripts: the printer, and the ps-mover (an
>
action folder).
>
>
I'm running a OS 8.6, but I know that OS 9.x's standard additions include
>
the "busy status" of files, like an inherit from "get info for" (name,
>
locked, file type, creator type, busy...).
[demime 0.98b removed an attachment of type text/x-vcard which had a name of asalvagnini.vcf]