Re: Display dialog with image
Re: Display dialog with image
- Subject: Re: Display dialog with image
- From: Yvan KOENIG <email@hidden>
- Date: Sat, 25 Feb 2006 15:35:03 +0100
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:
This email sent to email@hidden