Jump to content

send keys


 Share

Recommended Posts

Hello, all. Not sure if this can be resolved, but figured I'd ask. I'm trying to send key strokes to the SSH Secure Shell application but it's not sending (rather the app isn't accepting) the "-". Note, this works everywhere else. Any thoughts? Here's what I've tried:

Opt("WinTitleMatchMode", 2)

winactivate("SSH Secure Shell", "")
winwaitactive("SSH Secure Shell", "")
sleep(100)
controlsend("SSH Secure Shell", "", 59648, 'find . type f mtime 1 xdev ls|awk ''{print $7, $8, $9, $10, $11}''|sort nr|head n 10' & @CR)

;send ('find . type f mtime 1 xdev ls|awk ''{print $7, $8, $9, $10, $11}''|sort nr|head n 10' & @CR)
Link to comment
Share on other sites

Hello, all. Not sure if this can be resolved, but figured I'd ask. I'm trying to send key strokes to the SSH Secure Shell application but it's not sending (rather the app isn't accepting) the "-". Note, this works everywhere else. Any thoughts? Here's what I've tried:

Opt("WinTitleMatchMode", 2)

winactivate("SSH Secure Shell", "")
winwaitactive("SSH Secure Shell", "")
sleep(100)
controlsend("SSH Secure Shell", "", 59648, 'find . type f mtime 1 xdev ls|awk ''{print $7, $8, $9, $10, $11}''|sort nr|head n 10' & @CR)

;send ('find . type f mtime 1 xdev ls|awk ''{print $7, $8, $9, $10, $11}''|sort nr|head n 10' & @CR)
Are you sure that is what your script has and that everything except the minus signs is sent? It looks to me like the double inverted commas around the curly braces should be quotation marks. Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

it's correct. What you are referring to is double single quotes and they are needed by autoit to properley wrap everything within the brackets in single quotes (the awk command). If you do this, you'll see the expected output. Thanks though.

Expected output: find . type f mtime 1 xdev ls|awk '{print $7, $8, $9, $10, $11}'|sort nr|head n 10

run("notepad.exe")
winwaitactive("Untitled - Notepad", "")
sleep(100)
send('find . type f mtime 1 xdev ls|awk ''{print $7, $8, $9, $10, $11}''|sort nr|head n 10', 1)
Edited by monte
Link to comment
Share on other sites

another piece to the puzzle: if I run the above and send this to notepad then copy it and paste it into the ssh window it also leaves out the "-". However, if I type the above into notepad, copy it and paste into the ssh window it works just fine, hmm....

Link to comment
Share on other sites

another piece to the puzzle: if I run the above and send this to notepad then copy it and paste it into the ssh window it also leaves out the "-". However, if I type the above into notepad, copy it and paste into the ssh window it works just fine, hmm....

Sounds strange.

If you send the string to notepad, then add some extra minus signs by typing them in and save the file, then examine the file with a hex editor can you see the difference between one set of minus signs and the other?

What operating system are you on?

Instead of - try using {-}

or try using & Chr(Asc('-')) &

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...