How can I modify this script to have a drag’n drop one?
set this_file to choose file
try
tell application "Image Events"
launch
set this_image to open this_file
copy the dimensions of this_image to {xres, yres}
close this_image
end tell
set px_cm to 0.026458333
set x_cm to xres * px_cm
set y_cm to yres * px_cm
display dialog "Pixel: " & xres & " X " & yres & "
Cm: " & x_cm & " X " & y_cm
on error error_message
display dialog error_message
end try
I’ve tried to change the first line with “on open this_file” but it doesn’t work. Where is the mistake?
Another thing… How can I hypen in the dialog box in another way?
Thanks
Model: macbook
AppleScript: 2.2
Browser: Safari 523.10
Operating System: Mac OS X (10.5)
on run
processFile(choose file)
end run
on open these_files
processFile(item 1 of these_files)
end open
on processFile(this_file)
try
tell application "Image Events"
launch
set this_image to open this_file
copy the dimensions of this_image to {xres, yres}
close this_image
end tell
set px_cm to 0.00313
set x_cm to xres * px_cm
set y_cm to yres * px_cm
display dialog "Pixel: " & xres & " X " & yres & "
Cm: " & x_cm & " X " & y_cm
on error error_message
display dialog error_message
end try
end processFile
What do you mean : How can I hypen in the dialog box in another way?
Using a return in a default answer has another useful effect (at least in Tiger – not running Leopard just now): whether there’s any text in the default answer or not, if there is a return (or several as above) in it the answer box will accept returns in the answer and the return key will not trigger the default button. For example:
set Ans to text returned of (display dialog "Enter your first name, last name separated by a return." & return & return & "Do not click on the text box below, just type your names." & return & return & "Use the return key to enter your answer, or click the \"Done\" button" default answer return & return buttons {"Done"} default button 1)
set {FN, LN} to paragraphs 1 thru 2 of Ans
Perhaps someone will confirm that this still works in Leopard.