Shell Script GUI

Hi, I'm very new to OS X development. I have three shell scripts that I'd like to add a GUI to, just a simple dropdown menu that can select which script you want to run, then run that script by clicking an "Okay" button, or something of the sort. Right now I have it running with an automator .app that runs the shell script, but I'd like to add a simple GUi. Any help would be much appreciate =)

No matter how you chose to do it it's going to be a bit more work than a simple shell script. There are a lot of choices though.
Objective-C/Cocoa (this is how most of the big boys do it)
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/01Introdu ction/chapter1_section1.html
AppleScript Studio
http://developer.apple.com/documentation/applescript/conceptual/studiobuildingap ps/chapter01/chapter1_section1.html
Python/Cocoa bridge
http://developer.apple.com/cocoa/pyobjc.html
There are more options if none of these appeal to you.
Eric

Similar Messages

  • How to run a shell script from the GUI?

    This is probably a dumb question...
    How do I run a shell script from the GUI? I've been told to double click it but when I do, it opens as a text file.

    The behavior you describe is that used by the KDE and GNOME desktops of Linux.
    Under OS X, if you make a script then mark it as executable, double-clicking on it in the Finder will not execute it. Actually, it uses a rather complex algorithm ([summarized here|http://arstechnica.com/reviews/2q00/macos-qna/macos-x-qa-2.html]) to determine what to do with it. This is implemented in Mac OS X' LaunchServices framework (incidentally, the associations are cached in /Library/Caches/com.apple.LaunchServices*.csstore and ~/Library/Caches/com.apple/LaunchServices*.csstore). You can read the details in the developer docs about LaunchServices.
    Anyway, in short, the suffix '.command' is a built-in type in the LaunchServices network that identifies a shell script. If you run
    /System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServic es.framework/Support/lsregister -dump
    ... it will tell you as much.

  • Java GUI for a shell script

    I have a file with passwd format.I made a script for this file that is working as I wanted it to work.I have a list of options and each time I give an option,the script is doing something(for example,if I press "b" it makes something and if I press "a" it makes something else).All the results are an output from the file.
    My question is how can I create a GUI in java for this script.For example if I want the script to do what it would do if I pressed the "a" button on my keyboard,but not by pressing "a",but by choosing from a drop down list or some other graphical feature(by ticking a check box,clicking a button etc).Can I do this with java?
    Lazaros

    Hi,
    I understand you can create a Java Swing gui for a bash shell script which takes both complex input and writes output to the stdout & files, to be specific. Is that correct?
    If yes, could you give a simple example. Say for the following shell script.
    #!/bin/sh
    printf "Enter input\n"
    i=0
    while [ $i -ne 1 ]; do
    read $inputVar
    if [  "$inputVar" == "y" ]; then
    printf "You typed yes\n"
    i=1
    elif [  "$inputVar" == "y"  ]; then
    printf "you typed no\n"
    i=1
    else
    printf "Enter a valid character\n"
    i=0
    fi
    done
    Could you also point to some URL's which might help? Googling for "Java Gui for shell script" returns this as the first page, others dont really help. Googling "GUI for shell script" returns all other gui toolkits for xes but thats not what I want. I want a cross platform (nixes, Win*, MacOS* ) gui for a shell script ( which I plan to run using cygwin etc).
    TIA
    Vinod

  • Calling Unix shell script for some GUI interface

    Hi,
    I'm preparing a shell script, which would check for the syntax of a bteq script.
    I want this shell script to be called from a GUI interface...
    Is it possible to call this shell script from any GUI interface..
    If yes, could you please help me out.
    Thanks,
    Harshad.

    Harshad (user524171) wrote:
    I'm not aware of OEM grid control. Can i use it without Oracle or Oracle is must for this...Er.. this is an Oracle forum... and if you are not using Oracle s/w then why are you using Oracle support forums?
    I'm using teradata database and unix here...And what part of ORACLE Database General Forum+ do you not understand that makes you ask Teradata questions here?
    Teradata is not Oracle. Oracle is not Teradata. Please use the correct forum for your subject matter.

  • Running shell scripts from GUI

    I'm trying to run a simple shell script (bash or sh) from the GUI (just double click it).
    I've managed to run it by double clicking, BUT, it runs from my home directory (even if i add --noprofile or remove #!/bin/bash line completely).
    How can I keep the current directory, or at least get it as a variable?
    Thanks,

    Hi
    If you are using the Oracle database 10g, the new dbms_scheduler package allows you to run shell scripts. The dbms_scheduler.create_job procedure have one parameter called the job_action in which you specify the full path of the shell script.
    I hope this will help

  • Please help me remove the last elements of shell script from my applescript

    I read somewhere that running a shell script in an applescript was inefficient and created extra overhead, fine, so I am trying to take all of my shell script out of my applescript (this should fix issues with forward slashes in names as well...)
    however I am stuck on these last two lines (I know they are probably trivial but I've been up waaaay too long now) so I was wondering if anyone would be awesome enough to show me how to convert the bash to applescript.
    --does a recursive copy and rename
    do shell script "cp -R " & (thePath as text) & " " & (theOtherPathWithFile as text)
    --does a copy and rename, then a simple move
    do shell script "cp " & (quoted form of (POSIX path of this_item as text)) & " " & (theNewPath as text) & "&& mv " & (theOtherPathWithFile as text) & " ~/Desktop"
    Any and all help will be appreciated.

    There isn't anything wrong with using shell scripts, especially since AppleScript is designed to do this very thing. There is some overhead when using do shell script, just as there is some overhead when using an application tell statement, so it just depends on what you are doing.
    The performance of any particular script would also be up to whatever is acceptable to you (or your customers), and sometimes a shell script is the most efficient way to do something. Many of the system utilities are just GUI front-ends to a shell script, so they can't be all bad.
    To do your file copy or move with the Finder, you will need to tell it to duplicate or move the item(s) (there is that pesky overhead again). Shell scripts use POSIX paths while the Finder uses colons as its path delimiter, so you will need to use the correct file path references - there is a decent article about that at Satimage. Once your file paths have been defined (or using something like choose file or choose folder)), your script would be something like:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    tell application "Finder"
    duplicate source to destination
    -- move source to destination
    end tell
    </pre>
    See the Finder and *System Events* scripting dictionaries for more information about the ways they deal with files.

  • Shell script for DB backup

    HI,
    i have written some java code Database backup but there are some problems with that so now i need to write shell script for db backup.
    what i was doing in java code i was running command like that
    /usr/local/bin/tar cvzf /export/home/monitor/FILE_20091005.tar.gz FILES/*20091005.*which compress the all *20091005* files (myisam table files)
    but after compression file doesn't extract
    so i have to write shell script for that ..... can any body guide me how can i write that kind of script and put it in cron job.
    thanks

    soundar wrote:
    Hi all,
    I have migrated database from 8i to 10gr2.For Backup in 8i, we used a RMAN shell script (scheduled uding cron tab) to backup the database to Tape.(VERITAS BACKUP).
    I am new to 10G.I checked out the options to backup the database using Oracle Enterprise manager DB console.
    http://www.oracle.com/technology/obe/10gr2_db_single/ha/rman/rman_otn.htm#t1d
    I am planning to take a test backup using the steps mentioned inthe above url.Could any one suggest whcih is the best option for database backup,eiether to use Oracle Enterprise manager DB console or thru RMAN shell script for backup..?
    Edited by: soundar on Mar 9, 2010 10:53 PMDear soudar
    I woudn't suggest you to work with EM if you want to be a professional DBA. Start learning RMAN and use CLI instead of GUI
    Those who live by the GUI, die by the GUI

  • How to shell script for noob? or Cryptography for someone who doesn't need.

    Hi, I've seen the need of automating some tasks in the Terminal and I believe using shell scripts is my solution, although I don't really even understand how they work.
    Instead of posting a full how-to here, I'd like to ask if anyone knows about good comprehensive guide for someone who never used any programming language, yet knows how to work a bit with the Terminal?
    I will figure out the command I will need to input in the Terminal myself, by testing. Once it's figured all I need is to make a shell script out of it, and perhaps make an application out of it. (Automator? ... or more Script Editor? Or?)
    Thanks
    After seing this page...
    http://www.askdavetaylor.com/howcan_i_secure_encrypt_folders_on_my_macs_usb_flashdrive.html
    ... I believed to have found a great solution for some heavy cryptography, to protect some folder and for learning pleasure. What I wanted to do is to automate the openssl task mostly like this:
    Open my flash drive (or a certain folder) containting a disk image (uncompressed, or compressed if necessary, doesn't matter) but uncrypted. Clicking on something I will name 'Lock' for the moment will run the shell script, encrypting the said image with pre-set parameters and a password I will input when prompted by the app.
    Re-running the app will prompt me a password and simply un-encrypt the image, making it useable for me.
    That's all. Perhaps if I can do it, I'll make it prompt me what cipher and all other parameter to use, but I don't understand openssl very well yet. *I just read and understood more or less informations on that page.*
    Who knows, I'll end up with a sweet GUI for encrypting files usable by the common mortals.

    The Advanced Bash Scripting Guide is a great resource for beginners thru advanced users- http://tldp.org/LDP/abs/html/index.html

  • Running UNIX shell scripts from a Java app

    I want to build a GUI in Java as a front-end to a collection of UNIX shell scripts I have written. Is this possible?

    It is possible, but it kinda defeats the purpose of shell scripts no?

  • Shell Scripting Tools - If any?

    Does anyone know if there are any Shell Scripting tools (GUI Based) where we can test our scripts in different shells and see the outputs or stuff like that?

    That would be a good idea.
    Usually you write on a standard shell, i.e. in many places ksh is the standard for scripting.
    If you want to run the same script on csh will require sintax changes, you may write a template for the most commonly used commands and use them as a reference to translate the scripts from ksh to csh or viceversa.
    When a gui is out to do this tell us ;-)
    Regards,
    Alejandro

  • Java and Shell Scripts

    I have created a java program that its main target is to read from a log file. The GUI has six buttons and its button has a script running each time the button is being hit. The results of the script are presented on a JTextArea automatically. So I have six buttons and six scripts. The problem is that the first time the program works fine. But if I click one button for the second time I get no results or wrong results. The scripts alone(when they work without the java program) work right.
    Is this a memory problem? How can I have the scripts with the java program work right together? I must say that each script needs 4-5 seconds to execute and immediately after the execution, the results, as I told before, are shown in a JTextArea. How can I solve the problem, so that I have the right results every time I click the buttons and not just for the first time?
    I need your ideas as soon as possible. :)))
    For connecting the java program and the shell scripts I use:
    Process proc = Runtime.getRuntime().exec("bash script ");
    OutputStream out = proc.getOutputStream();
    PrintWriter p = new PrintWriter(out);
    p.flush();     

    I think u must use process.waitFor() method .
    By this, u r sure that the said process shall complete.
    Also I would recommend new Instance/Thread for running each script.

  • Java with Shell Scripts

    How can I include shell scripts in a java program?
    I want to create a GUI with Java and when I click a button or check a check box or choose something from a drop down list , I want a shell program to be called each time.For example, If i click a jbutton or check a jcheckbox, I want to execute something like this:
    sed 's/\([0-9]*\)\([-]\)\([0-9]*\)\([-]\)\([0-9]*\)\([-]\)\([0-9:.]*\)\(.*\)/\5\2\3\4\1\6\7/' $file >>temp;exit;;
    How can show the results on the GUI?
    All the graphical environment will be implemented with Java but underneath the job will be made by the scripts.
    I thank you in advance.
    I am looking forward to your answers.
    Lazaros

    Runtime#exec() returns a Process where you can call getInputStream().

  • Hiding terminal window when running shell script?

    Hi,
    I've set up a shell script (myscript.command) to run an application with certain launch arguments. When I execute the script the app runs fine, but I get a residual terminal window.
    How can I hide it immediately after the app launch, or, preferably, avoid seeing it in the first place?
    Thanks!
    Guy

    A .command script is really just a data file for Terminal.app, which is why a terminal opens. One solution is to convert it to be its own .app (i.e., it would run on its own instead of being run by something else). I think platypus and dropscript are the two standard tools for doing that.

  • Reading output from a Solaris(UNIX) shell script

    Hello All, I have written some fairly large shell scripts. I have also written a simple java GUI that contains a button that will run the script. The script runs. The problem is that I cannot see the output from the script in the x-term that I used to run my java class file.
    I am developing in a windows environment, I have a silly little system.out that prints "Button Pressed", which works in windows just fine but on my ultra 10 running Solaris 8 the term just sits there no output to the srceen.
    Has anyone out there solved this problem or know of a way that I can? Thanks

    I don't know how to print out to the x-term. But you can add a JTextArea to the GUI and get the output there.
    String output = null;
    StringBuffer returnString = new StringBuffer();
    String command = /path/to/shell/script/script.sh
    process = Runtime.getRuntime().exec(command);
    InputStreamReader isr = new InputStreamReader (process.getInputStream());
    input = new BufferedReader(isr);
    while((output = input.readLine()) != null){
        returnString.append(output);
    }Wouldn't a System.out.println(returnString.toString()) print to the x-term console?
    hope this helps.

  • Determining if network is up from shell script?

    Is there a way using a shell script to tell if unix thinks the network is up? I have a 3rd party PCMCIA wifi card that takes a few seconds to reconnect to the network on wake or boot (utility needs to launch and synch get established) and I'd like to trigger a script once it has reconnected. (I have no way of asking the card itself -- the driver/utility isn't scriptable.) It's clear someplace in unix knows it's not up right away because the logs show a few "network not up" (or something like that) messages for awhile (DNSResponder I believe may have been associated with some of them) right after the wakeup is logged. The GUI network status for the port (whether that'd be knowable from the shell or applescript or not) doesn't reflect that the connection isn't up -- it shows green for the port right away, presumably because the card itself is responding.
    Ted Lee
    Minnetonka, MN

    Here's a similar approach but waits for the specified interface to become active:
    <pre style="padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 80ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #222; background: #eee; line-height: normal">#!/bin/sh
    while [ "`ifconfig | sed -n '/^'$1'/,/^[a-z]/ s/.*status: \(.*\)$/\1/p'`" != "active" ]
    do
    echo interface $1 is not up
    sleep .5
    done
    echo interface $1 is now UP
    </pre>
    Save it as ifup, make it executable, and call it with the name of your interface:
    ifup en1
    Cole

Maybe you are looking for

  • OS 10.4.5 Crashes

    Hi, For reasons I cannot explain my G4 powerbook running on OSX10.4.5 is unexpectedly crashing. It was working fine then the screen went halftone shaded (like with dashboard) and the following message came up "You need to restart your computer. Hold

  • How to connect a USB-6008 with lookout6.0?

    hi >>> I am a student in electrical and computer department, i want to ask about How to connect a USB-6008 with lookout6.0 if thats possible?Could you provide some help? Regards Manal

  • Paste Link 'Outline Level' from Excel into Project get error

    I am trying to generate a MS Project schedule based on linked data in an Excel spreadsheet. I cannot get the summary project tasks to appear with their sub-tasks. When I try to paste link the Outline Level into Project, I get and error that states "T

  • HT201269 A question about iTunes backups.

    I have backed up my old iPhone that used Ios 6. Now I have a new iPhone and my question is: Can i restore that new one if it has ios 7? Will it change back to Ios 6 or not??? Thanks!!!

  • How do you change your song made on Logic Express(Iso. file) into MP3 file?

    I've been meaning to put a song on a c.d or just to transfer it to other people, and it is required to be an MP3 file. Does anybody know how to change the original file of the song (Iso.) into an MP3 file? PowerBook G4   Mac OS X (10.4.9)   PowerBook