Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendkeys too fast 1

Status
Not open for further replies.

dvirgint

Programmer
Jun 28, 2010
85
CA
Hello all,

I've written a macro and have tested the majority of the code - mostly everything works as it should except in one case.

This macro is used to write up a letter, and some the lines of the letter have to be written manually. When the macro runs through and it gets to this part of the code, it writes half of the line it's supposed to and skips to the next. I assume it is running out of time and continuing to the next line - I read in the Extra! Basic manual that there is a way to have the macro wait while the instructions are completed, but it hasn't worked so far. This is what I've been doing:

Sess0.Screen.Sendkeys ("This is my really long sentence"),1

Does anyone have any suggestions?

Thanks in advance for the help.
 


hi,

What is the next statement?

Please do not be stingy with the code you have generated.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 


...and what is that second argument doing in SendKeys???
Applies To Objects

Screen

Description

Sends keystrokes to the host, including function keys. The keystrokes appear to the session as if they were manually entered by a user.

Syntax

object.SendKeys(String)

Element Description
object The Screen object.
String String of keystrokes, up to 255. You can specify host function keys as well as alphanumeric keys.
Comments

To pause your application while the host processes the transmitted keystrokes, use a wait method, such as WaitForCursor.

Copyright 1996 - 1999, Attachmate Corporation. All rights reserved.


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I have about twenty to thirty lines worth of Sendkeys with nothing to tell them to pause.

Some of the lines get written down in their entirety, but most of them are cut short. I tried using the WaitForCursor method, but it didn't work, probably because I'm not understanding how it works.

 


Well, since you insist on being stingy with your code, I'll just have to guess...
Code:
Sess0.Screen.Sendkeys ("This is my really long sentence"),1
do until Sess0.Screen.waitforcursor(r,c)
  DoEvents
loop
where r & c are the screen row and column where you expect the cursor to be AFTER the SendKeys string is processed by the system.

Personally I NEVER use SendKeys to put text in the screen: rather PutString or Area. I use SendKeys for COMMANDS.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
dvirgint,
are you saying that you evoke Sendkeys 30 times? or are you saying that one Sendkeys, with a *very* long sentence, does not work?

 
Hello vzachin and SkipVought,

Sorry for my lack of response in that last days... I've been in training and haven't been able to check my messages.

I cannot give you exactly what I'm writing in the letter as I work a governement agency and I cannot display exactly what the letter says, so for your request concerning my stingy code (sorry, by the way), I'll use Lorem Ipsum text. Here is an example of what I'm trying to send to the screen:

Sess0.Screen.SendKeys ("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do <tab>") 'The tab is to change lines
Sess0.Screen.SendKeys ("eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim <tab>")
Sess0.Screen.Sendkeys("ad minim veniam, quis nostrud exercitation ullamco<tab><tab>") 'The two tabs are for changing paragraphs
Sess0.Screen.Sendkeys ("laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit <tab>")
Sess0.Screen.Sendkeys ("in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint <tab>")
Sess0.Screen.Sendkeys ("occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")

My problem is that when the text is sent to the screen, some of the lines are cut.

Is this enough information now? I'm not sure what else you would like me to add.

Thanks again for your help.
 


what size screen; rows/columns?

Where are the TAB locations on your screen?

What is the character count of each string that you are "sending"?

Please be very specific with each of these. Questions 2 & 3 are related.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Question 1: 24/80 total screen size, however the area to write in is from 6,9 to 21,74.

Question 2: I'm not sure what you mean by TAB locations, but if you're referring to where I would send the TAB key is the end of the line, column 74 at the maximum, depending on the length of the sentence.

Question 3: the longest I can write per line is 65 characters.

Does this help?

Thanks Skip
 


When you TAB on your screen, what happens?

Tell me the row/column where the cursor lands each time you TAB.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
how many columns are there on your screen? are you expecting the text to wrap around to the next row?
 
also, when you evoke the TAB, does it go to column 9 of the next row?
 
When I TAB on the screen, I go to the next line, or position (line number, 9)
 


If you are loosing parts of your strings, insert a waitforcursor after each send keys, and use the NEXT row, column as the arguments, as illustrated in my post of 7 Dec 11 8:47.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top