|
-
Jul 24th, 2011, 12:58 PM
#1
Thread Starter
New Member
SendKeys Problem VB6
What is wrong with SendKeys?
Most of the times, it executes the code as desired... but 30% times, it does not execute the code properly... I tried increasing priority of my program upto 'Realtime'... It increases it's efficiency a little bit... But, how can I make it work perfectly? It is a computer and it ought to do things as we desire... the code I'm using is...
.........................................
Clipboard.Clear
Clipboard.SetText Acc32
SendKeys "(^v)"
DoEvents
SendKeys "({TAB})", True
DoEvents
Clipboard.Clear
Clipboard.SetText Pas32
SendKeys "(^v)"
DoEvents
SendKeys "({ENTER})", True
DoEvents
.........................................
Suppose Acc32 is "[email protected]" and Pas32 is "TempPass", then the output varies as:
[email protected]Pass [Enter] ---- Missed the tab key
[email protected] [Tab] v [Enter] ---- Missed the control key
[email protected] [Tab] TempPass ---- Missed the Enter key
xyzTempPass [Enter] ---- Super-Weird
[email protected] [Tab] TempPass [Enter] ---- Desired
What should I do? Any help will be appreciated... Thank You
-
Jul 25th, 2011, 12:06 AM
#2
Lively Member
Re: SendKeys Problem VB6
Hi i'm using Text1 and Text2 to hold the clipboard text and it works all the time for me, here's my code
Code:
Dim Acc32, Pas32
Acc32 = "[email protected]"
Pas32 = "TempPass"
Clipboard.Clear
Clipboard.SetText Acc32
Text1.SetFocus
SendKeys "^(v)", True
SendKeys "({TAB})", True
Clipboard.Clear
Clipboard.SetText Pas32
SendKeys "^(v)", True
SendKeys "({ENTER})", True
in my opinion, your code not works 100% coz Text1.SetFocus, the control to hold your clipboard data is not in Focused state. Try to comment my Text1.Setfocus, and you'll have the same result with your result.
-
Jul 25th, 2011, 04:18 AM
#3
Thread Starter
New Member
Re: SendKeys Problem VB6
Hello Lidya, thanks for your kind reply but I never said that I have a textbox in my program... I am sending the keys to Internet Explorer and yes, it has focus else the output never even had those xyz things...
The problem is with SendKeys function and I need an alternative or improvement to Sendkeys...
Thanks anyways
-
Jul 25th, 2011, 11:00 PM
#4
Lively Member
Re: SendKeys Problem VB6
 Originally Posted by ATH3IST
Hello Lidya, thanks for your kind reply but I never said that I have a textbox in my program... I am sending the keys to Internet Explorer and yes, it has focus else the output never even had those xyz things...
The problem is with SendKeys function and I need an alternative or improvement to Sendkeys...
Thanks anyways 
oh i see, now the problems is not only with the SendKeys function but also my eyes  , i just giving you an example...
btw, take a look at this and this threads working by pro...
and this is coding by newbie  but it's work for me
Code:
'Just input the title of your IE browser in text1
AppActivate Text1.Text
Dim Acc32, Pas32
Acc32 = "MyLogin"
Pas32 = "MyPass"
Clipboard.Clear
Clipboard.SetText Acc32
SendKeys "^(v)", True
SendKeys "({TAB})", True
Clipboard.Clear
Clipboard.SetText Pas32
SendKeys "^(v)", True
SendKeys "({ENTER})", True
hope this help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|