Sponsored Content
Top Forums Shell Programming and Scripting GUI Shell Script Mac OS X - Working Directory Post 302506106 by freegnu on Friday 18th of March 2011 01:42:50 PM
Old 03-18-2011
Use Automator on Mac OS X. Create a new application not a workflow.

In Automator under utilities add a run shell script action and underneath it add a run applescript if you want to see your output.

Change the interpreter in the shell script to /usr/bin/python and the input drip down should be set to input as args in the drop down in case you want to drop files on it or open files with your "app".

Type your script in the text box. It should have an example like this already:
Code:
import sys

for f in sys.argv[1:]:
	print f

Change it by adding this line anywhere for testing purposes:
Code:
print "Hello from the shell"

In the applescript action below your shell script action in the applescript action text box there will be an example script like this:
Code:
on run {input, parameters}
	
        (*Your script goes here*)

	return input

end run

Change the return input statement to this:
Code:
on run {input, parameters}
	
	return display dialog item 1 of input buttons {"OK"} default button 1
	
end run

Click the run triangle to test it. You should get a dialog box with an OK button. Click OK. Save the app where ever you want with what ever name you want. Close Automater and double click the app. You should see you dialog.

If everything is working you can now go back into automater and open the app using the open existing workflow from the dialog that pops up or from the file open menu in Automator.

Edit and play to your hearts content. You only need the applescript action if you need to see the results. Like showing the long listing of a directory or some such.

If you are feeling mischievous you can do a show contents on your newly created app and edit the scripts directly.

If you prefer the console you can browse the directory structure of the app you just created in your favorite text editor or by navigating in a terminal window and using cat or less or lynx or links or mc or some such.

Last edited by freegnu; 03-18-2011 at 02:43 PM.. Reason: typo
 

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Deleting from Mac on GUI?

On the Mac, if you delete a file from the GUI, it actually gets moved to a .Trashes folder in your home directory. However, if you rm a file from the terminal application (command line), it is gone for good immediately like in other unix implementations. I would like to see Apple make this... (1 Reply)
Discussion started by: wmosley2
1 Replies

2. UNIX for Dummies Questions & Answers

If a is windows gui ( client), b is a unix gui ( Server for a) and c is a shell scrip

Hello all, 1) I want to have a GUI application that will call Unix shell scripts, 2) that GUI application should be able to reside on windows ( if possible) and then call Unix shell script either directly or through a server residing on unix. That is for example. If a is windows gui (... (1 Reply)
Discussion started by: hchivukula
1 Replies

3. Shell Programming and Scripting

Controlling GUI from Shell Script

Hi Everybody, I previously posted this under Unix for dummies and got no answers, so here goes again: I'm trying to create a script that will launch firefox from a bash shell in ubuntu and perform certain tasks. Why does it have to be a script? Because this firefox must eventually run in a... (0 Replies)
Discussion started by: rummage_bin
0 Replies

4. UNIX for Dummies Questions & Answers

Controlling GUI from Shell Script

Hi Everybody, I'm trying to create a script that will launch firefox from a bash shell in ubuntu and perform certain tasks. Why does it have to be a script? Because this firefox must eventually run in a server with xvfb (no gnome, no kde), so I will not have access to it through the GUI. At... (2 Replies)
Discussion started by: rummage_bin
2 Replies

5. Shell Programming and Scripting

GUI shell script for Linux

Hi, I want to write shell script file that have a GUI with multiple input box for user entry , i mean multiple input box in one dialog ( window) not one window for each entry , i tried kdialog , and zenity , i didnt find a way to have multiple input box in one window with zenity and kdialog.... (0 Replies)
Discussion started by: mr_aliagha
0 Replies

6. Solaris

GUI not working... CLI is working fine

Hello, I have X4500 running Solaris 10. I can access it through CLI but I cannot see the GUI. When I reboot it, the GUI works till all the files are loaded (ie., the initial boot sequence) and it prompts me to enter username and password and there it ends. The screen just has a blinking cursor... (4 Replies)
Discussion started by: bharu_sri
4 Replies

7. Shell Programming and Scripting

GUI possible in shell script..?

Hi All, Currently my requirement is to parse through the log scripts and show the errors to the user.The only twist I got is it needs some GUI ,which is considered user friendly. Does anyone has any idea , if GUI can be implemented through shell scripts, please let me know. Thanks! nua7 (5 Replies)
Discussion started by: nua7
5 Replies

8. Shell Programming and Scripting

Interfacing a shell script with Perl Tk GUI

I want to make a GUI in perl tk where I can give some user input. This user input is the command line argument for a shell script. After giving the input parameters I want the user to press a button and the shell script should start executing. How should i interface the shell script with the GUI? (0 Replies)
Discussion started by: lassimanji
0 Replies

9. Shell Programming and Scripting

Create A Simple GUI For Shell Script

Hi all! Im wondering if its possible to create a GUI for a shell script I just got done writing as the people that will be using it dont like the command line all to well. Just something simple with radio buttons to select options, maybe a text field to enter a location to save the file generated... (1 Reply)
Discussion started by: Grizzly
1 Replies

10. Shell Programming and Scripting

gui based appliocation using shell script

hi, i've to write a shript based application which should gives a look and feel like a GUI. can any one give me a base idea on how to design a GUI based application using shell script. Regards, vijay:b: (1 Reply)
Discussion started by: vij_krr
1 Replies
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.10 30 Jan 2004 script(1)
All times are GMT -4. The time now is 06:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy