Transmit does not have a Close all Windows command, so I wrote this script so I can use the standard keyboard shortcut (Command-Option-W) and run this function from Butler.
Open the Configuration area of Butler, and add the script.
In the 'Inspector' area to the right of the Configuration area of Butler, do the following:
Under the Options tab, under the Open with menu, select Execute Applescript, and select the script. (Save the text above in Script Editor.)
Under the Triggers tab, set the Hot Key to Command-Option-W. In the same tab, from the Exceptions valid in menu, select Only.
In the text input box below Exceptions Only valid in..., type Transmit.
Transmit should now close all its windows when you invoke the standard keyboard shortcut, Command-Option-W. This should work with other applications as well.
[kirkmc adds: Well, this is certainly interesting, but given the amount of times I use Transmit, Option-clicking the close box is fine for me. However, the principle may appeal to those using other applications that lack this keyboard shortcut.]
tell application "System Events"
-- Check if UI elements are enabled:
if not UI elements enabled then
tell me to display dialog "This script requires GUI scripting to be enabled. For this, you may need to enter your user password."
set UI elements enabled to true
if not UI elements enabled then error number -128
end if
set front_app to (path to frontmost application as Unicode text)
set AppName to front_app as string
tell me
set frontAppName to getAppName(AppName)
--display dialog AppName
end tell
if (frontAppName as string is equal to "Transmit.app") then
tell application front_app
activate
try
tell application "Transmit"
activate
try
repeat with i in every window
get properties of item 1 of every window
set windowID to id of result
close (window id windowID)
end repeat
end try
end tell
end try
end tell
end if
end tell
on getAppName(AppName)
set AppleScript's text item delimiters to ":"
set the item_list to every text item of AppName
set AppName to item -2 of item_list as string
set AppleScript's text item delimiters to ""
return AppName
end getAppName
Open the Configuration area of Butler, and add the script.
In the 'Inspector' area to the right of the Configuration area of Butler, do the following:
Under the Options tab, under the Open with menu, select Execute Applescript, and select the script. (Save the text above in Script Editor.)
Under the Triggers tab, set the Hot Key to Command-Option-W. In the same tab, from the Exceptions valid in menu, select Only.
In the text input box below Exceptions Only valid in..., type Transmit.
Transmit should now close all its windows when you invoke the standard keyboard shortcut, Command-Option-W. This should work with other applications as well.
[kirkmc adds: Well, this is certainly interesting, but given the amount of times I use Transmit, Option-clicking the close box is fine for me. However, the principle may appeal to those using other applications that lack this keyboard shortcut.]
•
[6,611 views]

