AutoIt is a powerful freeware scripting language with BASIC syntax. It is primarly designed for automating operations on the Windows GUI. But it also provides a full set of commands to use it as programming language. It is possible to build GUI applications and to create standalone executables. You find AutoIt here.
AutoIt offers, beside the ability to use DLL calls, a COM interface. With these interface it is possible to use SAP GUI Scripting inside AutoIt. You can take the code from the SAP GUI Scripting recorder, it only has a $ sign before the session variable to be set.
Here an AutoIt Script example to login:
2016/11/25: Here an addition how to use AutoIt and SAP GUI Scripting without the ROT wrapper.
AutoIt offers, beside the ability to use DLL calls, a COM interface. With these interface it is possible to use SAP GUI Scripting inside AutoIt. You can take the code from the SAP GUI Scripting recorder, it only has a $ sign before the session variable to be set.
Here an AutoIt Script example to login:
;-Begin-----------------------------------------------------------------
;-Variables-----------------------------------------------------------
Dim $SAPROT, $SapGuiAuto, $application, $connection, $session
$SAPROT = ObjCreate("SapROTWr.SAPROTWrapper")
If Not IsObj($SAPROT) Then
Exit
EndIf
$SapGuiAuto = $SAPROT.GetROTEntry("SAPGUI")
If Not IsObj($SapGuiAuto) Then
Exit
EndIf
$application = $SapGuiAuto.GetScriptingEngine()
If Not IsObj($application) Then
Exit
EndIf
$connection = $application.Children(0)
If Not IsObj($connection) Then
Exit
EndIf
$session = $connection.Children(0)
If Not IsObj($session) Then
Exit
EndIf
$session.findById("wnd[0]/usr/txtRSYST-MANDT").text = "099"
$session.findById("wnd[0]/usr/txtRSYST-BNAME").text = "Hugo"
$session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "Bambi"
$session.findById("wnd[0]/usr/txtRSYST-LANGU").text = "DE"
$session.findById("wnd[0]/tbar[0]/btn[0]").press()
;-End-------------------------------------------------------------------2016/11/25: Here an addition how to use AutoIt and SAP GUI Scripting without the ROT wrapper.