Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to copy the content of a variable to clipboard - QTP 10
#1
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi All,

I am very new to QTP and is trying to automate some part of my testing.

I have some piece of code where am trying to copy one particular file (contents) to text area in my application.

Following is what i have achieved till now.

Code:
Function readTextFromFile(pathToFile)
   Set fso = createObject("Scripting.FileSystemObject")
   If fso.FileExists(pathToFile) = True Then
                   Set f = fso.OpenTextFile(pathToFile, 1)
                   readTextFromFile = f.ReadAll
                   f.Close
   End If
End Function
text = readTextFromFile("Path of file")

After this i wanted to copy the content of "text" to clipboard so that i can use pasting it to my app text area, which hopefully by the following code.

Code:
SwfWindow("MyApplication").SwfEditor("xmlTextBox").Type micCtrlDwn + "v" + micCtrlUp

Your advices will be much helpful for me to proceed.

Thanks in advance . .

Regards
Reply
#2
Solved: 10 Years, 8 Months, 4 Weeks ago
Code:
Set clipboard = createobject("mercury.clipboard")
clipboard.Clear
clipboard.SetText(text)
Reply
#3
Solved: 10 Years, 8 Months, 4 Weeks ago
Thanks...Smile it worked Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Read Content inside PDF kotaramamohana 0 1,093 09-02-2020, 05:49 PM
Last Post: kotaramamohana
  Capture All text from webpage and copy it... mpatra 3 4,898 07-25-2018, 05:33 PM
Last Post: vimlesh
  how to write the content obtained using the method GetPdfText Anisha 0 1,339 10-24-2017, 08:49 PM
Last Post: Anisha
  Copy folders from ALM squadri 0 1,687 08-16-2016, 06:23 PM
Last Post: squadri
  Can you please help me in QTP DP to pass the variable name anshika.agarwal 1 2,593 09-04-2014, 06:43 PM
Last Post: anshika.agarwal

Forum Jump:


Users browsing this thread: 1 Guest(s)