Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to copy the content of a variable to clipboard - QTP 10
02-21-2012, 09:24 PM (This post was last modified: 02-21-2012 09:26 PM by rohit330.)
Post: #1
How to copy the content of a variable to clipboard - QTP 10

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.

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.

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

Your advices will be much helpful for me to proceed.

Thanks in advance . .

Regards
Find all posts by this user
Quote this message in a reply
02-22-2012, 08:32 AM
Post: #2
RE: How to copy the content of a variable to clipboard - QTP 10
Code:
Set clipboard = createobject("mercury.clipboard")
clipboard.Clear
clipboard.SetText(text)
Find all posts by this user
Quote this message in a reply
02-22-2012, 08:29 PM
Post: #3
RE: How to copy the content of a variable to clipboard - QTP 10
(02-22-2012 08:32 AM)inborntester Wrote:  
Code:
Set clipboard = createobject("mercury.clipboard")
clipboard.Clear
clipboard.SetText(text)

Thanks...Smile it worked Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Copy Excel Worksheet to DataTable simon_schreiner 0 218 02-29-2012 03:53 PM
Last Post: simon_schreiner
  Issue Regarding Email content checking kotaramamohana 0 658 01-05-2011 10:49 AM
Last Post: kotaramamohana
  How to compare Dynamic PDF content via QTP. upadhyay40 0 1,172 12-10-2010 03:16 PM
Last Post: upadhyay40
  how can I store a string with variable in it, in another variable? reejais 4 664 11-11-2010 11:46 PM
Last Post: smeepaga
Exclamation Read the content of .vcs file.. anuj.bajaj 0 813 03-11-2010 06:53 AM
Last Post: anuj.bajaj

Forum Jump:


User(s) browsing this thread: 1 Guest(s)