Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2007
    Location
    Baton Rouge, LA
    Posts
    65

    How to writes a string of text to a window cmd.exe prompt?

    Is there a way to press a button and allow it to type a string of text or command to an external Unix telnet prompt or window command prompt?

    Example:
    after telneting to a Unix server at the prompt:>
    I would like to execute the follow commands: cd /tmp and mkdir test.

  2. #2
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    Telnet? You can use the Socket plugin to connect to the Unix server, send commands and receive answers back...

    Ulrich

  3. #3
    Join Date
    Dec 2007
    Location
    Baton Rouge, LA
    Posts
    65
    Can autoplay Media Studio type keystroke on an external program like Unix windows or dos command prompt?

  4. #4
    Join Date
    Oct 2009
    Location
    Merton, United Kingdom
    Posts
    684
    You could give the window focus and then use ShadowUK's Send Keys freeware alternative.

    Or if you look around there was a Standard I/O example that uses LuaCOM to create a process and then send it strings of data and get the data back.

  5. #5
    Join Date
    Dec 2007
    Location
    Baton Rouge, LA
    Posts
    65

    I am lost.

    Can someone give me an example how to user LUACOM to do the following:

    Open putty.exe
    execute these commands:
    ssh -l test -pw test www.google.com
    cd /tmp
    eject
    exit

  6. #6
    Join Date
    Dec 2007
    Location
    Baton Rouge, LA
    Posts
    65
    I am clueless about LUACOM. Can someone give me a hints?

  7. #7
    Join Date
    Apr 2006
    Posts
    127
    Take a look at the Help about File.Run:

    sArgs = "ssh -l test -pw test www.google.com\n" .. "eject\n" .. "exit"

    File.Run("putty.exe",sArgs, "/tmp", SW_SHOWNORMAL, true);

    I have no idea if the above will work for you but a little bit of experimentation should get results.

    Another approach might be:


    File.Run("putty.exe","ssh -l test -pw test www.google.com", "/tmp", SW_SHOWNORMAL, false);

    File.Run("putty.exe","eject", "/tmp", SW_SHOWNORMAL, false);

    File.Run("putty.exe","exit", "/tmp", SW_SHOWNORMAL, false);

  8. #8
    Join Date
    Dec 2007
    Location
    Baton Rouge, LA
    Posts
    65
    I am manage to get this application work by using this method.

    Create a button call "Eject" and put this code into the "OnClick"

    -- Ask the user to turn off Caps Lock----------
    Dialog.Message("Caps Lock Warning", "Please turn off your Caps Lock", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

    File.Run("AutoPlay\\Docs\\putty.exe", "-ssh -l test -pw test www.google.com", "AutoPlay\\Docs", SW_SHOWNORMAL, false);
    File.Run("AutoPlay\\Docs\\SendKeys.exe", "5 10 \"www.google.com- PuTTY\" \"pwd{ENTER} eject{PAUSE 2} {ENTER} {PAUSE 2} exit{ENTER}\"", "", SW_SHOWNORMAL, false);
    Page.SetFocus("putty");

    Remember to put putty.exe and SendKeys.exe to your Docs folder.

    I have one question, how do I make a popup box to ask and allow to enter different site instead of www.google.com?

  9. #9
    Join Date
    Mar 2009
    Location
    -31.9554,115.85859
    Posts
    282
    jpdragon you are doing so well ... if you think about it for a second though ...

    You want a users Input right?... maybe a dialogue box

    Use the help file, that is what is there for, good luck

  10. #10
    Join Date
    Dec 2007
    Location
    Baton Rouge, LA
    Posts
    65

    I got it working!! Woalla.

    I finally got this working. I am very happy that I am manage to read through the help and figure it out myself.

    I would like to share this with everyone that needed. This application allow you to launch putty.exe telnet to a server and execute whatever command from unix window automatically.

    Put the code below to your "Onclick". Rember to put putty.exe and SendKey.exe to your Docs folder.

    -- Start ask the user to turn off Caps Lock----------
    Dialog.Message("Caps Lock Warning", "Please turn off your Caps Lock", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    -- End ask the user to turn off Caps Lock----------

    -- Start ask the user to enter an IP address Script --
    ask_ip = "";
    -- Loop until a valid IP address is entered or the user cancels.
    while (ask_ip == "") and (ask_ip ~= "CANCEL") do
    -- Prompt the user to enter IP address
    ask_ip = Dialog.Input("Enter IP", "Please enter WLG IP address:", "", MB_ICONQUESTION);

    -- If the user does not enter any text, display an error message. The loop will continue from the beginning
    if ask_ip == "" then
    result = Dialog.Message("Error", "The IP address you enter could not be processed. Please try again.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

    -- If the user entered a valid IP address and didn't cancel, continue to confirm IP address.
    elseif ask_ip ~= "CANCEL" then
    -- Ask user to confirm IP
    nChoice = Dialog.Message("Confirm IP", "You are enter "..ask_ip.."! Is this correct?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON2);

    -- If yes was chosen, exit the application.
    if nChoice == 6 then
    -- Start Loading Putty.exe and login to server --
    result = File.Run("AutoPlay\\Docs\\putty.exe", "-ssh -l tpadmin -pw tpadmin "..ask_ip.."", "AutoPlay\\Docs", SW_SHOWNORMAL, false);
    end
    end

    end
    -- End ask the user to enter an IP address Script --

    -- Start Loading SendKey.exe --
    File.Run("AutoPlay\\Docs\\SendKeys.exe", "5 10 \""..ask_ip.." - PuTTY\" \"pwd{ENTER} eject{PAUSE 2} {ENTER} {PAUSE 2} exit{ENTER}\"", "", SW_SHOWNORMAL, false);
    Page.SetFocus("putty");
    -- End Loading SendKey.exe --
    Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts