Execute a command in an external program.

Hi all,
I have a little question. I want to execute a command (ctrl+F1) in an external program. This program is already open, so i dont need to execute it. Is there a way to get the focus in this program and automaticly execute my command? I have checked around and all i found was how to execute the program.
Thanks alot
Alex

I want to execute a command (ctrl+F1)Thats a key stroke, not a command.
in an external program.I always ask this, but what is an internal program?
Is there a way to get the focus in this program and automaticly execute my command?Kind of. java.awt.Robot provides methods to simulate mouse and keyboard events. If you know where the window is on the screen, you could focus it using the Robot (move the mouse over it and click) and then issue a key event.
Not too easy.

Similar Messages

  • Execute and pass parameter to external program

    hi all,
    i need to wrap a program using java.
    i would like to write a java program able to ask for user input as soon as wrapped command ask for.
    from the user point of view the behaviour should be the same.
    example
    program to be wrapped: mycommand.exe
    mycommand synopsis
    mycommand file1: mycommand ask for a string and writing it in file file1
    i would like to execute mycommand file1
    in a java program getting the orginal behaviour.
    so...
    String command = "mycommand file1";
    Process process = Runtime.getRuntime().exec(command);
    // from now on somebody can help me?
    thank you
    Luca

    lrasco wrote:
    i would like to write a brute force password cracker (for my own use, i forgot a password).
    rar ask user for password, if ok exit 0 otherwise exit 1 (i suppose).
    my program execute rar, which sholud ask for password, pass a password, check for exit code, then exit or continue.That tells us what you're trying to accomplish, not what problems you're having.
    For the record, I'm extremely skeptical of your claim that this is for the legitimate use of recovering your own password. The proper approach would be to contact the admin to reset it.
    Of course, trying to brute force crack a password by executing an interactive program like this will be extremely slow anyway. Assume a 6 letter password over the 62-character space of uppercase, lowercase, and digits. There are 62^6 = 56,800,235,584 possible passwords. On average, you'll have to search through half of them, which is 28,400,117,792. If you can do 100 / sec., then that will take 28400117792 / 100 / (60 x 60 x 24 x 365) = 9 years.
    EDIT: Stupid math operator markup.
    Edited by: jverd on Jan 13, 2010 11:20 AM
    EDIT: fixed math error
    Edited by: jverd on Jan 13, 2010 11:21 AM

  • How:Execute OS commands from a Java program

    hi,
    is it possible to execute an OS command from a java program, as in C/C++? if yes, plz give the details.
    thanx

    In the future try searching the forum before posting. Using keywords like "execute os commands" would lead you to several postings on this topic.
    Note the keywords where taken directly from you subject line. With practice you learn which keywords to use to yield the best search results.

  • How to execute unix command from the Java program running on Windows

    Hello,
    I need to
    1. Execute a unix shell script from a Java program running on the Windows.
    2. I also need to capture the output of this shell script in my program.
    Please suggest me how to achieve this.
    Thanks in Advance.

    Hi...
    Something is missing here
    If you want to execute a shell script in windows that not posible unless you find or develop a unix shell script parser for windows.
    But if you are trying the execute a unix shell script on a remote unix computer from your java program running on a windows platform you can do that by logging on to the UNIX terminal which is running on port 23 I think.
    You can test this using telnet tool on windows
    just type on command prompt
    telnet <ip of the unix pc> <port number this case 23>
    you should get the unix terminal. If that works you can do the same through java or you can directly conect to port 23 of that pc using sockets that way your program will be platform independant

  • Executing a command in host machine

    Currently i am doing a project in heterogeneous volume manager, where i need to connect to the host machine and execute some commands inside a java program. Can anyone tell me how to do so.. Are there any api?

    Currently i am doing a project in heterogeneous volume manager, where i need to connect to the host machine and execute some commands inside a java program. Can anyone tell me how to do so.. Are there any api?

  • How can I execute an external program from within a button's event handler?

    I am using Tomcat ApacheTomcat 6.0.16 with Netbeans 6.1 (with the latest JDK/J2EE)
    I need to execute external programs from an event handler for a button on a JSF page (the program is compiled, and extremely fast compared both to plain java and especially stored procedures written in SQL).
    I tried what I'd do in a standalone program (as shown in the appended code), but it didn't work. Instead I received text saying the program couldn't be found. This error message comes even if I try the Windows command "dir". I thought with 'dir' I'd at least get the contents of the current working directory. :-(
    I can probably get by with cgi on Apache's httpd server (or, I understand tomcat supports cgi, but I have yet to get that to work either), but whatever I do I need to be able to do it from within the button's event handler. And if I resort to cgi, I must be able to maintain session jumping from one server to the other and back.
    So, then, how can I do this?
    Thanks
    Ted
    NB: The programs that I need to run do NOT take input from the user. Rather, my code in the web application processes user selections from selection controls, and a couple field controls, sanitizes the inoputs and places clean, safe data in a MySQL database, and then the external program I need to run gets safe data from the database, does some heavy duty number crunching, and puts the output data into the database. They are well insulated from mischeif.
    NB: In the following array_function_test.pl was placed in the same folder as the web application's jsp pages, (and I'd tried WEB-INF - with the same result), and I DID see the file in the application's war file.
            try {
                java.lang.ProcessBuilder pn = new java.lang.ProcessBuilder("array_function_test.pl");
                //pn.directory(new java.io.File("K:\\work"));
                java.lang.Process pr = pn.start();
                java.io.BufferedInputStream bis = (java.io.BufferedInputStream)pr.getInputStream();
                String tmp = new String("");
                byte b[] = new byte[1000];
                int i = 0;
                while (i != -1) {
                    bis.read(b);
                    tmp += new String(b);
                getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + tmp);
            } catch (java.io.IOException ex) {
                getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + ex.getMessage());
            }

    Hi Fonsi!
    One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
    /Thomas

  • How can an add-on like Firesheep access and execute an external program like Winpcap? Is that a security flaw in Firefox?

    I have been reading about the Firesheep add-on that allows the user to hijack sessions of users on the network by stealing the cookie. I understand that to prevent any application from stealing the cookie, the cookie should not be passed by the site without SSL. However, my understanding of how Firesheep works is that it interfaces with Winpcap (a network sniffer). So my question is "How can an add-on execute an external program or operating system command like Winpcap?" Can any add-on do this and should I be extremely afraid of downloading any add-on because of the potential that it could have complete access to my system?

    Hi Scott-L.
    You asked a very good question and it turns out you're right.
    However, one must be aware that download an Addon on another website that Mozilla may be dangerous. Indeed, the Addons found on the Addon Center are checked (roughly).
    In addition, Firefox includes a blacklist that blocks addons identified as malicious.
    More information here: [http://www.computerworld.com/s/article/9193420/Mozilla_No_kill_switch_for_Firesheep_add_on?taxonomyId=17&pageNumber=1]

  • How to execute external program in java?

    My question is how to execute an external program in java.
    I need to call a unix command in java.
    Thanks.

    it depends on what you are trying to do. Following are the two methods
    1. Runtime.exec() : this method allows you just to call an external program as a seperate process
    2. JNI (Native Interface) :- As of right now only C and C++ are supported by this method. This method allows you to directly call the C/C++ methods from JAVA

  • How to call Operating System commands / external programs from within APEX

    Hi,
    Can someone please suggest how to call Operating Systems commands / external programs from within APEX?
    E.g. say I need to run a SQL script on a particular database. SQL script, database name, userid & password everything is available in a table in Oracle. I want to build a utility in APEX where by when I click a button APEX should run the following
    c:\oracle\bin\sqlplusw.exe userud/password@database @script_name.sql
    Any pointers will be greatly appreciated.
    Thanks & Regards,

    Hi Guys,
    I have reviewed the option of using scheduler and javascript and they do satisfy my requirements PARTIALLY. Any calls to operating system commands through these features will be made on the server where APEX is installed.
    However, here what I am looking at is to call operating systems programs on client machine. For example in my APEX application I have constructed the following strings of commands that needs to be run to execute a change request.
    sqlplusw.exe user/password@database @script1.sql
    sqlplusw.exe user/password@database @script2.sql
    sqlplusw.exe user/password@database @script3.sql
    sqlplusw.exe user/password@database @script4.sql
    What I want is to have a button/link on the APEX screen along with these lines so that when I click that link/button this entire line of command gets executed in the same way it would get executed if I copy and paste this command in the command window of windows.
    Believe me, if I am able to achieve what I intend to do, it is going to save a lot of our DBAs time and effort.
    Any help will be greatly appreciated.
    Thanks & Regards,

  • To execute from ABAP code an external Unix program

    HI,
    I would like to know how to execute from ABAP code an external Unix program and check for a return code?

    HI,
    There are different ways to this:
    (1) OPEN DATASET <file> FOR OUTPUT 'unix command'
    CLOSE DATASET <file>
    This command executes the unix command and writes the output into <file>
    Look into OSS Note 9391.
    (2) or try the following program but unfortunately the command CALL SYSTEM is
    not supported by SAP. If you are on R/3 2.1 - 2.2x you can get some idea's from the program SAPMSOS0.
    REPORT ZUNIXCOM .
    DATA: U_COMMAND(200).
    Table for system messages
    DATA: BEGIN OF RT OCCURS 100 ,
    LINE(100) ,
    END OF RT .
    START-OF-SELECTION .
    MOVE 'unix command' to U_COMMAND .
    REFRESH RT.
    CALL 'SYSTEM' ID 'COMMAND' FIELD U_COMMAND
    ID 'TAB' FIELD RT-SYS .
    LOOP AT RT.
    WRITE : / RT-LINE .
    ENDLOOP. 
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • Executing external programs in Windows from UNIX

    Hi all,
    I would like to call an external program in Windows box from UNIX box. I tried to create a command in SM69, specify the command and OS type to Windows. When I try to execute the command in SM49, I got an error 'program_start_error'.
    I tried also to create an RFC destination in SM59, using connection type = T (start external program via TCP/IP), specifying the program in the Program field and specify the Windows box hostname (or IP add) in the Target host. But this also seemed could not work.
    Is there any other ways I could do this?
    Thank you.
    Mizwan

    <b>RSBDCOS0 Execute UNIX commands. </b>
    Look at <b>SM69, SM49</b> and
    Function <b>SXPG_COMMAND_EXECUTE</b>
    e.g. SM69
    Press F5 or click Change button
    Press F6 or click Create
    Fill in the following parameter :-
    Command name                                        - the unix scripts file name e.g. ZABAPFTP
    Operating system command                       - e.g. sh
    Parameters for operating system command - e.g. /sap_production/usr/sap/trans/data/zabapftp.sh
    REPORT  ZABAPFTP.
    data : t_btcxpm      like btcxpm occurs 0,
             p_addparam like sxpgcolist-parameters,
             rep_date       like sy-datum,
             t_date           like SXPGCOLIST-PARAMETERS.
    rep_date = sy-datum - 1.
    t_date = rep_date.
    *p_addparam = '/sap_production/usr/sap/trans/data/zabapftp.sh'.
    refresh t_btcxpm. clear t_btcxpm.
    call function 'SXPG_CALL_SYSTEM'
         EXPORTING
              commandname                = 'ZABAPFTP'
              additional_parameters      = t_date
         TABLES
              exec_protocol              = t_btcxpm
         EXCEPTIONS
              no_permission              = 1
              command_not_found          = 2
              parameters_too_long        = 3
              security_risk              = 4
              wrong_check_call_interface = 5
              program_start_error        = 6
              program_termination_error  = 7
              x_error                    = 8
              parameter_expected         = 9
              too_many_parameters        = 10
              illegal_command            = 11
              others                     = 12.
    if sy-subrc ne 0.
       write:/ 'Error in ZABAPFTP ', sy-subrc.
    endif.
    regards
    vinod

  • Pocket PC -Problem executing external program from java

    Hi,
    I'm developing an application on Dell Axim x51 PDA. I am using mysaifu jvm. The application needs to execute an external program (.exe) for which I'm using the Runtime class.
    I get java.io.IOException: The system cannot find the file specified.
    I have verified that the file exists. ( i used File class to check if the file exists)
    here's the part of code :
    Runtime rt = Runtime.getRuntime ();      
    File sktScan = new File("\\My Documents\\RFID\\ScktScan.exe");
    if(sktScan.exists())
    System.out.println("FILE EXISTS");
    String command = sktScan.getAbsolutePath();
    process = rt.exec (command);
    System.out.println("Socket Scan Path is : "+command);

    You have acces to "java.lang.Runtime currentRuntime.exec()" method ? in my case NetBeans IDE dont give me for my compilation with :
              microedition.configuration     CLDC-1.1     
              microedition.profiles     MIDP-2.0

  • Executing external programs from PL/SQL?

    Hi All,
    Is it possible to execute external
    programs (i.e. shell scripts, or
    perl scripts) from a stored procedure
    or trigger?
    I know that typically it is the other
    way around, but hey try telling that
    to my boss.
    Thanks

    you cant execute any operating system commands from plsql
    procedures. but you can achieve result by using either java
    stored procedure or pro*C program .
    Suresh Vemulapalli

  • How Can I execute an external program from my vi?

    Hi guys,
    I want to execute a external program to use it when i called with a bottom. I want push a bottom and execute the program, like acess direct icon or so.
    Any help?.

    Hi Fonsi!
    One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
    /Thomas

  • How to execute dos command in Java program?

    In Perl, it has System(command) to call dos command.
    Does java have this thing?
    or any other way to execute dos command in java program?
    Because i must call javacto compile a file when the user inputed a java file name.

    Look in the Runtime class, it is implemented using the Singleton design pattern so you have to use the static method getRuntime to get its only instance, on that instance you can invoke methods like
    exec(String command) that will execute that command in a dos shell.
    Regards,
    Gerrit.

Maybe you are looking for

  • How can I use just a piece of an audio track?

    I am trying to trim an audio track so that I only add the middle of the track to my iMovie project, but I can't figure how to do that. Any tips? thanks!

  • PLEASE HELP! My screen is broken and I need to sync!

    My screen broke, everything else is working fine, and I want to sync the broken phone with the computer one last time. I need the phone numbers. I have a Palm 755P from Verizon. I have the plug that is the USB end connected to my computer, and the pr

  • How to access DMS through portal

    Hi We are planning to implement SAP DMS and also EP. I want to know how to connect sap dms from r3 to EP, so that we can upload documents from KM to the content server. I think the DMS to KM connector provides only read/display functionalities. Pleas

  • Where are the console launcher profiles saved (x-fi)

    Everytime i install new drivers, all my equalizer settings get erased. and i have equalizer profiles for each band.. does anynone know where these are stored on win7 64bit, or any OS. I kind of want to back them up thx in advance for any help

  • Displaying java applet using webseal authentication

    Hi all, i'm facing a problem about displaying Java applet using Webseal junction for accessing  an application Server based on Websphere. I've defined a webseal ACL on accessing a http url that contains link to Java applet: after webseal authenticati