tell application "Finder"
activate
delay 0.2
beep
set myName to "" # clear myName
try # Deal with All Conditions Met, Execute Actions with no selection
set theSelection to the selection
if class of theSelection is list then
set myFile to (item 1 of theSelection) as alias
else
set myFile to theSelection as alias
end if
set myName to the name of myFile
display dialog "myFile = " & myFile & return & "myName = " & myName
end try
if myName contains "ƒ" then set myName to "" # don't add "ƒ" if it's already there
if length of myName ≠ 0 then # length of name of file selected
set the name of myFile to myName & "ƒ"
end if
end tell # to Finder
delay 0.2
if length of myName = 0 then
tell application "Finder" to activate # re-activate Finder, so Keyboard Maestro macro will respond
delay 0.1
tell application "System Events" to tell process "Finder"
set frontmost to true
keystroke "a" using {option down, command down} # deselect all
delay 0.2
# I apologize, as I don't know this shortcut, I disabled it !
-- keystroke "q" using {option down} # activate open finder 2
end tell
end if # length of myName
Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) samedi 19 décembre 2015 21:10:35