Skip to Content
Technical Articles
Author's profile photo Stefan Schnell

ABAP Wrapper Class for AutoItX

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:


  Program Z_TEST.


      Data AutoItX Type Ref To zAutoItX3.

      Data ShowFlag Type i.

      Data Version Type String.

      Data Result Type i.

      Data OutText Type String.


      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( ).




Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.