Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 9, 2009, 09:54 AM   #1
md5
macrumors newbie
 
Join Date: Jun 2009
simple interactive script

Hello,
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"

thanks
md5 is offline   0 Reply With Quote
Old Sep 9, 2009, 12:02 PM   #2
chown33
macrumors 601
 
Join Date: Aug 2009
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.
chown33 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
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.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC