×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Sendkeys too fast

Sendkeys too fast

Sendkeys too fast

(OP)
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.
 

RE: Sendkeys too fast



hi,

What is the next statement?

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

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Sendkeys too fast



...and what is that second argument doing in SendKeys???

Quote:


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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Sendkeys too fast

(OP)
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.

 

RE: Sendkeys too fast



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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Sendkeys too fast

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?

 

RE: Sendkeys too fast

(OP)
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.
 

RE: Sendkeys too fast



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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Sendkeys too fast

(OP)
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

RE: Sendkeys too fast



When you TAB on your screen, what happens?

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

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Sendkeys too fast

how many columns are there on your screen? are you expecting the text to wrap around to the next row?

RE: Sendkeys too fast

how do you know when you have a new paragraph?

RE: Sendkeys too fast

also, when you evoke the TAB, does it go to column 9 of the next row?

RE: Sendkeys too fast

(OP)
When I TAB on the screen, I go to the next line, or position (line number, 9)
 

RE: Sendkeys too fast



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,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Sendkeys too fast

(OP)
Thanks for the advice and for being so patient!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close