I have started doing one project to convert all quarkxpress document in PS file.
Below is the requirement what I want to do.
And see the code below what I have done it, I am not able to create SUCESS & FAILURE folder. Can any one let me know what is the problem.
set Source_folder to (choose folder with prompt "Choose the folders containing Quark Files" without invisibles) as string
tell application "Finder" to make new folder at Source_folder with properties {name:"SUCCESS"}
tell application "Finder" to make new folder at Source_folder with properties {name:"FAILURE"}
set Destination_Folder to choose folder with prompt "Please choose folder where you want to save PS files" as string
set total_file to count files in Source_folder
display dialog total_file
the parameter after at of make new folder should be file specifier, alias or Unicode text (not string)
this would be sufficient
set Source_folder to (choose folder with prompt "Choose the folders containing Quark Files" without invisibles)
tell application "Finder" to make new folder at Source_folder with properties {name:"SUCCESS"}
.
To avoid errors I recommend a subroutine, which creates the folder only if it doesn’t exist.
BTW: your way to count the files of a folder cannot work
try this
set Source_folder to (choose folder with prompt "Choose the folders containing Quark Files" without invisibles)
set successFolder to make_new_folder(Source_folder, "SUCCESS")
set failureFolder to make_new_folder(Source_folder, "FAILURE")
set Destination_Folder to choose folder with prompt "Please choose folder where you want to save PS files" as string
tell application "Finder" to set total_file to count (get document files of Source_folder)
display dialog total_file
on make_new_folder(theFolder, fName)
try
return ((theFolder as Unicode text) & fName) as alias
on error
tell application "Finder" to return (make new folder at theFolder with properties {name:fName}) as alias
end try
end make_new_folder
I am having two separate code one for missing font report and another for Quark to PS.
First is working fine, but it is generating the report for individual file. I want to generate the report for all files in a folder called “Source_folder”.
See the code below:
tell application "QuarkXPress"
activate
tell document 1
set Doc_Name to name
set Missing_Fonts to {}
set Font_List to font list
repeat with This_Font in Font_List
if ID of This_Font as number < 0 then
set end of Missing_Fonts to name of This_Font & return
end if
end repeat
set File_Path to file path as string
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set Parent_Path to (text items 1 thru -2 of File_Path as string) & ":"
set AppleScript's text item delimiters to ASTID
if Missing_Fonts is not {} then
set Missing_Fonts to Missing_Fonts as string
else
set Missing_Fonts to "No missing Fonts."
end if
my write_Report(Doc_Name, Missing_Fonts, Parent_Path)
end tell
end tell
on write_Report(Doc_Name, Missing_Fonts, Parent_Path)
set The_Report to Parent_Path & Doc_Name & "“Missing Fonts.txt"
try
open for access file the The_Report with write permission
write Missing_Fonts to file the The_Report starting at eof
close access file the The_Report
on error
close access file the The_Report
end try
end write_Report
Below code is for Quark to PS, but it is not working having some problem.
See Code Below:
tell application "Printer Setup Utility"
launch
set mylaserprinter to "Adobe PDF 8.0" -- Printer name
set current printer to first printer whose name is mylaserprinter
end tell
set source_folder to choose folder with prompt "Select folder containing QuarkXPress Documents"
set Output_folder to choose folder with prompt "Select folder to print PostScript to"
tell application "Finder" to set item_list to every item of source_folder
repeat with this_item in item_list
tell application "QuarkXPress"
open this_item use doc prefs yes remap fonts no do auto picture import no with reflow
set Doc_Name to name of the front document
set PS_filename to characters 1 thru -6 of Doc_Name & ".ps" as string
set PS_Path to (Output_folder as string) & PS_filename
tell print setup
set printer type to "AdobePDF 8.0"
end tell
print PostScript file PS_filename
close document 1 saving no --> or yes depending on personal preference
end tell
end repeat
Can any one look into it & suggest me what can I do and how can I join these two code. In my above code it is generating report for individual file, but I want a consolidated report in the Source_folder for all files in the folder.
Hi Pooja,
I’m not familiar with scripting Quark but I just tested the code above and if I have fonts active in the Users/Library/Fonts folder they’re showing with a -id and logging in the Missing_Fonts text file as missing when infact they’re active. Not sure if you’ve run into this problem yet but it might mean that you can’t check for fonts using the
Hi Pooja,
just had a play with that scripts and this seems to be working ok for so far.
set source_folder to choose folder
--set Output_folder to choose folder
set Missing_Fonts to {}
set masterFontNameList to {}
tell application "Finder" to set item_list to every item of source_folder
repeat with this_item in item_list
set doc_kind to kind of (info for this_item as alias)
if doc_kind contains "QuarkXPress" then
tell application "Finder" to set filepath to this_item as string
tell application "QuarkXPress Passport"
open the file filepath use doc prefs yes remap fonts no do auto picture import yes without reflo
tell document 1 to set Doc_Name to name
set masterFontList to font list
repeat with x from 1 to count masterFontList
set end of masterFontNameList to name of item x of masterFontList
end repeat
tell document 1 to set theDocumentFonts to font list
repeat with x from 1 to count theDocumentFonts
if name of item x of theDocumentFonts is not in masterFontNameList then
set end of Missing_Fonts to name of item x of theDocumentFonts & return
end if
end repeat
set Parent_Path to filepath
if Missing_Fonts is not {} then
set Missing_Fonts to Missing_Fonts as string
my write_Report(Doc_Name, Missing_Fonts, Parent_Path)
end if
close document 1 saving no
end tell
end if
end repeat
on write_Report(Doc_Name, Missing_Fonts, Parent_Path)
set The_Report to Parent_Path & "“Missing Fonts.txt"
try
open for access file the The_Report with write permission
write Missing_Fonts to file the The_Report starting at eof
close access file the The_Report
on error
close access file the The_Report
end try
end write_Report
How far have you got with the printing of PostScript?
Nik
Hi Rajeev
Thanks, I have checked that scripts but quark is get quit everytime as mention by Vaasu. I would like to share the code in this forum so that any one can respond on that.
property Quark_Types : {"XPRJ", "XDOC"}
set Input_Folder to choose folder with prompt "Choose folder has quark files" without invisibles
tell application "Finder"
set Quark_Files to files in Input_Folder whose file type is in Quark_Types
if (not (exists folder ((Input_Folder as string) & "SUCCESS"))) then
set Good_Folder to make new folder at Input_Folder with properties {name:"SUCCESS"}
else
set Good_Folder to folder ((Input_Folder as string) & "SUCCESS")
end if
if (not (exists folder ((Input_Folder as string) & "FAILURE"))) then
set Bad_Folder to make new folder at Input_Folder with properties {name:"FAILURE"}
else
set Bad_Folder to folder ((Input_Folder as string) & "FAILURE")
end if
end tell
--set Output_folder to choose folder with prompt "Select folder to print PostScript to"
tell application "Finder" to set item_list to every file of Input_Folder
tell application "QuarkXPress"
repeat with this_item in item_list
open this_item use doc prefs yes remap fonts no -- do auto picture import no
set Doc_Name to name of the front document
set PS_Path to (Good_Folder as string) & Doc_Name & ".ps" as string
(*tell print setup
set printer type to "AdobePDF 7.0"
end tell*)
tell document 1
print PostScript file PS_Path
delay 15
close saving no
end tell
--close front document saving no --> or yes depending on personal preference *)
end repeat
end tell
In the source_folder some file is having missing fonts and some file is not having missing fonts. If the file is having any font missing then the file should move to FAILURE folder and generate a missing font report with the file name. And if the file is not having any font missing, then the file should move in the SUCCESS folder and generate a PS file in output_folder.