• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Display PICT in DD?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display PICT in DD?


  • Subject: Re: Display PICT in DD?
  • From: Paul Welch <email@hidden>
  • Date: Wed, 3 Oct 2001 22:11:08 +0100

On Tue 2 Oct 2001 at 4:08 pm, email@hidden wrote:

>Am trying to give a user the ability to add information to the comments
>field of a folder full of image files. I turned to the osax Dialog Director
>to create several text fields for data entry. As a help for the user to be
>able to get the correct information to the right file, I have been trying to
>figure out how to use the PICT resource of the files to display in the
>dialog (in the same way the open dialogs present previews in other apps).
>The docs with DD refer to this but have been unable to figure out how to
>call to them.
>Does anyone know how this feature works? Is it possible? I have the picture
>placement in the syntax of the dialog, but am not sure what the "contents"
>should be or how to add.
>Any help would be greatly appreciated

I've recently been wrestling with similar problems, using Dialog
Director to build an app for writing IPTC caption info into Photoshop
files (I work for a newspaper).
The code below is an extract from the app, and is basically the
handler which extracts PICT resource info from a file and displays it
in the interface. I've wrapped it in a little Dialog Director
framework. It needs Tanaka's OSAX in addition to Dialog Director.
Hope it's of some use. (Where you see option-L, delete it and type
option-L, the continuation character)
Cheers,
Paul


set interfaceDialog to {size:[350, 200], name:"Pic Preview",
style:standard window, closeable:true, contents:[option-L
{class:push button, name:"Done", bounds:[250, 160, 330, 180]}, option-L
{class:push button, name:"Choose Pic", bounds:[250, 120, 330, 140]}]}

dd install with fonts [null, null, null, null, {name:"Chicago",
size:12}] with grayscale
set interface to dd make dialog interfaceDialog
try
repeat
set i to dd interact with user
if i = 1 then exit repeat
if i = 2 then
set thePic to (choose file with prompt
"Choose a picture file")
get_the_pict(thePic, interface)
end if
end repeat
on error
dd uninstall
end try
try
dd uninstall
end try

on get_the_pict(target_pic, interface)
try
dd set contents of item -1 of interface to ""
end try
try
set the_pict to MT Load Resource alias target_pic type "PICT"
set image_size to MT Pict Info the_pict
end try
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 (180 * (h / w))
dd make {class:pict, bounds:[10, 10, 180, (10 + h)],
contents:""} at interface
else
set w to (180 * (w / h))
dd make {class:pict, bounds:[10, 10, (10 + w), 180],
contents:""} at interface
end if
try
dd set contents of item -1 of interface to the_pict
end try
end get_the_pict


  • Prev by Date: script objects & multiple constructors
  • Next by Date: XC: Getting URL infomation from browser
  • Previous by thread: Re: Display PICT in DD?
  • Next by thread: open a Help Viewer book
  • Index(es):
    • Date
    • Thread