|Sep 9, 2009, 09:54 AM||#1|
simple interactive script
I have a bash script,
how do I make selections? For example I start the script and if there is directory called "test" on the desktop how do I give a choice "Do you want to delete it? y/n"
|Sep 9, 2009, 12:02 PM||#2|
Use the osascript command to execute AppleScript that presents a dialog and returns the result on its stdout or stderr. Read 'man osascript', then refer to any AppleScript tutorial on how to present simple dialogs.
Since AppleScript is typically framed as a "tell app "SomeAppHere" ..." series of statements, you can tell the app System Events to do things if you don't have any other app at hand. You can also browse and experiment with AppleScripts using Script Editor (Spotlight search for it). To get the scripting terms, command-shift-O will present a list of scriptable apps; choose System Events and dig in.
There are also other command-line runnable languages that can present a dialog. The ones that come to mind are more complex than osascript for a simple dialog, though.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Need help w/ simple bash script||Super Macho Man||Mac Programming||6||Sep 18, 2006 07:00 PM|
|How to make a simple bash script?||lnesland||Mac Programming||10||Jan 18, 2006 08:55 AM|
|Simple DOM Scripting question. (need help)||radiantm3||Web Design and Development||2||Dec 28, 2005 12:08 AM|
|question about a very simple shell script||abhishekit||General Mac Discussion||7||Apr 14, 2004 01:45 PM|
|Simple shell script to vote for Steve||irod||General Mac Discussion||17||Jul 18, 2003 12:25 AM|
All times are GMT -5. The time now is 12:29 AM.