Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In vbscript I am initally copying contents from pdf to clipboard.
And then copying clipboard contents onto a string.
The code works perfect on a windows7 machine with UFT version 12.53 , Adobe Acrobat DC reader version 15.1536.

However the same script fails at "Copy from clipboard to string" in a windows10 machine with UFT version 14, Adobe Acrobat reader version 18.2304

I am not sure if it is the version conflict that is blocking the script from executing.

What I have tried:

Script :
Function ReadPDF(Filename)
'Call KillByName("AcroRd32.exe") '''Added by Krupesh
Set oShell = CreateObject("wscript.shell")
'Open the PDF file
oShell.run Filename
wait(4)
Window("AdobePdf").Activate
wait 3
'' Select all data from PDF file using 'Control + a ' keys
oShell.Sendkeys "^a"
wait(2)
'' Move data from PDF file to clipboard using 'Control + c ' keys
oShell.Sendkeys "^c"
wait(15)
'Fetching data from clipboard
Set objClipboard = CreateObject("htmlfile")
strClipboard = objClipboard.ParentWindow.ClipboardData.GetData("Text")
'Close the PDF File
'Call terminateProcess("AcroRd32.exe")
'Return the value of clipboard data
wait 4
ReadPDF= strClipboard
wait 3
End Function
Posted
Updated 27-Nov-17 21:47pm

1 solution

That's because - there are different method for
window.clipboardData.setData


I had the same issue but my purpose was different -

See below blog which I had referred and that resolved my issue

In Windows 10 (build 14332) window.clipboardData.setData does not work as expected. · Issue #1071 · Microsoft/ChakraCore · GitHub[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900