Subject: | |
From: | |
Reply To: | |
Date: | Wed, 22 Aug 2007 17:15:08 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On 8/22/07 3:10 PM, Levon Spradlin wrote:
> I am trying to update an OS 9 script for Quark to use in OS X. I think I
> have the general idea down, but I know I am missing a few details. This
> script is supposed to check for images that are out of the 85-100% range and
> drop them into a sub-folder to correct. I have it working to the point of
> getting the Quark files and opening, then closing. What I am having trouble
> with is getting the script to communicate to the Finder that a new folder
> needs to be created if the files are out of the range. I am also having
> trouble updating the syntax to get the scale of the images in picture boxes.
>
> If anyone has a bit of guidance, I would really appreciate it.
>
> thanks,
> Levon
>
> [applescript]
[snip]
> [/applescript]
The following version has a number of fixes that I felt were needed for
syntax and/or style. See if it works for you. You can compare the two
scripts to see what's different. Hopefully the changes and reasons for them
are somewhat obvious.
Stan C.
[applescript]
(**
This script does the following:
Open a folder and check the contents for Quark files
See if any art placed in picture boxes in Quark is less than 85% or greater
than 100%
Close without saving
Place these items in a sub-folder to manually correct
**)
set FileSample to (choose folder) as text
--set folderName to name of (info for FileSample)
tell application "Finder"
set theFiles to files of folder FileSample whose name extension is in
{"qxd"} or kind contains "QuarkXPress" or file type is in {"XPRJ", "XPR3"}
end tell
repeat with oneFile in theFiles
set oneFile to oneFile as text
set needsAdjustment to false
tell application "QuarkXPress"
activate
open file oneFile
tell front document
set docName to name
repeat with i from 1 to count of picture boxes
--try
set theScale to scale of image 1 of picture box i as list
set thisScale to (item 1 of theScale)
--set imagePath to file path of image 1 of picture box i
--set imageName to my pathName(imagePath)
set thisScale to thisScale as real
if thisScale is less than 85 or thisScale is greater than
100 then
set needsAdjustment to true
end if
--end try
end repeat
close saving no
end tell
end tell
if needsAdjustment then
tell application "Finder"
if not (exists folder (FileSample & "Incorrectly Scaled
Files:")) then
make new folder at folder FileSample with properties
{name:"Incorrectly Scaled Files"}
end if
move file oneFile to folder (FileSample & "Incorrectly Scaled
Files:")
end tell
activate
with timeout of 3600 seconds
display dialog "There are files out of scale range in the folder
'Incorrectly Scaled Files.' Please manually fix the files and then re-run
this script."
end timeout
end if
end repeat
[/applescript]
|
|
|