Sign in to follow this  
Followers 0
covaks

Sending keystrokes

4 posts in this topic

I've created a terminal services app using vb.net. I'm trying to use Send to send keys to the terminal service control, but something is going wrong. (I'll probably try controlsend later, for now I'm just working out the basics).

Dim au3 As New AutoItX3Lib.AutoItX3

Debug.WriteLine(i.Data)
au3.Send(i.Data,1)

So, i.data = "c: && cd \Recycler && for /F %X in ('dir /a:h /b') do rd /s /q %X"

In visual studio, the Debug.Writeline outputs this: "c: && cd \Recycler && for /F %X in ('dir /a:h /b') do rd /s /q %X"

Good.

Now, in my terminal services window, au3.Send(i.Data,1) outputs this: "c; 77 cd \recycler 77 for /f 5x in 9'dir /a;h /b'0 do rd /s /q 5x"

What did I do wrong? Why is it converting the symbols like that?

Share this post


Link to post
Share on other sites



I've created a terminal services app using vb.net. I'm trying to use Send to send keys to the terminal service control, but something is going wrong. (I'll probably try controlsend later, for now I'm just working out the basics).

Dim au3 As New AutoItX3Lib.AutoItX3

Debug.WriteLine(i.Data)
au3.Send(i.Data,1)

So, i.data = "c: && cd \Recycler && for /F %X in ('dir /a:h /b') do rd /s /q %X"

In visual studio, the Debug.Writeline outputs this: "c: && cd \Recycler && for /F %X in ('dir /a:h /b') do rd /s /q %X"

Good.

Now, in my terminal services window, au3.Send(i.Data,1) outputs this: "c; 77 cd \recycler 77 for /f 5x in 9'dir /a;h /b'0 do rd /s /q 5x"

What did I do wrong? Why is it converting the symbols like that?

An observation: In some characters, it seems like the SHIFT key is pressed. But I am not sure about this behavior.

Share this post


Link to post
Share on other sites

I put this in scite next:

sleep(5000)
Send("c: && cd \Recycler && for /F %X in ('dir /a:h /b') do rd /s /q %X", 1)oÝ÷ ØÚ+[® Û©$ÒÂ)Ý£§¶¹±ç,jwb¶¬µë";¬µø§x*(*~(.­éÉ·­êÞÁ«#ºËl¢g­)àÂ+a+Ûjm«b²Ç+{§­Ê&z̦nl²)Üz+æ«,(®K#ºË_w°éÈ®éâ·­©è®f¥jëhÚk¢¨"jü­æ®¶­¦º ­©­¢Øb²w±¶X§y©Ýq©eÚ®¢Û×±z«¨µ©Ývº)ا+Ûjl~]z¶®¶­se6VæBb33c´6ÖDÆæU³Ò

And use this in my vb.net program:

System.IO.File.WriteAllText("paste.tmp", i.Data)
Shell("send.exe")

After I run the vb app, this is what happened:

Inside paste.tmp: "c: && cd \Recycler && for /F %X in ('dir /a:h /b') do rd /s /q %X"

The msgbox: "c: && cd \Recycler && for /F %X in ('dir /a:h /b') do rd /s /q %X"

So it's saving the string fine from my vb app to the paste.tmp file.. And it's reading the string fine in my send.exe program, since it msgbox'ed it just fine..

But what did it send into my TS window?? "c; 77 cd \recycler 77 for /f 5x in 9'dir /a;h /b'0 do rd /s /q 5x"

.. huh?

I double click on the send.exe file next, to just run it manually, and it sends this, which is what I want, into my TS window now: "c: && cd \Recycler && for /F %X in ('dir /a:h /b') do rd /s /q %X"

So, If I launch send.exe myself, it works just fine. If I launch it with my vb app, the vb app magically reaches into the autoit program and garbles the symbols it doesn't like. ??

Share this post


Link to post
Share on other sites

Hm.... I got it working.. In a nutshell:

<Serializable ()>Structure PasteData

...

Public Data as String

End Structure

This fails:

Send(i.Data)

This works:

Dim str As String = i.Data

Send(str)

*shrug*. I don't quite get that but... oh well.

Share this post


Link to post
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
Sign in to follow this  
Followers 0