Creating an Automator app

automator

I would like to have a clickable app that will open a terminal window, run the script:

defaults write com.apple.finder AppleShowAllFiles YES

and then close the terminal app. (and another to turn off the show all, same script with No at end). Automator seems to have a lot of potential, with not enough documentation that's easily found.

Best Answer

not enough documentation

Umm...Welcome to Automator - Apple Support

This is also a great link


There is so many different ways of doing what you want.

Option A: Shell Script (Does in background)

Option B: Open Terminal Window


A

Option 1: Pure AppleScript (Using /Applications/Utilities/Script Editor.app)

do shell script "defaults write com.apple.finder AppleShowAllFiles YES"

Option 2: Pure Automator

enter image description here

Option 3: Automator + AppleScript

enter image description here


B

Option 1: Pure AppleScript

tell application "Terminal"
    activate
    do script "defaults write com.apple.finder AppleShowAllFiles YES"
end tell

Option 2: Automator + AppleScript

(A3 with the in B1)


For the toggle hears the AppleScript Code to be used in any option of your choosing:

set a to (do shell script "defaults read com.apple.finder AppleShowAllFiles")
if a is "YES" then
    do shell script "defaults write com.apple.finder AppleShowAllFiles NO"
else
    do shell script "defaults write com.apple.finder AppleShowAllFiles YES"
end if

Export Options

Script Editor:

File>Export

  • File Format: Application

Automator:

Choose Application when creating a new document

enter image description here