Exactly what the title says. Whenever I open Automator, by clicking on its icon, it keeps opening multiple files (Untitled, Untitled 2, Untitled 3). When I attempt to close them it asks me if I want to save changes for each one. This is incredibly annoying. Does anyone know how to stop this?
Automator Keeps Opening Multiple Untitled Files
automator
Related Solutions
Add open "${1%.*}".jad
on a new line at the end of the script. If you want to open it in a specific application (not the default), change it to open -a "Some Application" "${1%.*}".jad
The $1
is the first argument passed to a script, which in this case is the file path. the ${1%.*}
strips the extension (i.e. /Users/you/MyClass.class
becomes /Users/you/MyClass
), and then .jad
is appended, so you get the full path of the new file.
Why use Automator when you can stay in bash?
I found a really cool little script called appify that will instantly turn other scripts into actual applications. You can try it a few times to observe its behavior. Since you already use bash, I am hoping that this answer as an alternative to exactly what you are asking for is acceptable.
The idea is to split your script into 3 distinct scripts:
1: start ftp service on preferred network interface only
#!/bin/bash
#start ftp service
#sudo="/usr/bin/sudo"
#launchctl="/bin/launchctl"
say="/usr/bin/say"
networksetup="/usr/sbin/networksetup"
tail="/usr/bin/tail"
head="/usr/bin/head"
cut="/usr/bin/cut"
curl="/usr/bin/curl"
currentInterface=$(networksetup -listnetworkserviceorder |tail +2 |head -n1 |cut -c5-12)
getExternaladdress=$(curl ipecho.net/plain)
SiriSays="say -v Samantha"
#sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist
#your command will start ftp on all network interfaces
if [ "$currentInterface" = "Airport" ];
then
networksetup -setpassiveftp Airport on
else
networksetup --setpassiveftp Ethernet on
fi
$SiriSays "ftp service has been initiated for the"
echo $currentInterface |$SiriSays; $SiriSays "interface"
$SiriSays "Your external IP address is"
echo $getExternaladdress | $SiriSays
exit
2: stop ftp service
#!/bin/bash
#stop ftp service
#sudo="/usr/bin/sudo"
#launchctl="/bin/launchctl"
networksetup="/usr/sbin/networksetup"
say="/usr/bin/say"
tail="/usr/bin/tail"
head="/usr/bin/head"
cut="/usr/bin/cut"
currentInterface=$(networksetup -listnetworkserviceorder |tail +2 |head -n1 |cut -c5-12)
SiriSays="say -v Samantha"
#sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist
#your command requires sudo
if [ "$currentInterface" = "Airport" ];
then
networksetup -setpassiveftp Airport off
else
networksetup -setpassiveftp Ethernet off
fi
$SiriSays "ftp service has been terminated"
exit
3: check ftp service status
#!/bin/bash
#check ftp service status
networksetup="/usr/sbin/networksetup"
say="/usr/bin/say"
tail="/usr/bin/tail"
head="/usr/bin/head"
cut="/usr/bin/cut"
currentInterface=$(networksetup -listnetworkserviceorder |tail +2 |head -n1 |cut -c5-12)
SiriSays="say -v Samantha"
if [ "$currentInterface" = "Airport" ];
then
networksetup -getpassiveftp Airport |$SiriSays
else
networksetup -getpassiveftp Ethernet |$SiriSays
fi
exit
Then apply the appify script to them
What you're left with is three little apps to put in your dock that, when launched, will start or stop the ftp service on your preferred network interface, or tell you what's up with ftp, respectively, and should not require any admin password. I only had time to test the first one, so if they don't work as I hope they do, then you can comment out or delete my logic and use your launchctl method.
Best Answer
Delete the Saved State files.
~/Library/Saved Application State/com.apple.Automator.savedState