Creatica Level: Protégé
 Registered: 01-02-2007 Posts: 4
|
Login program help
Okay, I'm looking to write a program where I can enter a username/password, hit a Login button, have it run a launchpad program, press Home (to return it to the top of the list), press down arrow five times (to select the proper server), hit enter (to connect to that server), pass the username to the first field (when I connect to the server normally, the username field starts with the focus, so I don't need to do anything there), hit Tab, then pass the password to the server, and finally press enter to log on.
Currently I have two issues. First, the first time I run the program it will shell to the launcher, but will not continue with the home/down arrows/enter. If the launcher is open already and I run it, it passes those commands along and will connect to the server. How can I make it connect the first time?
Second problem is that the username is not being passed to the server login screen. I've tried various ways I can think of to do so, but it is not working. Here is the code I have so far (up to trying to pass the username to the server)
Private Sub Command1_Click()
Shell "C:\Program Files\SAP\FrontEnd\SapGui\saplogon.exe" 'Runs launcher program
AppActivate "SAP Logon 640" 'Activates launcher
SendKeys "{HOME}"
SendKeys "{DOWN}"
SendKeys "{DOWN}"
SendKeys "{DOWN}"
SendKeys "{DOWN}"
SendKeys "{DOWN}"
SendKeys "{ENTER}" 'Connects to the SAP server
Clipboard.Clear
Clipboard.SetText Me.txtUserName.Text
AppActivate "SAP" 'Activates the SAP server
SendKeys "^v" 'Supposedly sends Ctrl-V (pastes clipboard)
End Sub
Any ideas on what I'm forgetting or doing wrong? Thanks!
|