Jump to content
Sign in to follow this  
toreolsen

Auto-It missing shift stroke - Remote Desktop - Latency Issue?

Recommended Posts

toreolsen

I am writing a script that that will:

1. copy selected text from a text editor on my machine

2. ClipGet it to a string

3. Change to the Remote Desktop window and send the string to the remote window.

The remote desktop I work on will not allow copy and paste between computers, so this seems to be my only solution.

It generally works perfectly, but on high latency connections (I remote desktop to a server in Denmark, and from there remote desktop to another server), sometimes (often) "*" becomes "8", etc (missing shift key stroke?).

Using the example above it seems that since * is shift+8, the latency causes the shift key and the 8 key signal to get dissociated. Anyone has an idea what to do about this?

Regards,

Tore

; Declare variables

Global $remotewin, $tekst

$remotewin = "XXX.XXX.XXX.XXX - Remote Desktop"

; Copy selected text to clipboard

Send("^4")

Send("^c")

; Write clipboard contents into string variable

$tekst=ClipGet()

; Setting WinWaitDelay

Opt("WinWaitDelay", 200)

; Activate remote desktop window

WinActivate($remotewin)

WinWaitActive($remotewin)

; Select all text in receiving window

Send("^4")

Send("^a")

;Send keys to Remote Desktop Window

Sleep(100)

opt("SendKeyDelay",100)

Send($tekst,1)

Share this post


Link to post
Share on other sites
martin

Might want to check this out: http://www.autoitscript.com/forum/index.ph...mp;#entry512706

and see if it helps.

I would think that was not the problem because it'snot that the key stays down when it shouldn't but that it doesn't appear to be down when it should be.

Is the character '*' which appears as '8' being sent as "+8" or as "*" ?

Are there any differences between the keyboard layouts on the two machines?


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.

Share this post


Link to post
Share on other sites
toreolsen

I would think that was not the problem because it'snot that the key stays down when it shouldn't but that it doesn't appear to be down when it should be.

Is the character '*' which appears as '8' being sent as "+8" or as "*" ?

Are there any differences between the keyboard layouts on the two machines?

Martin,

Thanks for your reply. I go through several remote desktops. One was set to Danish keyboard. Following you good advice I changed that to US keyboard to match the other machines. However, I still sometimes get '8' instead of '*'. And sometimes AutoIt misses a keystroke (instead of typing 'keep' it types 'eep' etc).

I am sorry to be such a newbie, but I don't know if * is being sent as '*' or '+8' because my script just copies what is selected in my text editor, writes it to a string variable and then types it to the remote computer. How do I find out how it sends the characters?

Regards,

Tore

; Declare variables

Global $remotewin, $tekst

$remotewin = "xxx.xxx.xxx.xxx - Remote Desktop"

; Copy selected text to clipboard

Send("^4")

Send("^c")

; Write clipboard contents into string variable

$tekst=ClipGet()

; Reduce WinWaitDelay to speed up script

Opt("WinWaitDelay", 200)

; Activate remote desktop window

WinActivate($remotewin)

WinWaitActive($remotewin)

; Select all text in receiving window

Send("^4")

Send("^a")

;Send keys to Remote Desktop Window

Sleep(100)

opt("SendKeyDelay",50)

Send($tekst,1)

Share this post


Link to post
Share on other sites
toreolsen

Might want to check this out: http://www.autoitscript.com/forum/index.ph...mp;#entry512706

and see if it helps.

ResNullius,

Thanks for your reply. I read the FAQ and maybe am just too newbee, but I did not find the response. I think the issue I have might be related to network latency because I need to go through several remote desktops, but I do not have deep enough understanding of AutoIt to resolve the issue. Any further help would be appreciated.

Regards,

Tore

Share this post


Link to post
Share on other sites
martin

I don't know what the problem is and I don't have that much experience with Send problems. It is worth experimenting with the AutoItSetOption SendKeyDownDelay in case it helps.

I would expect that the * is being sent as Send("*") but I don't know how AutoIt deals with this internally or rather how Windows deals with this. Because * is Shift plus 8 on many keyboards and because you get 8 appearing instead of * then it must mean that somewhere it is translated into the key combination required to type that character. Presumably you could detect all * characters in the text to be sent and replace them with SHIFTDOWN delay, '8' then SHIFTUP.

Otherwise can you run scripts on the remote PC's? If so then there might be more reliable ways to do what you want.


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.

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  

×