Liquid UI - Documentation - 18.01 Copy file contents to clipboard

18.01 Copy file contents to clipboard


Prerequisites


Purpose

To copy the contents of a text file to the clipboard by executing a function on UIEvent/s.

 

User Interface

//Create this file inside your script for customizing the SAP Easy Access screen. SAPLSMTR_NAVIGATION.E0100.sjs
//Now, let's start adding the Liquid UI script to the above file and save it.

  1. Logon to SAP and delete the image container on the SAP Easy Access screen using del(), as shown below.
     
     //Deletes an image container on SAP Easy Access screen
    del('X[IMAGE_CONTAINER]');  
     
  2. Add a toolbar push button with the label “Copy to Clipboard” to execute the function copyClipBoard on click.
     
    // Creates a toolbar pushbutton
    pushbutton([TOOLBAR],'Copy to Clipboard','?',{'process':copyClipBoard,'size':[1,20]})
     
  3. Add a function labeled copyClipBoard to copy the text to the clipboard
     
    // Creates a function to copy the text to clipboard
    function copyClipBoard() { system.ShellExecute('cmd.exe','/C type C:\LiquidUI\scripts\file.txt|clip');  }
     

SAP Process

  1. Refresh the SAP screen, and click on the toolbar pushbutton "Copy to Clipboard". Then, the content of the selected file is copied to the clipboard.
     
     
  2. The text from file.txt is now copied to the clipboard, as shown in the image below.
     

Can't find the answers you're looking for?