RemoteClipboard help please

I’m confsued.

I’m running this code …


if WaitAndClick("CSUserUserName-End" ) then
	Set EndMouse to MouseLocation()
	if WaitAndClick( "CSUserUserName" ) then
		Set StartMouse to MouseLocation()

		typetext UserToAdd.UID2
					
		Click StartMouse
		mouseButtonDown( 1)
		MoveTo (EndMouse)
		MouseButtonUp( 1)
		TypeText "\cC\C"
		Set UserToAdd.UID2 = RemoteClipboard()
		log UserToAdd.UID2

	end if
end if


Function WaitAndClick
	params ImageName
	
	Set Ret = false
	if ImageFound( 8, ImageName ) then
		click FoundImageLocation()
		set Ret = true
	end if
	
	return Ret
	
end WaitAndClick



But here’s what the log says for that code …


Thu, 17/07/08 1:41:15 PM	imagefound	CSUserUserName-End	found at (656, 256)
Thu, 17/07/08 1:41:15 PM	click		at (656, 256)
Thu, 17/07/08 1:41:27 PM	imagefound	CSUserUserName	found at (433, 267)
Thu, 17/07/08 1:41:27 PM	click		at (433, 267)
Thu, 17/07/08 1:41:32 PM	typetext		whitee362
Thu, 17/07/08 1:41:34 PM	click		at (433, 267)
Thu, 17/07/08 1:41:37 PM	mousebuttondown		Button:1
Thu, 17/07/08 1:41:39 PM	moveto		at (656, 256)
Thu, 17/07/08 1:41:40 PM	mousebuttonup		Button:1
Thu, 17/07/08 1:41:48 PM	typetext		\cC\C
Thu, 17/07/08 1:41:53 PM	log							typetext UserToAdd.UID2


In the last line of the log, I am seeing … basically the stale content of the local clipboard, rather than what I believe should be in the clipboard. In this case, it looks like some code that I cut and pasted within my script editor window, prior to starting to run the script in question.

Here’s another set of results, this time I manually grabbed the contents of the field in question and stuffed it into the clipboard before resetting everything and starting the process afresh. Note that at the end of the process, although the typed text was “whitee363”, the remoteclipboard) call returned the stale value of “whitee362”


put remoteclipboard()
whitee362
Thu, 17/07/08 2:00:18 PM	imagefound	CSUserUserName-End	found at (656, 256)
Thu, 17/07/08 2:00:19 PM	click		at (656, 256)
Thu, 17/07/08 2:00:25 PM	imagefound	CSUserUserName	found at (433, 267)
Thu, 17/07/08 2:00:26 PM	click		at (433, 267)
Thu, 17/07/08 2:00:28 PM	typetext		whitee363
Thu, 17/07/08 2:00:30 PM	click		at (433, 267)
Thu, 17/07/08 2:00:44 PM	mousebuttondown		Button:1
Thu, 17/07/08 2:00:45 PM	moveto		at (656, 256)
Thu, 17/07/08 2:00:52 PM	mousebuttonup		Button:1
Thu, 17/07/08 2:00:53 PM	typetext		\cC\C
Thu, 17/07/08 2:01:00 PM	log		whitee362


Regardless, the MouseDown/MouseUp sequence correctly highlights the text I wish to copy, but the TypeText “\cC\C” does not seem to push that text into the clipboard.

What am I missing here, please?

The RemoteClipboard function can be used in a couple of ways - for your usage here you would want to provide a maximum wait time parameter for the remote clipboard indicating that you expect to receive a new clipboard as the result of the previous command.

For example, RemoteClipboard(5), will wait up to 5 seconds and if it doesn’t receive a clipboard update will raise an error.

For full details please refer to the RemoteClipboard() function in the Eggplant Reference.

I’ve tried that, but it doesn’t help.

And trying to see what’s in the clipboard if I pause the script and use the command line yields the same (incorrect) result.

What VNC Server are you working against?

Real VNC VNC Server Free Edition 4.1.2

I can very easily switch to TightVNC, but I’ve seen screen refresh issues using it.

I just spotted something in your code snippet. You probably want a lowercase c in your copy command

TypeText controlKey, "c"

I think the uppercase key is causing a shift key to be sent to the SUT.

See if that doesn’t help.

Curiouser and curiouser

[quote=“JonathanOSX”]I just spotted something in your code snippet. You probably want a lowercase c in your copy command

TypeText controlKey, "c"

I think the uppercase key is causing a shift key to be sent to the SUT.

See if that doesn’t help.[/quote]

Under the VNC that I was working with, no, it didn’t help. What I saw was the literals of what Eggplant had been told to type: “controlKeyc”. As if “controlKey” was an unitinialised variable.

So I switched from RealVNC to TightVNC, switched the code back to

typetext "\cc\C"

and it seemed to work.

So if that works, then well and good, but that is only when I’m working with a browser to a remote site. If/when I need my normal level of indirection, then I have to use RealVNC, because TightVNC seems to have some screen refresh issues with the indirect methods that I need to use to access the remote SUT.

Not a major issue yet, but potentially a problem. May have to look at UltraVNC.

So it sounds like the lowercase “c” was the solution (and may work with both VNC servers – it sounds like you changed two things at once so you’ll have to switch back to RealVNC to find out for sure).

As for controlKey, if it sent the literal text “controlKey” to your SUT then I think you must be running an older version of Eggplant. ControlKey and the other improved modifier keys were added in version 4.1.

Indeed I am … 4.01.

I should probably update. :slight_smile: