DD display PICT in dialog 2
DD display PICT in dialog 2
- Subject: DD display PICT in dialog 2
- From: email@hidden
- Date: Mon, 22 Oct 2001 09:32:00 -0500
Thanks to some great input from the list, particularly Paul and Havard
(special thanks guys), I have assembled a working engine that will allow
users to select a folder of images and add comments to each one in sequence
with the PICT preview as a reference. I ran into a snag in the test/debug
phase. While some of the model scripts I used handle EPS files just fine,
mine seems to handle every other file except EPS. It chokes out with a
Finder "out of memory" error or "dialog item 000 got an error: out of
memory". The differences I have noticed in research are that EPS files seem
to have 2 PICT res' to call from. Other than possibly not being able to
resolve which PICT to use, I can't think of a reason this won't work. What
am I missing?
Kevin
--Comment Images Script--
on run
tell application "Finder"
activate
set theFldr to (choose folder with prompt "Select the folder of
images for data entry:")
set theFiles to every file of theFldr
repeat with thisItem in theFiles
if (label index of thisItem) = 2 then
set theList to (files of theFldr whose label index 2)
exit repeat
else if (label index of thisItem) 2 then
set (label index of thisItem) to 0
set theList to theFiles
end if
end repeat
set filesNotDone to false
repeat with anItem in theList --from 1 to (count of theList)
try
set thePict to MT Load Resource alias anItem type "PICT"
set image_size to MT Pict Info thePict
set w to item 1 of image_size
set h to item 2 of image_size
if w is greater than or equal to h then
set h to (120 * (h / w))
set r to {10, 10, 120, (10 + h)}
else
set w to (120 * (w / h))
set r to {10, 10, (10 + w), 120}
end if
set theDialog to {size:{400, 150}, style:movable dialog,
closeable:true, name:"Enter DMS Values for this Image", default item:8,
contents:{,
{class:pict, bounds:{r}, contents:thePict}, ,
{class:text field, bounds:{212, 14, 381, 30}, value:""},
,
{class:static text, bounds:{148, 14, 208, 30},
contents:"Dept #"}, ,
{class:text field, bounds:{212, 48, 381, 64}, value:""},
,
{class:text field, bounds:{213, 82, 382, 98}, value:""},
,
{class:static text, bounds:{148, 49, 208, 65},
contents:"MIC #"}, ,
{class:static text, bounds:{149, 83, 209, 99},
contents:"Style #"}, ,
{class:push button, bounds:{315, 119, 381, 139},
name:"OK"}, ,
{class:push button, bounds:{230, 119, 304, 139},
name:"Cancel"}, ,
{class:push button, bounds:{149, 119, 223, 139},
name:"Reset"}}}
set dLogVals to dd auto dialog theDialog with fonts
{name:"Charcoal", size:12} with grayscale
if item 8 of dLogVals then
set theVals to dLogVals
set theDeptNum to text item 2 of theVals
set theMICNum to text item 4 of theVals
set theStyleNum to text item 5 of theVals
set comment of anItem to "Dept" & theDeptNum & ", " & ,
"MIC" & theMICNum & ", " & "Style" & theStyleNum
set label index of anItem to 2
beep 1
else if item 9 of dLogVals then
set filesNotDone to true
exit repeat
end if
on error errMsg number errNum
display dialog errMsg & "
" & errNum
set filesNotDone to true
end try
end repeat
if filesNotDone is true then
display dialog "The DMS tagging for this folder is incomplete,
please complete data entry before upload."
else
display dialog "The image files for this folder have been
tagged. Please notify the Database Administrator when files are uploaded."
set label index of theFldr to 2
end if
end tell
end run
--