Output to terminal window

Is it possible to write chars to a standard terminal window (command prompt) at a given position? And with other colors?

Hello Valdoran,
since Java is (supposed to be) platform independant, it limits the functionality to what is available on most platforms. Many platforms's terminals support merely the methods System.out (PrintStream) provides. Therefore there is no print(int x, int y, Object message).
Silver lining: The terminals which allow printing at a certain position mostly support ANSI escape sequences ^(1)^. So if you know you're (platform's) terminal supports it, give it a go..
With kind regards
Ben Schulz
^1^: http://en.wikipedia.org/wiki/ANSI_escape_code

Similar Messages

  • Closing active terminal window with applescript

    I made a very basic script to lock my screen, and I like how it works. Some of my co-workers would also like it but it has one problem.
    When the script runs, a terminal box pops up at the end saying [process complete]. I can click through this and I don't care, they do.
    I can't just killall terminal because we use terminal and that could kill our work.
    We sometimes need to see output from a script and like the process complete, so don't want to reconfigure our systems to never display it.
    I'm trying to find a way to use applescript or something to kill the active terminal window, or the window with the title of LockScreen or something.
    Anyone have an idea?
    I was hoping something like this would exist but it doesn't seem to: tell application "Terminal" to close window

    Here is an easy approach.  Start Applications -> Automator
    Select Application
    In Automator search for "Start Screen Saver".  This should be under Library->Utilities
    Drag "Start Screen Saver" to the right side panel.
    Save the Automator app.
    If the user has System Preferencs -> Security -> Require Password ... set, then one the screen saver has started running, it will require the user to enter their password before getting control back.
    This Automator app can be double clicked, it will not require the terminal.
    With respect to your script.  If this is a shell script, AND if you wish to continue using it, then you could create an Automator app that uses "Run Shell Script" under Automator Library->Utilities.  This will also NOT require the use of Terminal, however, be aware that when Automator runs a shell script it DOES NOT have the same environment as when you are running a shell script at your Terminal prompt.  There are very few environment variables set, and for example the USER, HOME, current working directory, PATH, etc... may not be the same.  If you have dependencies on specific environment information, you may want to write a simple automator script the using "Run Shell Script" to output various environment information into a file so you can see what you have to work with
    (id -a
    pwd
    echo "$#"
    echo "$@"
    printenv
    ) >/tmp/automator.environment.txt

  • Can someone tell me how to emulate serial terminal window in labview??

    Hi can someone tell me how to emulate serial terminal window in labview?  or provide me simple code to do it? 
    baud rate 9600

    Have you tried looking through the example finder?  There's a a few great examples in there on how to read from and write to a serial port.  In LabVIEW just choose Help > Find Examples... and then navigate to Hardware Input and Output > Serial > Basic Serial Write and Read.vi
    David_L | Certified LabVIEW Architect
    LabVIEW Tools Network | LabVIEW Tools Network Developer Center

  • Terminal window: how to close it ?

    Hello, everytime i switch on my macbook the Terminal window appears on the dock, it opens and it stays open. It all started 2 months since then it happens everytime. It is automatic. So i do switch it off ? how do i make sure that it doesnt open anymore when i switch on my macbook ? thanks for the help folks

    thanks Niel but it didnt work out. Control-click did nothing and same goes with preferences account which had marked just ituneshelper. Below what Terminal write at login
    macbook-di-andrea-zaccardi:~ andreazaccardi$ /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java ; exit;
    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)
    where options include:
    -d32 use a 32-bit data model if available
    -d64 use a 64-bit data model if available (implies -server, only for x86_64)
    -client to select the "client" VM
    -server to select the "server" VM
    -jvm is a synonym for the "client" VM [deprecated]
    -hotspot is a synonym for the "client" VM [deprecated]
    The default VM is client.
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A : separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -version:<value>
    require the specified version to run
    -showversion print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
    include/exclude user private JREs in the version search
    -? -help print this help message
    -X print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
    enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    -agentlib:<libname>[=<options>]
    load native agent library <libname>, e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
    load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
    load Java programming language agent, see java.lang.instrument
    logout
    [Processo completato]

  • How to use string control as terminal window

    Hello All
    I am trying to create a terminal window in my VI and to do this i have a string control and a string indicator.
    I want the user to be able to write a command in the terminal and when hitting enter the control should update, but not before! I would
    like the user to be able to enter multiple commands without having to re-click the control with the mouse, so it has to stay in the
    control window. 
    The output from this string control is input to a invoke node to an external motor controller, which replies with a string input to the string indicator.
    Tried to do some event case, but not quite sure how I am going to detect only the enter command.
    Any ideas how to preceed?
    Thanks
    Regards
    Tommy
    Solved!
    Go to Solution.

    Yeah, in your event structure, look for an event of your string control called "key down"...on the left, there are several parameters coming up (char, vkey etc.) where you can use for example the char to look for char=13 (return).
    look here: http://zone.ni.com/reference/en-XX/help/371361B-01/lvprop/control_key_down/
    good luck
    christian 
    THINK G!! ;-)
    Using LabView 2010 and 2011 on Mac and Win
    Programming in Microsoft Visual C++ (Win), XCode (Mac)

  • BlueJ Terminal Window

    Hi,
    I am using bluej for my java assignment. I have made a controller which tests all the methods and accordingly displays the output in the terminal window.
    I am however finding that only a limited amount of the output is shown in the terminal window. So basically the top section of the output is cut off. I have made no errors in my actual coding. It is something to do with the terminal window. Is there any way in which i can resolve this?
    Thanks

    So basically you're asking how to scroll the terminal window in BlueJ, or perhaps why it doesn't scroll?
    That's a question about the product and not Java, right? So perhaps this wasn't the best place to ask it?

  • How to get default command to open a terminal window? (Bash or Python)

    Desktop entry files (.desktop files) may indicate that an application requires a terminal window to run ("Terminal=true"), e.g. vim & maxima.
    How does a .desktop launcher determine which terminal to use? E.g. when opening a file associated with vim, what points it to 'urxvtc -e %s' or 'gnome-terminal...' or whatever?
    Is there a standard environment variable with the terminal command? $TERM only contains an identifying name but I don't see how to programmatically deduce the command from it. Grepping through the output of "set" doesn't show me anything useful either.
    My search-fu has failed me. Does anyone have any ideas?
    EDIT: Clarified subject and post.
    Last edited by Xyne (2011-02-02 14:00:14)

    Maybe my search-fu can be of help here:
    For KDE:
    terminal=$(kreadconfig --file kdeglobals --group General \
    --key TerminalApplication --default konsole)
    For GNOME:
    TERM_EXEC_KEY="/desktop/gnome/applications/terminal/exec"
    TERM_EXEC_ARG_KEY="/desktop/gnome/applications/termina/exec_arg"
    TERM_EXEC=$( gconftool-2 --get ${TERM_EXEC_KEY}) # e.g.
    "gnome-terminal"
    TERM_EXEC_ARG=$( gconftool-2 --get ${TERM_EXEC_ARG_KEY} ) # e.g. "-x"
    terminal="$TERM_EXEC $TERM_EXEC_ARG"
    For XFCE:
    Xfce has a directory called "share/xfce4/helpers/" which contains desktop entry files for commonly used terminals, browsers and email apps. These entries contain extra keys like X-XFCE-Category=WebBrowser or X-XFCE-Category=TerminalEmulator .
    Then there is a file called ".config/xfce4/helpers.rc" which in my case looks like:
    WebBrowser=firefox
    MailReader=thunderbird
    From: http://www.mail-archive.com/[email protected] … 01661.html
    edit: there is also xdg-settings (in xdg-utils) which can store default-app information, but i'm not sure if all DE's make use of this..
    Last edited by litemotiv (2011-02-02 14:08:27)

  • History of a terminal window

    I've done this successfully in the past, but at the moment I can't figure out how.
    The issue is this: I've using a do script find routine that generates many thousands of files. If I redirect the output to a file in the script bundle, I get an incomplete listing. Previously, I was able to get a complete listing by getting the history of the window (which I've identified via "windows of app "terminal"). The history property of the window is defined as "the contents of the entire scrolling buffer of the window."
    Since the find routine was initiated in a fresh shell, the history should be what I want, nothing more, nothing less -- and, previously, that's what I got. But now I'm blanking on exactly how I did that. If, in terminal tell block, I use "set H_ to history of (window id), I get only the initial find command.
    Better would be a way of having the entire history of the window redirected in the first place.
    (The solution well may dawn on me the instant I post this. The solution probably exists in some draft script on my computer, but at the moment I can't find it.)

    Thanks for the comment, but, that doesn't seem to fit with what was happening:
    • When I first encountered this, I was redirecting the output to a file, with the intention or reading that file.
    • But what was in the file was the end of the output I expected.
    • And I was using the "busy of Terminal window" approach (which we discussed at length recently) to stall the AS appropriately. Although I didn't see any error in the code, rewriting it has solved the problem, and I'm content (for now) to let sleeping dogs lie.
    I like to use "do shell script," as the whole creating files and reading them routine can be avoided. But while "do shell script" seems great for short terminal procedures, for longer ones I seem constantly to be running into problems or annoyances. For Instance:
    a do shell script "find" routine I was trying to use repeatedly stalled on a "permission denied" error. When I used "with administrator privileges" (requiring a password) to get past the error, later a second error stalled execution and I wasn't able to figure out the nature of the error (not that I tried very hard).
    BUT WITH "DO SCRIPT" the permission error was reported but didn't stall the Terminal execution (requiring no password) AND _the second error didn't show up at all_. These differences persisted
    and will still be present if I run both approaches. I know this difference has to do with how "do shell script" and "do script" handle error messages but, for now, I want hide my head in the sand and not see the error in the redirect file (or use a password to get past it).
    As to "History," I've also looked at "Content," and I concluded that if everything works properly (as I thought it once did), "set H_ to history of (properly referenced Terminal window)" was an AS command that would avoid the need to redirect and also avoid the hassle of reading the file. I should look at that again, now that things seem to be working properly. I located the script that I had written previously, and that is the command I used, and I think the result was what otherwise I might redirect to a file -- so it would be a time and code saver if it was indeed returning the entire result of the Terminal command!

  • Closing Terminal window tabs shrinks Terminal window height

    Open a Terminal window, press Command-T to create a tab, and then Ctrl-D to close that new tab, the Terminal window height decreases by one row.
    This most certainly appears to be a bug. How do I report this to Apple?

    I am also experiencing this problem, however if you use the Basic setting the problem doesn't exist.
    I am using Novel and I have the problem. It's quite annoying.
    I noticed that if you set the fontsize to 12 then this problem exhibits, however if I change the size to 11pt or 10pt (10 is the default for Basic, 12 is default for Novel) then I don't have the bug.
    Message was edited by: TonyKL

  • If I have a program that runs in windows under the command prompt and on Mac in the Terminal window, can it be run in iOS

    I have a program that is ran using the command line in windows and the terminal window on Mac or LInux.  Is it possible to create an app for the iPad that could run this program.  This program does require admin rights.

    No.

  • Keyboard shortcuts: adding service to open a Terminal window not being saved

    Hi
    Objective: A shortcut to open a terminal window with the path of the 'in-focus' Finder window (Mavericks).
    Solution (that doesn't work): Apple Menu/System Preferences/Keyboard
    Select: Shortcuts
    Select: Services
    Check box for: New Terminal At Folder
    Close System Preferences
    This approach seems to be advised on quite a few sites. When I do it, the service I add simply doesn't get saved. I go back into the System Preferences and look under the path above and see that the box for New Terminal Åt Folder is unchecked.
    Any help in being able to achieve my objective would be greatly appreciated :-)

    Those things are saved as part of the workspace. It sounds as if the current workspace file has become corrupt. Close ID, then go to your user profile and you'll find the workspaces folder under \Application Data\Adobe\InDesign\Version 6.0\<language>\Workspaces. Delete the "current" xml file for the workspace and restart ID. The workspace will be restored to the conditions set when it was saved, but hopefully will remember changes again when you close the program.

  • Code to close terminal window?

    I am running code in an IDE and want to be able to have any existing terminal window close before the code is run.  This way I don't have to keep closing them manually every time I run the code again.  I'm coding in C.  Any ideas?
    Thanks

    What about setting the
    Terminal -> Preferences -> Settings -> Shell -> When the shell exits: Close the window
    Now just make sure that the last thing your script does is exit from the shell and your window will be closed.
    Then again, do you "Really" need a Terminal session to run your code?
    That is to say, running programs and scripts can be done without needing a terminal session.  The Terminal session is just a window to the command line, and you do not need to display anything via the Terminal display, then there is no reason to have it open to run your program.
    You can use Applescript ("do shell script" statement), or Automator ("run shell script" action), or you can use a 3rd party utility such as Platypus that will put your program or script in a double clickable app that does not need a Terminal session.
    Another option is to use a different Terminal emulator, such as iTerm which also has the ability to close the window when the shell exits.  It can even automatically quit iterm when the last window is closed.

  • (SOLVED) Closing a terminal window

    When I am through using the terminal window, I hit the X at the top right corner but get this message: There is still a process running in this terminal. Closing the terminal will kill it.
    Why do I get this? I think I have nothing running. is there a bug?
    Last edited by mcduling (2011-12-19 22:23:54)

    It is complaining because you are still running su. That's a fair warning, not a bug.
    If you don't like it, use sudo instead. It's safer anyway than leaving a terminal sitting around in su-mode for arbitrary lengths of time.
    Edit: btw, if you have run su to gain root access, and you want to close the terminal, you can get out of su by typing "exit". Then you should be able to close the terminal.
    But really, don't use su. That's just asking for trouble. Sudo is your friend.
    Last edited by /dev/zero (2011-12-19 09:59:43)

  • 'Run' terminal window not closing

    I have an Java application which I have created an installation package for using InstallAnywhere.
    On Solaris when launching the application using the alias from a terminal window it works fine. But, when I launch the application from the File Manager, by double-clicking, it creates an 'extra' terminal window called 'Run', this terminal window doesn't terminate when I exit my application.
    How can I prevent this, can I prevent the 'Run' window from starting using some sort of setting, or can I somehow make sure it is closed togheter with the application?
    On Linux (SuSE10) the OS asks how I would like to run my application so I don't have the same problem there.

    Hi Kanwalpreet
    For basic idea please refer to the following link
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/dialog%20boxes%20in%20web%20dynpro%20applications.pdf">Dialog Boxes in WebDynpro</a>
    Go Through <b>page 16</b> of the PDF Document
    Regards
    Chaitanya.A

  • Terminal Window asking for password when opening

    I don't know what happens but everytime I open a terminal window its ask me for password. If I type my admin password it starts saying that can't found my ~ directory and starts in :/ instead of :~
    It is also showing ttys001 instead of 000 as usual.
    I don't know what it is, I think it have some relation with closing terminal windows without logging out of a ssh section, but I don't know how to resolve it. I tried reboot, "exit", delete com.apple.terminal
    Any sugestion?

    sgobin wrote:
    I don't know what happens but everytime I open a terminal window its ask me for password. If I type my admin password it starts saying that can't found my ~ directory and starts in :/ instead of :~
    It is also showing ttys001 instead of 000 as usual.
    I don't know what it is, I think it have some relation with closing terminal windows without logging out of a ssh section, but I don't know how to resolve it. I tried reboot, "exit", delete com.apple.terminal
    This is just a wild guess, but might there be a "sudo" command in a file in your home directory that's run when you launch a Terminal session, such as .bash_profile, .bash_login, or .profile? (This list assumes that you're using bash as your shell.)

Maybe you are looking for