Jump to content
Macro Express Forums
crimso

Waiting For The Prompt In Putty

Recommended Posts

Hello,

 

I use putty every day for repetitive tasks. I've tried to build some macros but I don't know how to deal with the prompt.

I want the macro to wait for the prompt before continuing (paste a text or anything else).

For the moment I use a delay of 2 seconds but it's not an optimal solution...

 

Could someone help me ?

Thanks

 

(and sorry for my english)

Share this post


Link to post
Share on other sites

Does it have a command prompt interface? Is the command screen availible as a control? I had one once where I was able to copy the entire contents of the screen to a text var and delete all but the last line. I did this over and over until the last line looked like what I wanted then I could start typing again.

 

BTW lost of apps like these supports scripts. Often the script handler will pause for the program to be ready for the next command. In cases like these it's easier to have ME create teh script file for you and run the script as a means of interface.

Share this post


Link to post
Share on other sites

There may be a more elegant solution, in fact there usually is, but without being familiar with the program I couldn't tell you. Check out ME's Windows Controls commands and see if you can utilize them. Another thought is if the command prompt always appears in the same spot and you can highlight it with the mouse or keyboard you could have ME do it repetitively until the prompt meets your criteria.

 

Another trick I’ve had with command line apps is to let ME be a slave to it or the script. IOW let the script drive the progress. Let’s say I wanted to upload several files by some FTP client. I could write a script to upload the file then when it’s done fire a macro. The macro could then do some file manipulation like queuing up the next file and then fire the script. You get a kind of back and forth this way and it eliminates all the timing issues. When the file is done uploading it runs the next line in the script and closes. This launches your macro to do something like get the next file name, modify the script file for said file and launch the script and quit.

 

Paul recently opened my eyes to MeProc.exe too which helps in this process, you might want to check it out if you go this way.

 

It’s one of those things where in order to come up with a cool method you have to understand all the ways ME works and your application. Without knowing your app it’s hard to say. Often people will come to me with a request for a macro and when I listen to what they propose I find much simpler way than they suggest by delving into the capabilities of the application itself. After all, this is what ME is all about.

Share this post


Link to post
Share on other sites

crimso,

 

I use putty daily for kicking of backups and have accomplished what I believe you are looking for with the following code:

 

    // Wait for backup setting prompt 
   Repeat Until %D1% = 1
     Activate Window: "DAYMISYS1.qdx.com - PuTTY"
     Mouse Move Window 12, 11                        <-------  Moves mouse to upper left corner to activate menu options
     Mouse Right Button Click
     Delay 0.1 Seconds
     Text Type: o                                    <-------  Activates Copy All to Clipboard command   
     Delay 0.2 Seconds
     If Clipboard Contains "or select a number to change a setting:"      <-------  Look for text of prompt that I am waiting for
     Repeat Exit                                     <-------  If found, exit loop and continue macro
     End If
     Delay 1 Seconds                                 <-------  If prompt is not found, continue loop
   Repeat End

 

<REM2:Wait for backup setting prompt ><REP3:08:000001:000003:0001:0:01:1><ACTIVATE2:DAYMISYS1.qdx.com - PuTTY><MMW2:12,11><RCLK><DELAY:.1><TEXTTYPE:o><DELAY:.2><IFOTH2:08:1:or select a number to change a setting:><EXITREP><ENDIF><DELAY:1><ENDREP>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...