AutoHotkey Community

It is currently May 27th, 2012, 9:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Wait for Screen latency?
PostPosted: November 18th, 2011, 5:25 pm 
I'm very new to this tool, but I scanned the forums and couldn’t find an answer to my problem.

I am trying to test an application that has a lot of screen latency (a Citrix published application). Excel tasks such as moving cell to cell or sheet to sheet take a longer than they would if you were running Excel locally or on a connection with low latency.

I've created a script (used recorder) that automatically performs many repetitive tasks in the Citrix published Excel such as using the arrow keys to navigate in Excel, switching between sheets in a workbook etc.
Send, test{ENTER}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}test{DOWN}{DOWN}

The script works fine if there is no network latency between the lab PC and the hosted Citrix application, but because it can take 300ms for a key press to make a round trip in high latency situations, the script fails. The script is just sending one key press after another without waiting to see if the cursor actually moved in Excel.

I understand that I can add my own delays between the key presses, but my goal is to record the total time it takes the script to run during different latency situations. For this reason, I want the script to wait for one key press to "move the cursor" in excel before sending the next one.

Does anyone know if a way to do this? It seems that there may be specialized vendors for this type of thing (http://www.tevron.com/citratest.asp), but wanted to know if AutoHotkey can solve the problem.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2011, 8:25 pm 
Offline

Joined: February 17th, 2008, 8:52 pm
Posts: 314
Try using SetKeyDelay and or maybe some well placed Sleep commands.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Reply
PostPosted: November 18th, 2011, 8:37 pm 
I think that command would work if the goal was to 'manually' slow down the script to account for latency delays. My goal is to have the script adapt itself to varying latency condtions automatically based on how long it is actually taking beteen sending the key press, and the key press appearing on the screen. This way I can measure the time it takes to run through the whole script and compare that against the actual network latency. Right now, the script does not wait for one key press to 'finish' before sending the next one. Under high latency conditions, the script fails because the application can't keep up with the script.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2011, 8:41 pm 
Offline

Joined: February 17th, 2008, 8:52 pm
Posts: 314
Wonder if this post might help.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2011, 9:24 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
Hi SteveA,

Quote:
The script works fine if there is no network latency....

In my limited and admittedly non-Citrix experience, latency can change every second (pun intended) and therefore trying to measure it is difficult. :cry:

I wonder if AHk can "see" the caret in a Citrix published application. :idea: http://www.autohotkey.com/docs/Variables.htm#Caret
If so, you could use the change in caret location as an indication that a keystroke succeeded.

When running this script and using Excel locally (non-Citrix) I get the location of the caret.
If I {tab} or use arrow keys, the location changes.

Code:
#Persistent
SetTimer, WatchCaret, 1000
return
WatchCaret:
ToolTip, X%A_CaretX% Y%A_CaretY%, A_CaretX, A_CaretY - 20
return


Please give it a try and report back.
It would be nice if you could try it on both a local and a Citrix published Excel.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Reply
PostPosted: November 18th, 2011, 11:03 pm 
Leef_me

That was a useful test. The script you gave me posts coordinates when I move around local (real) excel (using arrows or tabs), but does not update when I move around "Citrix" Excel. The whole Citrix-Excel window shows up as X0 Y0

That sounds like it was likely since what is seen on the client is just a screen scrape of what's happening on the server. Does this leave any other options?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2011, 11:47 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
Dissapointment thy name is "Citrix" :cry:

I don't know of any thing that comes immediately to mind.

There are scripts in AHk that use "Com" to communicate (locally) with programs like Excel, Word and others. I don't know much about COM though.

I believe all versions of Excel show the current cell as coordinates in a control. Could we "Optical Character Recognize" that value?

Some versions of Excel show the active or selected rows/columns as highlighted top or left "headings" I don't know the right word.
It might be possible to use one of the Ahk "pixel" functions to tell when the active or selected row/column changes.
http://www.autohotkey.com/docs/commands ... tColor.htm
http://www.autohotkey.com/docs/commands/PixelSearch.htm

Click, click, I'm out of thoughts on the subject. :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Reply
PostPosted: November 19th, 2011, 4:31 am 
Leef_me

I did some tests with the PixelSearch command. The command was able to detect color changes on the Citrix excel application.

Now I'm trying to figure out how to turn this into a latency test. Perhaps some kind of a form in Excel where you type a long key sequence, and after the whole thing is received, a cell changes color. AutoHotkey sees the change, sends a mouse click to reset the form, then do again and again. Time x number of passes and I have something I can graph.

I think it will work, but now we're no longer testing real world user tasks.

We tried, but I guess the limitation is that autohotkey can't see the citrix application has a regular application window.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2011, 5:12 pm 
Offline

Joined: February 9th, 2006, 10:22 pm
Posts: 37
If you ever get this figured out, please let us know how. I would be very interested in trying to resolve some latency issues similar to yours.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Reply
PostPosted: November 21st, 2011, 9:54 pm 
Foo

I have not found a way to test applications in a 'real world' way in the same way that users work day to day.

Our biggest complaint is keyboard/screen latency. I was able to script something that runs repetitive tests in Excel so that we can at least compare one day to the next, or one WAN solution to another one.

The script uses an excel document with 'conditional formatting' on column A to turn any cell 'red' which contains "The quick brown fox jumps over the lazy dog"

The script sends "The quick brown fox jumps over the lazy dog" to A1 - A20, one cell at a time. After the script is done typing the phrase in a cell, it waits for the cell to turn red before going onto the next cell (PixelSearch command). This gives the system a chance to catch up and keeps the script from crashing. The waiting gives us something to measure from one test to the next.

Something like this (over and over again with updated coordinates each time.

Code:
Send, {SHIFTDOWN}t{SHIFTUP}he{SPACE}quick{SPACE}brown{SPACE}fox{SPACE}jumps{SPACE}over{SPACE}the{SPACE}lazy{SPACE}dog{ENTER}
#Include WaitPixelColor.ahk
CoordMode, Pixel, Screen
WaitPixelColor(0x0000C6,66, 217)


See:
http://www.autohotkey.com/forum/topic43807.html

I'm sure there must be a better way to do this, but for now this is as far as I've gotten.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2011, 2:47 am 
Offline

Joined: February 9th, 2006, 10:22 pm
Posts: 37
Trying to check each cell for a particular color and/or text seems like it could be rather daunting.

Can you try using the SheetSelectionChange event to change the color of one cell back and forth between two colors to tell you if the sheet has received data?
Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If Sheet1.Range("A1").Color = Red Then
Sheet1.Range("A1").Color = Blue
Else If Sheet1.Range("A1").Color = Blue Then
Sheet1.Range("A1").Color = Red
End If
End Sub

Then each time a cell in the sheet is changed, there will be a change in color of that one particular cell. You note the change and continue.
Playing with one cell seems like it would be much easier than validating each and every cell that gets or might get data.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher and 68 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group