Jump to content

SAP Logon script falling over on ControlSend()


MJOAP
 Share

Recommended Posts

Hi All AutoIT3 experts,

Please help this new user (NON TECHIE) find a resolution to his problem.

I have written an AUTOIT3 SAP logon script which runs perfectly once my workstation is not locked.

Essentially my script logs on on to our SAP finance server & opens an Excel workbook and hence runs a MACRO which interfaces with SAP.

Through reading the AUTOIT3 website I now realise that my script was incorrect for a locked computer.

I have have re-written same trying to use the correct functions and I am still having no luck.

The New script works fine once the computer is not locked but falls over when I lock the computer and run though a scheduled task.

All help gratefully received.

Thanks.

Michael.

OriginalSAPLogonAUTOIT3.au3

NewSAPLogonAUTOIT3forLockedScreen.au3

post-53273-12553723822079_thumb.jpg

Link to comment
Share on other sites

Hi All AutoIT3 experts,

Please help this new user (NON TECHIE) find a resolution to his problem.

I have written an AUTOIT3 SAP logon script which runs perfectly once my workstation is not locked.

Essentially my script logs on on to our SAP finance server & opens an Excel workbook and hence runs a MACRO which interfaces with SAP.

Through reading the AUTOIT3 website I now realise that my script was incorrect for a locked computer.

I have have re-written same trying to use the correct functions and I am still having no luck.

The New script works fine once the computer is not locked but falls over when I lock the computer and run though a scheduled task.

All help gratefully received.

Thanks.

Michael.

Hi,

as i remember does controlsend only works with logged on user. Theres is no gui interaction while computer is locked.

You can open web sites in background, reading out values and save these in excelsheet while the computer is locked. But you only can do it with built in functions and not with Send and Controlsend commands.

If this is not right someone should show the way.

Sry.

;-((

Stefan

Link to comment
Share on other sites

Use "SysListView321" as "ClassNameNN"

Also try to use ControlClick on button "Log On" instead of sending {Enter} to ListView

There may be also some timing issues.

Try to insert small Sleep() between send 04 and Enter

EDIT: Instead of Send("04") you may use _GUICtrlListView_FindItem + _GUICtrlListView_SetItemSelected

Edited by Zedna
Link to comment
Share on other sites

There may be also some timing issues.

Try to insert small Sleep() between send 04 and Enter

WinWait ("SAP Logon 710")

Sleep(...some time ...) ; --> add some sleep, may be in loop based on state of controls inside logon window

; Choose '04'
;ControlSend("SAP Logon 710", "P08 Finance (Secure)", "", "04{ENTER}")
ControlSend("SAP Logon 710", "", "", "04{ENTER}")
Link to comment
Share on other sites

Hi Zedna, (and all others)

Thanks for help to date.....

I think I am nearly there, I have one button to conquer and I am done....

Can some please help me with this last piece of code as I am struggling.....

; Start SAP

Run("C:\Program Files\sap\FrontEnd\SAPgui\saplogon.exe")

; Wait until SAP is open

WinWait ("SAP Logon 710")

;Wait half a second

SLEEP(500)

;Give focus to the SAP Logon 710 screnn

ControlFocus("SAP Logon 710", "","[CLASSNN:SysList32]" )

;Choose Option 4

ControlSend("SAP Logon 710", "", "", "04{ENTER}")

;Wait half a second

SLEEP(500)

FROM HERE ON IS WHERE THE SCRIPT IS FALLING OVER

;Give focus to the Copyright screen

ControlFocus("Copyright", "","[CLASSNN:#32770]" )

ControlClick("Copyright", "", "Continue")

BELOW IS THE DATA FROM THE INFO WINDOW, sorry I cannot upload a further jpeg.

>>>> Window <<<<

Title: Copyright

Class: #32770

Position: 468, 114

Size: 408, 520

Style: 0x96C80044

ExStyle: 0x00010110

Handle: 0x003305E8

>>>> Control <<<<

Class: Afx:00940000:b

Instance: 1

ClassnameNN: Afx:00940000:b1

Advanced (Class): [CLASS:Afx:00940000:b; INSTANCE:1]

ID: 101

Text:

Position: 0, 0

Size: 404, 497

ControlClick Coords: 31, 35

Style: 0x56000000

ExStyle: 0x00000010

Handle: 0x00600604

>>>> Mouse <<<<

Position: 501, 170

Cursor ID: 2

Color: 0xF7F3F7

>>>> StatusBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

Link to comment
Share on other sites

Thanks Zedna,

Sorted now.

;Wait for Copyfright screen to appear

WinWait ("Copyright")

;Give Focuse to the Copyright Screen

ControlFocus("Copyright", "","")

;Click on the Copyright Screen

ControlClick("Copyright", "","")

;Send Enter to go into SAP

ControlSend("Copyright", "", "", "{ENTER}")

Link to comment
Share on other sites

  • 4 years later...

MJOAP,

Can you post the final code that allowed you to complete the SAP logon.

Thanks,

RM

You are going to be waiting a LONG time, MJOAP hasn't been here in 5 years. This thread is from 2009.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...