Turning commands into clickable files

tigrr

Registered
There are various "hidden settings" in MacOS only accessible via the UNIX command line that I would like to turn on or off simply by double-clicking a file for each function (two files that is; one for turning the function on, another for turning it off).

I've so far tried using ScriptGUI, and also turning UNIX commands in the terminal into executable text-files, but I'm not quite getting the result I'm looking for:

1) The executables should be free of any "geeky" stuff. That is, if the terminal comes up I shouldn't have to enter something there or manually have to quit it.
The best thing would be to not involve the terminal at all, and they shouldn't need the user to install any special software in order to run them (if these tools turn out to be useful I might pass them on to others as well).

2) I would like to include a "safety mechanism": in case I turn a function on at some stage, then later run the same "turn on this function" application it shouldn't get stuck with an error message, but rather just do the same thing again, or (better), pop up a window saying that this function is already turned on (and an "OK" button to close the window). The same goes for turning a function off twice.

3) I would also like some sort of visual verification that the job has actually been done. Perhaps a window that pops up with a message and an "OK" button which I have to press when I've read it.

4) When the "sudo" command asks for the password it would be user-friendly to have a window pop up where it asks for the administrator password (instead of just "Password:") along with an "OK" button.



The two "hidden functions" that I'm trying to create on/off switchers for are:

- turn on/off the "Dashboardadvisoryd" phoning-home-to-Apple feature
- turn on/off the ability to keep a sleeping Powerbook/iBook/Macbook still sleeping when the lid has been opened

Here are the commands for turning off (disabling by renaming) the "Dashboardadvisoryd" files:

First, turning the feature off:

sudo mv /etc/mach_init.d/dashboardadvisoryd.plist /etc/mach_init.d/dashboardadvisoryd.plist.DISABLED
sudo mv /System/Library/LaunchDaemons/com.apple.dashboard.advisory.fetch.plist /System/Library/LaunchDaemons/com.apple.dashboard.advisory.fetch.plist.DISABLED

Then turning it back on again:

sudo mv /etc/mach_init.d/dashboardadvisoryd.plist.DISABLED /etc/mach_init.d/dashboardadvisoryd.plist
sudo mv /System/Library/LaunchDaemons/com.apple.dashboard.advisory.fetch.plist.DISABLED /System/Library/LaunchDaemons/com.apple.dashboard.advisory.fetch.plist


And here's the command for allowing the laptop to continue sleeping even if the lid has been opened:

sudo pmset lidwake 0

Finally, the command for making the laptop wake up whenever the lid is opened:

sudo pmset lidwake 1
 
Depending on your version of MacOS, I would seriously suggest using Automator for this. You can add everything you have listed as necessary (notifications, even via Growl!, confirmation, execute shell scripts, etc) and have those run by saving them as a .app instead of .workflow.

Automator is very simple to use (at times to simple as to limit its functionality, but it should work for your task).

PS I'm not certain how to handle sudo, there may be an option to run as a specific user in the workflow element. If so, I don't know how it handles security (if you can just choose 'root' from a drop-down box, for example).
 
Last edited:
Yeah, I did give Automator a try, but I never figured it out.
It seems to me that it only works with a few specific applications (the ones shown in its "Library" area), and only with a few specific tasks (shown in the "Action" area), so I assumed it was a tool for mix-and-matching some pre-defined tasks that Apple thought would be helpful for most people.

But I can't see "Terminal" among the applications there, so how do I make an executable out of some terminal commands?

I searched the web for a beginner's guide to Automator, but all I could find were downloadable workflows, and nothing involving terminal commands.
Do you know of any guides which would help me out?

You asked about my MacOS version -I'm on MacOS 10.4.10. Can Automator executables only work with other Mac using the same MacOS version, or will they work within any MacOSX system?
I might want to give away my "double-click-to-run-terminal-command" application, and it would be nice if it could be used on several MacOS versions.
 
I've attached some screenshots for you of the workflow. It doesn't do exactly what you want, though. I've not clever solution for running sudo without asking for an admin password other than editing /etc/sudoers and matching the commands as passwordless sudo commands.

I only mentioned the OS version because I've tried to deploy automator apps from Leopard to someone on Tiger and they appeared as folders. Maybe just a fluke...
 

Attachments

  • Picture 1.png
    Picture 1.png
    134.2 KB · Views: 14
Last edited:
Back
Top