Forum Discussion

help's avatar
help
New Contributor
11 years ago

How to set a variable in Keyword Tests from ClipBoard

Hi, 

I am trying to set the value of a Project Varible with the Content in the Clipboard.



My Variable is "tempNum"



I am trying to set in the following rule



Item:           rtxtDescription

Operation: Click

Value:         Project.Variables.tempNum = Sys.Clipboard



but the value of tempNumn remains to be empty.



But when I write in the script it worked. Please help me to set a variable to a value from clipboard. 



I read about the Set Variable Value operation from http://support.smartbear.com/viewarticle/56300/   but not sure how to do that without specifying any action. 




  • Hi,


     


    You need to use the Set Variable Value operation for your task. Here are three steps you need to follow:


    1. Add the Set Variable Value operation.




    2. On step 1, select the target variable.




     


    3. On step 2, you need to select the Code Expression mode (as you are going to use the script code to assign the variable value) and specify Sys.Clipboard as a value:




     


    Does this help?

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,


     


    You need to use the Set Variable Value operation for your task. Here are three steps you need to follow:


    1. Add the Set Variable Value operation.




    2. On step 1, select the target variable.




     


    3. On step 2, you need to select the Code Expression mode (as you are going to use the script code to assign the variable value) and specify Sys.Clipboard as a value:




     


    Does this help?