Run .sh script with Java, then change window position

Is the following possible?:
From java, run a .sh script, which opens a total of 4 windows. (I know how to do this part).
Once the 4 windows (or more) are opened, I want to position them in specific locations on the screen. Is this possible, since the .sh script actually opens the windows?. Use the setLocation method in java.awt.Component??
any help is appreciated.
thx

As I recall, -geometry can have 4 numbers, I think it was {width}x{height}+{X location}+{Y location}, for example "-geometry 400x300+20+20". The + signs can be - signs if you want to count from the right or bottom margins.
Yeah, here's a quote from "man X":
most X programs accept a command line argument of
the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF,
and YOFF are numbers) for specifying a preferred size and location for
this application's main window.
Check out the man page for more details.

Similar Messages

  • RUNNING PHP SCRIPT WITH ZEND FRMWRK IN WINDOWS TASK SCHEDULER

    I have a PHP script which includes the Zend framework Mail.php for sending mails.
    I am running a WAMP server and i used DW to create it.
    I want to run my script in every 5 mins, How i can schedule it in Windows task scheduler.
    I tried running a bat which contains the php.exe path and arguments as php file but it gives an error that zend/mail.php not found.
    Please help its really urgent.

    Thanks for your response.
    bat file has:
    path of the php.exe -f path of php file.
    But when it runs it gives an error that the zend framework file not found.
    I have a seperate PHP includes folder under which zend FW is stored.
    That folder is marked in includes_paths in php.ini.

  • Form login with java, then change URL

    this is my problem, theres a site where I need to login with a login + pass. now when I try to take a new url (on the same host) I'm back at the login page, so basically I want to login, and then keep that login to parse several pages on the server... I didn't write this code myself, but it works for the login :p now I just need to change the url in the same connection I guess
    String argus[]= {url,"name",name,"password",password};
              URL u = new URL(argus[0]);
              String postdata = URLEncoder.encode(argus[1]) + "=" + URLEncoder.encode(argus[2]);
              for (int i=3;i+1<argus.length;i+=2) {
              postdata = postdata + "&" + URLEncoder.encode(argus) + "=" + URLEncoder.encode(argus[i+1]);
              URLConnection uc = u.openConnection();
              uc.setDoOutput(true);
              OutputStreamWriter out =
              new OutputStreamWriter(uc.getOutputStream(),"ASCII");
              out.write(postdata);
              out.close();
         String s;
              while ((s = r.readLine()) != null) {
              System.out.println(s);
    so far it works perfectly, but now I need to get another html page on that server, but when I create a new URL it goes back to the login page...
    any ideas ?

    The page probably sets a cookie. This article tells about one way to handle cookies:
    http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-cookie.html

  • Is anyone experiencing problems with opening mission control from the desktop.  Running mountain lion with parallels 7 and windows 7

    is anyone experiencing problems with opening mission control from the desktop.  Running mountain lion with parallels 7 and windows 7

    I had been having a similar problem on Lion with Safari pdf files despite downloading the latest Adobe Reader XI.
    I would constantly get the same messages - There was an error opening this document. The file is damaged and could not be repaired. And I would get a blank page when I tried to print the pdf if I tried printing from the Safari web page using File - Print from the top toolbar on my laptop.
    Then I came across the grey Safari lozenge with action icons.
    This allowed me, without downloading the pdf, to print the pdf file direct from the Safari page by using the Print icon on the grey lozenge that appears centrally three quarters down the screen.
    Then I discovered that if I save the pdf using the Save icon from this same grey lozenge on the Safari page I can open and print this pdf version from my desktop.
    I've tested it with a couple of different pdf files and these methods work using the grey lozenge icons but the same pdfs files don't work using File - Save As on the Tool Bar.

  • How to run Perl script in Java program?

    Some say that the following statement can run Perl script in Java program:
    Runtime.getRuntime().exec("C:\\runPerl.pl");
    But when I run it, it'll throw IOException:
    java.io.IOException: CreateProcess: C:\runPerl.pl error=193
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Win32Process.java:63)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:566)
    at java.lang.Runtime.exec(Runtime.java:428)
    at java.lang.Runtime.exec(Runtime.java:364)
    at java.lang.Runtime.exec(Runtime.java:326)
    at test.runPerl.main(runPerl.java:16)
    Exception in thread "main"
    Where is the problem? In fact, I do have a Perl script named "runPerl.pl" in my C:/ directory. Could anybody tell me why it can't be run? Thanks in advance.

    Hello sabre,
    First of all thanks for your reply.
    I have tried like what you mentioned.
    Eventhough, i could get the exact error message.
    I could get the Exception
    "Exception:java.lang.IllegalThreadStateException: process hasn't exited"
    <code>
    import java.io.*;
    public class Sample{
    public static void main(String args[]) {
    String s = null;
    Process p;
    try
         p = Runtime.getRuntime().exec("tar -vf sample.tar");
         //p.waitFor();
         if(p.exitValue() == 0)
              System.out.println("CommandSuccessful");
         else
              System.out.println("CommandFailure");
    catch(Exception ex)
         System.out.println("Exception:"+ex.toString());
    </code>
    In this code, i tried to run the "tar command". In this command i have given -vf instead -xvf.
    But it is throwing
    "Error opening message catalog 'Logging.cat': No such file or directory
    Exception:java.lang.IllegalThreadStateException: process hasn't exited
    CommandFailure"
    "Error opening message catalog 'Logging.cat'" what this line means ie,
    I dont know what is Logging.cat could you explain me its urgent.
    Thanks in advance.
    Rgds
    tskarthikeyan

  • Run Perl script in JAVA

    Can we run perl scripts in java, still supporting perl API?
    Thanks a lot for help!

    I haven't tried it but I think 6.0 supports some
    scripting.But NOT perl!Sorry, I didn't mean some Perl Scripting. I meant some scripting and I wasn't sure what languages.

  • Running sqlplus scripts from Java code?

    hi
    I need to programmatically run sqlplus scripts from Java code on a machine that doesn't have sqlplus installed.
    Is there any Java class library available for doing this?

    The Ant approach could probably work for me, thanks for the tip.
    The setup seems rather complex however, given the simplicity of the task. I would prefer just running a Java based SQL*Plus from in a separate process or doing this via an API that would allow me to run SQL*Plus scripts (parse script, substitute variables, run statements).
    Oracle SQL Developer v1.1 appears to include an API that does exactly this.
    The ScriptParser, Substitution and SQLPLUS classes in the oracle.dbtools.raptor.scriptrunner package (oracle.sqldeveloper.jar) seem to do just what I need based on my tests.
    Can I use these classes for this purpose in my application? Is repackaging allowed?
    Does Oracle have any plans for releasing this sort of functionality separately e.g. as part of the Instant Client?

  • Using scripting with networking equipment under Windows

    It can be a challenge to use scripting to automate working with Cisco devices. The Cisco IOS does not seem to directly provide a command line interface. You are forced to find a way to automate interaction with a telnet or ssh session.
    The PERL language provides a number of object-oriented methods to help manage an interactive session, most notably Net::SSH::Expect and Net::Appliance::Session. These options can work well in a Unix environment, but not under MS Windows.
    There are PERL for Windows options, the best probably being Strawberry PERL. There is also a Unix under Windows option known as CYGWIN that is freely available. Unfortunately none of these will work well with the way Windows manages low-level terminal I/O. The curious can google "windows pseudo terminal" to see all the technical details.
    One way that does work under Windows is Tcl.  It was initially named Tool Command Language. It is sometimes shown as Tcl/Tk.
    Interestingly enough, Tcl is included within Cisco IOS as tclsh. There is no interaction with the tclsh and this example. It is just a bit of a curious coincidence.
    A Tcl port to Windows can be downloaded from http://www.activestate.com/activetcl/downloads. Select Download ActiveTCL for Windows. A direct link to the download that worked at the time of writing is Download ActiveTcl 8.5.14 for Windows (x86)
    Once base Tcl has been downloaded and installed there is one other component that will need to be installed from the Tcl Extension Archive, the expect package.
    The teacup program that is installed with the base Tcl package makes this easy. The teacup program will work with a proxy.
    You can set these Windows environment variables to specify proxy details:
    set http_proxy=
    set http_proxy_user=
    set http_proxy_pass=
    Then run teacup install expect
    The plink tool from the PuTTY download is also needed. It can be obtained from http://www.putty.org/.
    The sample that follows assumes that the data files, script and plink.exe executable all reside in the same directory.
    A sample Tcl script follows that reads a file of devices and a file of commands. It will run the list of commands against each device in the device file. It has some basic error checking, but should best be considered a ‘beta’ version. You could do more complex interactions in the Tcl script by adding exp_send and expect command statements. In short, if you can type it you could script it!
    Change directory to where your script, plink.exe  and data is stored and run with  tclsh <script_name>
    devices.list
    # Comment lines are allowed if they start with a hash mark
    # <IP_Addr> <userid> <password> <ssh|telnet> <timeout_in_secs>
    nnn.nnn.nnn.nnn    <userid>    <password>  ssh         <timeout_in_secs>
    nnn.nnn.nnn.nnn    <userid>    <password>  telnet      30
    commands.list
    # term length 0 needed or else IOS will wait for an enter to be pressed at the  --More-- prompts
    term length 0
    show run
    exit
    Script:
    # Run batch commands against one or more devices
    package require Expect
    exp_log_user 0
    set exp_internal 0
    set exp::nt_debug 0
    set prompt "(#\s*$|>\s*$)"
    set env(TERM) dumb
    set file_channel  [open "devices.list" r]
    set DEVICES      [read $file_channel]
    close $file_channel
    set file_channel  [open "commands.list" r]
    set COMMANDS      [read $file_channel]
    close $file_channel
    set command_entries [split $COMMANDS "\n"]
    set device_entries  [split $DEVICES "\n"]
    proc timedout {{msg {none}}} {
          send_user "Timed out (reason: $msg)\n"
          if {[info exists ::expect_out]} { parray ::expect_out }
          exit 1
    foreach device_entry $device_entries {
          if {[string length $device_entry] == 0 || [regexp {[ \t]*#} $device_entry]} { continue }
          set device  [lindex $device_entry 0]
          set user    [lindex $device_entry 1]
          set pass    [lindex $device_entry 2]
          set mode    [lindex $device_entry 3]
          set wait    [lindex $device_entry 4]
          set serial  [lindex $device_entry 5]
          # puts "Device=$device"
          # puts "User=$user"
          # puts "Mode=$mode"
          # puts "Wait=$wait"
          set timeout $wait
          # Spawning the Session
          # If you are logging on to the remote machine using "ssh", "slogin" or "rlogin", the information
          # gets processed in a slightly different manner. With any of these methods, it is necessary to
          # include an additional -l option to specify a username.
          # Next, the $spawn_id variable is captured, storing information about this spawn session in
          # memory for future reference.
          # If you are logging in via Telnet, the final code block in this section is required to pass the
          # username to Telnet. If the login is completed before the script times out, the exp_send command
          # passes the username.
          switch -exact $mode {
                "telnet" { set pid [spawn plink -telnet -l $user $device] }
                "ssh"   { set pid [spawn plink -ssh -l $user -pw $pass $device] }
                "serial" { set pid [spawn plink -serial $serial -l $user -pw $pass $device] }
          set id $spawn_id
          if {$mode == "telnet"} {
                expect -i $id timeout {
                timedout "in user login"
                } eof {
                timedout "spawn failed with eof on login"
                } -re "(login|Username):.*" {
                exp_send -i $id -- "$user\r"
          # Handling Errors
          # The error-handling section of the script is a while loop that anticipates a number of problems
          # that could occur during login. This section is not exhaustive. For example, you could also add
          # provisions for invalid usernames and passwords.
          # If the login is not completed during the allotted time frame, which is set from the devices.list file
          # and specified with expect -i $id timeout, the program displays an appropriate error message.
          # The remainder of this loop makes use of the exp_send command to allow for other scenarios, such
          # as the user typing "yes" when prompted to proceed with the connection, entering a password, or
          # resetting the terminal mode.
          set logged_in 0
          while {!$logged_in} {
                expect -i $id timeout {
                timedout "in while loop"
                break
                } eof {
                timedout "spawn failed with eof"
                break
                } "Store key in cache? (y/n)" {
                exp_send -i $id -- "y\r"
                } -re "\[Pp\]assword:.*" {
                exp_send -i $id -- "$pass\r"
                } "TERM = (*) " {
                exp_send -i $id -- "$env(TERM)\r"
                } -re $prompt {
                set logged_in 1
          foreach command $command_entries {
                if {[string length $command] == 0 || [regexp {[ \t]*#} $command]} { continue }
                # Sending the Request
                # If the login is successful, the code in the if statement below is used to send the "cmd" request
                # to display files and directories. After the request is sent with exp_send, the resulting output
                # is captured in the dir variable, which is set on the fourth line of the code shown below.
                if {$logged_in} {
                      exp_send -i $id -- "$command\r"
                      expect -i $id timeout {timedout "on prompt"} -re $prompt
                      puts "$expect_out(buffer)"
                # Closing the Spawned Session
                # The exp_close command ends the session spawned earlier. Just to be sure that session
                # does indeed close, the exp_wait command causes the script to continue running until a result is
                # obtained from the system processes. If the system hangs, it is likely because exp_close was not
                # able to close the spawned process, and you may need to kill it manually.
          catch { exp_close -i $id }
          exp_wait -i $id
          set logged_in 0
    *** End of Document ***

    Your friend will have to save the templates as CS6, which he can do.

  • Cannot print on a USB printer with Java PrintService in Windows 2000. Why?

    I want to print a simple ASCII file on a USB printer under Win2K and
    found 2 problems. Here is the 2nd one.
    Even though
    PrintServiceLookup.lookupPrintServices(<DocFlavor>, <AttributeSet>)
    returns nothing when I specify any AttributeSet, I can still print on the default printer, which I get by
    PrintService defServicedefService = PrintServiceLookup.lookupDefaultPrintService();
    but only on a parallel printer (HP Laserjet 4 Plus), either directly attached or over the network. When I try the very same code on a locally USB-attached printer, the printer is obviously reacting, but nothing is printed.
    In case of a Lexmark 730 (an ink printer), the driver even lies, it has printed 100%,
    on a Samsung CLP-510 (a color laser) the ready light flashes twice, that's all.
    The file to be printed has 5 lines and a "0C"X at the end in order to force a page eject at the end.
    I tried it with JDK 1.4.2 and with Java 6, same problem.
    I should mention that I can print that little file out of the editor Textpad without any problem.

    Thanks a lot for the quick hint, but it did not help.
    I used BasicPrint.java and PrintJobWatcher.java of the samples for testing.
    Printing a GIF file works both to a parallel printer and a USB printer.
    Then I changed only the DocFlavor from DocFlavor.INPUT_STREAM.GIF to DocFlavor.INPUT_STREAM.AUTOSENSE, and that one works with my parallel printer, but on the USB printer the Ready light flashes twice, that's all.
    The ASCII file must have a "0C"X at the end to force a page eject on the parallel printer
    Maybe it is a matter of the DocFlavor, but which one?
    DocFlavor("application/octet-stream", "java.io.InputStream") works like DocFlavor.INPUT_STREAM.AUTOSENSE.
    DocFlavor.INPUT_STREAM.TEXT_PLAIN_HOST and DocFlavor.INPUT_STREAM.TEXT_HTML_US_ASCII cause sun.print.PrintJobFlavorException, and with DocFlavor.INPUT_STREAM.TEXT_PLAIN_US_ASCII just nothing happens on either printer, not even an error message.
    I am getting the impression that nobody of the developers ever cared for testing such a simple thing as a plain ASCII file under Windows.
    My printers I am using for the tests are
    1. an old parallel-attached HP Laserjet 4 Plus and
    2. a borrowed USB-attached Samsung CLP-510 color laser

  • Cannot print on a USB printer with Java PrintService in Windows 2000

    I want to print a simple ASCII file on a USB printer under Win2K and
    found 2 problems. Here is the 2nd one.
    Even though
    PrintServiceLookup.lookupPrintServices(<DocFlavor>, <AttributeSet>)
    returns nothing when I specify any AttributeSet, I can still print on the default printer, which I get by
    PrintService defServicedefService = PrintServiceLookup.lookupDefaultPrintService();
    but only on a parallel printer (HP Laserjet 4 Plus), either directly attached or over the network. When I try the very same code on a locally USB-attached printer, the printer is obviously reacting, but nothing is printed.
    In case of a Lexmark 730 (an ink printer), the driver even lies, it has printed 100%,
    on a Samsung CLP-510 (a color laser) the ready light flashes twice, that's all.
    The file to be printed has 5 lines and a "0C"X at the end in order to force a page eject at the end.
    I tried it with JDK 1.4.2 and with Java 6, same problem.
    I should mention that I can print that little file out of the editor Textpad without any problem.
    Edited by: eSchobbert on Jan 24, 2008 11:34 AM
    By mistake I entered the same message another time after modifying the Subject instead of replacing the message. Sorry for that. If I knew how to delete it, I would. So please just ignore this one

    Thanks a lot for the quick hint, but it did not help.
    I used BasicPrint.java and PrintJobWatcher.java of the samples for testing.
    Printing a GIF file works both to a parallel printer and a USB printer.
    Then I changed only the DocFlavor from DocFlavor.INPUT_STREAM.GIF to DocFlavor.INPUT_STREAM.AUTOSENSE, and that one works with my parallel printer, but on the USB printer the Ready light flashes twice, that's all.
    The ASCII file must have a "0C"X at the end to force a page eject on the parallel printer
    Maybe it is a matter of the DocFlavor, but which one?
    DocFlavor("application/octet-stream", "java.io.InputStream") works like DocFlavor.INPUT_STREAM.AUTOSENSE.
    DocFlavor.INPUT_STREAM.TEXT_PLAIN_HOST and DocFlavor.INPUT_STREAM.TEXT_HTML_US_ASCII cause sun.print.PrintJobFlavorException, and with DocFlavor.INPUT_STREAM.TEXT_PLAIN_US_ASCII just nothing happens on either printer, not even an error message.
    I am getting the impression that nobody of the developers ever cared for testing such a simple thing as a plain ASCII file under Windows.
    My printers I am using for the tests are
    1. an old parallel-attached HP Laserjet 4 Plus and
    2. a borrowed USB-attached Samsung CLP-510 color laser

  • Trouble using Run Shell Script with python in Automator

    Hi. I have a python script I want to run in Automator (update_puzzles.py). All it does is check, rearrange and update files and there is not supposed to be any input. I can get the script to run outside of Automator, in Terminal, by navigating to the right directory and typing "python update_puzzles.py"
    I must not be setting up Run Shell Script correctly. I have it set to /bin/bash and Pass Input to stdin. The command line simply reads python /pathname/update_puzzles.py (where pathname is the path to the .py file, which I got by dragging the file onto the Run Shell Script command window). There are no actions before this in my workflow and the action after is View Results.
    The log says Run Shell Script failed, and the error is "Traceback (most recent call last):"
    Any suggestions?
    Thanks so much.

    If the script is expecting to do stuff with files in the same directory as the executable, you will probably need to add a statement to change to the appropriate working directory. The shell used in the Automator *Run Shell Script* action is a generic one that does not share any of the environment variables that the Terminal uses.

  • How to run sscript shell with java program

    Hi everybody,
    i want to know how can i do to execute a script shelle (bash) with program java (if it s possible)
    for example this script:
    #!/bin/bash
    echo "hello"
    can i run it with java program or i have to make dome modifications .
    thank you for your help in advance.

    Well, if you want to be portable across platforms, you should write as much code in Java as possible and not rely on native scripts (I'm sure your script is more complex than this 'echo' example ;-) ).
    Having said that, you can use the java.lang.Runtime class and in particular its various exec() methods.
    Try something like this:
    Process p;
    try {
        p = Runtime.getRuntime().exec("myscript.sh");
    } catch (IOException ioe) {
    }You can then "interact" with the spawned process with the Process object returned by the exec method.
    Note you need to have the appropriate security rights.
    For more details, look at the API documentation here:
    http://java.sun.com/j2se/1.4.2/docs/api/
    hth,
    -Alexis

  • CS3 JS create textFrame with label then change content at a later stage.

    Is it possible to select a textframe by label?
    Here is a simple script which creates 2 text boxes labeled JSLabel and JSLabel2.
    var myDocument = app.documents.add();
    var myTextFrame = myDocument.pages.item(0).textFrames.add();
    myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
    myTextFrame.contents = "Hello World!";
    myTextFrame.label = "JSLabel";
    var myTextFrame = myDocument.pages.item(0).textFrames.add();
    myTextFrame.geometricBounds = ["8p", "8p", "24p", "24p"];
    myTextFrame.contents = "Hello World Again";
    myTextFrame.label = "JSLabel2";
    Here is a script you can run at a later stage to change the content of JSLabel textframe.
    if (app.activeDocument.textFrames[1].label == "JSLabel"){
    var mySelect = app.activeDocument.textFrames[1];
    app.select (mySelect);
    mySelect.contents = "Text has been changed.";
    Rather than using if (app.activeDocument.textFrames[1].label == "JSLabel") can I just select the textframe labeled JSLbel and change the content?

    Just bear in mind that if you have multiple frames with the same label, they'll all be affected if you set the content.
    Dave

  • Problem with Java scrolling text window on Mac OS

    The Java scrolling text window created by AWT "TextArea" scrolls in the normal way from the top on Windows, whereas it scrolls from the bottom on the Mac OS. That is, the text file is first displayed from the bottom on Mac, so that the user has to scroll to the top of the file each time a new page is opened, which is a very nuisance. Have you run into this problem and do you know how to over-ride the Mac OS default? Many thanks.

    TextAreas suck in general, this has been discussed many time in the forum. As a duct-tape fix, you might play around with setCaretPosition() after inserting your new text. Good luck

  • Run several scripts with one master script or an automator workflow?

    I have several scripts that I need to run all at once...
    Could I make a script that would run all the other scripts, then bundle everything into an application( or something similar) so all my scripts would run with just a double click...
    Any ideas?

    Yes, this is possible. Save your master script as either an application or a script bundle (whichever is most convenient). Then, save all of your subscripts inside the bundle.
    You can then load and run the scripts from your master script. The following code does that:
    set aScriptFile to load script file (path to me as string) & "Any additional subfolders" & "Script File Name.scpt"
    run aScriptFile
    Note that "path to me" will not work properly when the script is run from within script editor. It will, however, work when run from the script menu. See the following for a discussion of that:
    http://discussions.apple.com/message.jspa?messageID=2789538

Maybe you are looking for

  • Safari hangs when loading web pages.

    I'm new to the Mac and had my machine less than a week. However, I'm having problems with Safari/Internet. Generally it's fine, but from time to time Safari hangs and it can take a few minutes for it to spring back into life and load the desired web

  • Upgraded system. Gnome problems.

    Hi, I just ran a system upgrade and I now can not login to gnome. From slim I get to being able to see my desktop background, and then it crashes, displaying a nondescript error message within a dialog, which starts of (recalled from memory): Oh no!

  • How to recover videos from trash on iPad

    How do u recover videos from trash on ipad

  • Contacting UK Customer Services

    What a mess is the so called customer services and fault reporting system with BT. Why oh why does BT think that by using India based call centres helps their customers (I suspect it is more based on profit motives than "service"). All I wanted BT to

  • Error Downloading iphone update.

    *I try to download iphone firmware 2.1 using iTune but after sometime downloading stops wit error = -3259 (Network Connection Timed out, Make Sure your network Connection are correct and active and try again later).* *im really fed up wit this, pls c