applescript/automator close and save
Can anyone tell me why this script, running on a fileset in automator leaves all my TextMate windows open with the save prompt waiting for my input instead of actually saving and closing the file?
I assumed that the line close window 1 saving yes
would save and close the file and continue with the next but 开发者_运维百科it seems it doesn't.
on run {input, parameters}
repeat with a from 1 to length of input
tell application "TextMate"
activate
open item a of input
tell application "System Events"
tell process "TextMate"
tell menu bar 1
tell menu bar item "Text"
tell menu "Text"
tell menu item "Convert"
tell menu "Convert"
click menu item "Tabs to Spaces"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
close window 1 saving yes
end tell
end repeat
return input
end run
I would say either TextMate is simply presenting the opportunity to save (or cancel), this is a bug, or this is an incomplete implementation of the command within TextMate. But only TextMate's devs can answer that question.
Commands and their implementations are completely up to the developer and their applications; there are no enforced or encouraged standards given by Apple to go by. The command close window 1 saving yes
in the Adobe Creative Suite causes the document to be saved and then closed without user intervention, and it is pure coincidence the syntax is the same.
精彩评论