Liquid UI - Documentation - 18.01 Copy file content to clipboard

18.01 Copy file content to clipboard


Prerequisites


Purpose

This article guides the process of copying the content from a text file to the clipboard using the ShellExecute command. Here, we’ll consider the SAP Easy Access screen as an example and walk you through the following steps:

  1. Delete the image container on the SAP Easy Access screen.
  2. Add a toolbar push button to initiate the copy operation.
  3. Add a function to copy the contents to the clipboard.
 

User Interface

//Create this file inside your script folder for customizing the SAP Easy Access screen. SAPLSMTR_NAVIGATION.E0100.sjs

//Now, let's add the Liquid UI script to the above file and save it.

 

Customization

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

SAP Process

  1. Refresh the SAP screen and click the Copy to Clipboard push button to copy the content to the clipboard. Press the Windows key + V to view the copied content.
     
     

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