Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
twsapi: automated login
Carl Erikson
A hack is to send keystrokes to the login window.
Pass your username as separate keystrokes. Then send a tab key. Then send your password as separate keystrokes. Then send a return. There is a setting to pre-fill the username in the .ini file (sorry, no pre-fill for the password): [Logon] Username=edemo . . . If you pre-filled in the username you can just send a tab and then the password plus a return key. I send characters to windows with Perl, but you can do it in almost any language (Visual Basic, C++). I believe you can detect when the "Accept incoming connection" window pops up. If that is possible you might just be able to send the enter key to it to accept the connection. I haven't tried this yet. Good luck, Carl --- Michel <migurull@...> wrote: Hi, __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free |
Michel
开云体育Thanks
Carl.
I've
tried it in VB but it does not work.?I've not tried it with the login
window but with the 'connection confirmation' window there are various
problems.
In my
code, first I pass the focus to TWS (AppActivate) and then I try to send it keys
(SendKey) (ENTER key in this case).
First problem is when in your code you
issue a connection command (ActiveX.connect), TWS seems to catch you in a
program loop and dont return to your calling program until you manually click
'Yes' or 'No' in this window so any code after 'connect' (AppActivate and
SendKeys), simply dont execute.
To
turn around this problem, I made a separate litle?application
(IBActivation.exe) which simply makes this:
1-
Tempo 1 second.
2-
AppActivate "Stock and options..." (this is the title of the TWS
window)
3-
Tempo 1 second.
4-
SendKeys "{ENTER}"
Then
in my main code:
ShellExecute "IBActivation.exe"
TWS.connect
...
and get a system error when IBActivation.exe tries to activate and/or send keys.
(It works if TWS is runing normally, but not when presenting the 'connection
confirmation' window)!
So I
thought this behaviour was implemented by IB for some security reason to be sure
that a connection to the program is really made by the account owner. (There is
a security problem if you automate login and connection because everybody having
your program or access to your PC can connect to your
account).
?
Here I
am...
I'll
try this for the login window and post results here.
?
Thanks
again.
Michel.
?
[Michel]??-----Mensaje original----- De: Carl Erikson [mailto:carlerikson@...] Enviado el: martes, 02 de julio de 2002 22:24 Para: twsapi@... Asunto: Re: twsapi: automated login A hack is to send keystrokes to the login window. |
David
开云体育Michel,
what bee-jay-61 has done it was using Win Api's not the VB
code itself.
I'll post the code after i get around my problems and have
more time to do it.
Also, anyone running Proxy succesfully?? (Proxy from
AnalogX)
That's why I don't have the time.
David
|
bee_jay_61
That?s why I start a new separate thread in my program to confirm
the "Accept incomming connection attempt" dialog. First I start the thread that searches the window for about 60 seconds (or more if you need). Than I call TWS.Connect from the main thread while the child thread has allready began his search. This call will force the TWS to display the dialog and than the child thread can find this window. So the main thread (main program) is never blocked like in your case. It is not a security feature from IB. BeeJay --- In twsapi@y..., "Michel" <migurull@t...> wrote: Thanks Carl.the login window but with the 'connection confirmation' window there arevarious problems.try to send it keys (SendKey) (ENTER key in this case).dont return to your calling program until you manually click 'Yes' or 'No' inthis window so any code after 'connect' (AppActivate and SendKeys),simply dont execute.window) 3- Tempo 1 second.and/or send keys. (It works if TWS is runing normally, but not whenpresenting the 'connection confirmation' window)!reason to be sure that a connection to the program is really made by theaccount owner. (There is a security problem if you automate login andconnection because everybody having your program or access to your PC canconnect to your account). |
David
toggle quoted message
Show quoted text
|
tripack44
No, a while back I tried that but it was a no-go with TWS. I gave it
toggle quoted message
Show quoted text
up and finally just bought a router. Life is so much simpler now. --- In twsapi@y..., "David" <kotomo@p...> wrote:
Also, anyone running Proxy succesfully?? (Proxy from AnalogX) |
David
toggle quoted message
Show quoted text
|
marinindextrader
This thread has been archived in the Bookmarks Section, within the
Board Threads Folder. From time to time exhaustive discussions that stay on topic will be archived to this folder. Scott --- In twsapi@y..., "David" <kotomo@p...> wrote: Thanks tripack44it up and finally just bought a router. Life is so much simpler now.Service. |
to navigate to use esc to dismiss