Info for issues: Converting EPS to AI script
Info for issues: Converting EPS to AI script
- Subject: Info for issues: Converting EPS to AI script
- From: "Grove, Brian" <email@hidden>
- Date: Fri, 26 Jan 2007 12:36:26 -0500
- Thread-topic: AppleScript-Users Digest, Vol 3, Issue 640
Good day,
I am a newbie and am having trouble getting my script to work ( on an OSX 10.4.7, dual PowerPC G5:
Hardware Overview:
Machine Name: Power Mac G5
Machine Model: PowerMac7,2
CPU Type: PowerPC 970 (2.2)
Number Of CPUs: 2
CPU Speed: 1.8 GHz
L2 Cache (per CPU): 512 KB
Memory: 1 GB
Bus Speed: 900 MHz
Boot ROM Version: 5.1.4f0.)
Concept:
We have Folder with many subfolders for our artwork. We used to use .eps files but now want to completely convert them to .ai for stability. The originally I had a dropitem script that worked, but new criteria demands that it has: user selected folders, checks to make sure the sourceFolder is not on network, works only for Illustrator .eps files (ART5), saves new .ai file in aiFolder, moves or duplicates skipped files into skipFolder
Known issues:
In conVert(sourceFolder), I am have trouble with the getting past a "set this_item to (item i of sourceFolder)" and "set item_info to the info for this_item."
Because of this, I have not been able to continue on to check my sub-routines.
I have read that OSX handles "info for" differently that OS9 and have tried the fixes I have found to no avail.
I have included my full script for reference and in case it can be hacked for other uses. I am guessing that I have missed some basic concept, but can't figure it out.
thanks in advance for any help,
B-
-- Illustrator EPS to AI Converter --
-- the list of file types which will be processed
-- eg: {"PICT", "JPEG", "GIFf", "TIFF"}
property type_list : {"EPSF"}
-- since file types are optional in Mac OS X,
-- check the name extension if there is no file type
-- NOTE: do not use periods (.) with the items in the name extensions list
-- eg: {"txt", "text", "jpg", "jpeg"}, NOT: {".txt", ".text", ".jpg", ".jpeg"}
property extension_list : {"eps"}
-- indicates file came from Illustrator
property app_type : {"ART5"}
global counter, sourceFolder, aiFolder, skipFolder, pathToSourceFolder
on run
display dialog "Welcome to the EPS to Illustrator AI converterer." & return & return & ¬
"Only EPS files are supported." buttons {"OK"} default button 1
set sourceFolder to choose folder with prompt "Which folder would you like to convert:"
set sourceFolder to sourceFolder as string
set pathToSourceFolder to sourceFolder as string
my checkSourcePath(pathToSourceFolder)
my display(pathToSourceFolder)
set aiFolder to choose folder with prompt "Choose AI destination folder:"
set aiFolder to aiFolder as string
my display(aiFolder)
set skipFolder to choose folder with prompt "Choose skipped files destination folder:"
set skipFolder to skipFolder as string
my display(skipFolder)
my conVert(sourceFolder)
end run
(* ========= This handler makes sure the sourceFolder is not located on the Network ========= *)
on checkSourcePath(pathToSourceFolder)
try
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":"}
set theDisk to (first text item of pathToSourceFolder)
set AppleScript's text item delimiters to oldDelims
if (theDisk is not "Work") then
error "This script can not be run on a file/folder located on the network."
end if
on error msg
my showError(msg)
end try
end checkSourcePath
-- This processes files or folders
on conVert(sourceFolder)
try
set counter to 0
repeat with i from 1 to the count of sourceFolder
set this_item to (item i of sourceFolder)
my display(this_item)
set item_info to the info for this_item
my display(item_info)
if (folder of the item_info is true) and ¬
(alias of the item_info is true) then
process_folder(this_item)
else if (alias of the item_info is false) then
process_item(this_item)
end if
end repeat
tell application "Finder"
activate
display dialog (the counter as string) & " items have been converted to Illustrator AIs." buttons {"Gracias!"} default button 1
end tell
on error msg
my showError("Something happened during conVert")
end try
end conVert
-- this sub-routine processes folders
on process_folder(this_folder)
try
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
process_folder(this_item)
else if (alias of the item_info is false) and ¬
((the file type of the item_info is in the type_list) or ¬
the name extension of the item_info is in the extension_list) then
process_item(this_item)
end if
end repeat
on error msg
my showError("Something happened in process_folder")
end try
end process_folder
-- this sub-routine processes files
on process_item(this_item)
-- NOTE that the variable this_item is a file reference in alias format
-- FILE PROCESSING STATEMENTS GOES HERE
try
tell application "Adobe Illustrator 10.0.3"
launch
if ((the file type of the item_info is in the type_list) or ¬
the name extension of the item_info is in the extension_list) and ¬
(the file this_item is type("ART5")) then
open this_item
save document 1 as Illustrator with options {compatibility:Illustrator 10, compressed:true, embed all fonts:true, PDF compatible:true} in aiFolder
else
move this_item to skipFolder
end if
close document 1 saving (no)
end tell
set counter to counter + 1
on error msg
my showError("Something happened in process_item")
end try
end process_item
on display(display_item)
display dialog "Item set to: " & (the display_item as string) ¬
buttons {"Gracias!"} default button 1 giving up after 7
end display
-- end finder tell
-- this handles formats error dialogs
on showError(msg)
display dialog msg buttons {"OK"} default button 1 with icon 0
end showError
Thanks,
Brian
*****
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden