Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
stefan_schnell
Active Contributor
0 Kudos
I posted here about a new version of AutoIt Scripting Language and here an example how to use AutoItX, a COM library with a subset of AutoIt script language. I generated an ABAP wrapper class for the AutoItX library, so it is easily to use the AutoItX commands inside ABAP, e.g. you can use the code completion of the ADT or SE80. You can download the wrapper class here.

Here a simple example which opens Notepad editor, writes some text and closes it:

"-Begin-----------------------------------------------------------------

  Program Z_TEST.

    "-Variables---------------------------------------------------------

      Data AutoItX Type Ref To zAutoItX3.

      Data ShowFlag Type i.

      Data Version Type String.

      Data Result Type i.

      Data OutText Type String.

    "-Main--------------------------------------------------------------

      Create Object AutoItX.

      If AutoItX->LoadLib( ) = 1.

        AutoItX->Version( Importing Result = Version ).

        AutoItX->SW_RESTORE( Importing Result = ShowFlag ).

        AutoItX->Run( Exporting strRun = 'notepad.exe' strDir = ''

          nShowFlag = ShowFlag ).

        AutoItX->WinWait( Exporting strTitle = 'Unbenannt - Editor'

          strText = '' nTimeOut = 5 Importing Result = Result ).

        AutoItX->WinActivate( strTitle = 'Unbenannt - Editor'

          strText = '' ).

        OutText = `Hello World from ` && sy-sysid &&

          ` with AutoItX version ` && Version.

        AutoItX->Send( Exporting strSendText = OutText nMode = 0 ).

        AutoItX->Sleep( Exporting nMilliSeconds = 2500  ).

        AutoItX->WinKill( Exporting strTitle = 'Unbenannt - Editor'

          strText = '' Importing Result = Result ).

        AutoItX->FreeLib( ).

      EndIf.

"-End-------------------------------------------------------------------