Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display dialog with image




Le 25 févr. 2006, à 10:48, Christian Vinaa a écrit :

on open
tell application "Finder"
set TheList to selection
end tell
repeat with x in TheList
tell application "Preview"
open x
set myResult to display dialog "Keep or delete picture ?" buttons {"Keep", "Delete"} default button 2 with icon note
set buttonAnswer to button returned of myResult
if buttonAnswer is "Keep" then
tell application "System Events"
tell process "Preview"
click menu item "Luk" of menu "Arkiv" of menu bar 1
--type "w" holding command
end tell
end tell
else if buttonAnswer is "Delete" then
tell application "Finder"
set label index of x to 7
end tell
tell application "System Events"
tell process "Preview"
click menu item "Luk" of menu "Arkiv" of menu bar 1
--type "w" holding command
end tell
end tell
end if
end tell
end repeat
end open




Thanks Christian but your code is version specific.

I don't know the english wording but in french,
Luk = Fermer
Arkiv = Fichier

So the script must be changed for every localised version.

It is easy to edit it to give an universal code:

on open
tell application "Finder"
set TheList to selection
end tell
repeat with x in TheList
tell application "Preview"
open x
set myResult to display dialog "Keep or delete picture ?" buttons {"Keep", "Delete"} default button 2 with icon note
set buttonAnswer to button returned of myResult

if buttonAnswer is "Keep" then
tell application "System Events"
tell process "Preview"
--click menu item "Luk" of menu "Arkiv" of menu bar 1 (* version specific *)
keystroke "w" using {command down} (* universal *)
end tell
end tell
else if buttonAnswer is "Delete" then
tell application "Finder"
set label index of x to 7
end tell
tell application "System Events"
tell process "Preview"
--click menu item "Luk" of menu "Arkiv" of menu bar 1 (* version specific *)
keystroke "w" using {command down} (* universal *)
end tell
end tell
end if
end tell -- application "Preview"
end repeat
end open


      which may be shorten as:

on open
tell application "Finder"
set TheList to selection
end tell
repeat with x in TheList
tell application "Preview"
open x
set myResult to display dialog "Keep or delete picture ?" buttons {"Keep", "Delete"} default button 2 with icon note
set buttonAnswer to button returned of myResult

if buttonAnswer is "Delete" then
tell application "Finder"
set label index of x to 7
end tell -- Finder
end if
tell application "System Events"
tell process "Preview"
--click menu item "Luk" of menu "Arkiv" of menu bar 1 (* version specific *)
keystroke "w" using {command down} (* universal *)
end tell -- process "Preview"
end tell -- System Events
end tell -- application "Preview"
end repeat
end open



Yvan KOENIG

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Display dialog with image (From: "Stockly, Ed" <email@hidden>)
 >Re: Display dialog with image (From: Christian Vinaa <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.