Forum Discussion

dhirendranaga's avatar
dhirendranaga
Occasional Contributor
9 years ago

How to find whether Copy or Paste of some data from an application is complete or not

Have the below scnerio in desktop application and could not proceed, need help please

-Have an application that displays about 3000-5000 rows of tabular data

-Clicked one of the random cell

-Simulated Ctrl+A to select all the cells of the table

-Simulated Ctrl+C to copy all the selected cells

-Simulated Ctrl+V to paste in intended targeted file/excel

 

The above is working fine for about 1000 records, but failing as the selection/copy/paste  operations for thousands of cells

 

How to find that given operation is completed, say in this case, say once Ctrl+A is simulated, would like to know the whether this is successful or not , then only proceed to copy and paste.

 

Any such provision which returns the output value for Copy or Paste operation

 

please suggest

 

Say the code is as below

 

a= ClickCell.SendKeys('Ctrl+C')

if a is True : //is complete

  proceed

 

 

 

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    You can use a property checkpoint to compare the contents of the cell with the contents of the clipboard.  Sys.Clipboard contains the current contents of the clipboard so you can utilize that in your checkpoints.

  • Ravik's avatar
    Ravik
    Super Contributor

    Try like this, may help you

     

    If IsNull(a) = true then

    msgbox "No text on clipboard"

    else

    msgbox a

    End If

     

    or

     

    You can clear your clipboard data after each operation (Copy +Paste)

     

    Set WshShell = WScript.CreateObject("WScript.Shell")

    WshShell.Run "cmd.exe /c "echo off | clip", 0, True