Copy Text into a Search Field

Originally posted by Ty_K on September 22, 2026

I have an application that creates Works Orders, that all have unique numbers

I can open the Work Order and Copy the number into the list of Orders on the orders main screen to search for it, but it pastes the exact text node into the field every time and stores that value in the keyword test. I want the keyword test to just paste the last number copied, and not store it as fixed value

Originally posted by rraghvani on September 22, 2026

When pasting the value, what property value are you using?

Originally posted by Ty_K on September 22, 2026

I copy the text from the header of the job and then paste it into the list of jobs screen

I just really need to know what I’d put in the set text field, so that it pastes the text I’ve copied, which can be different every time as every order has a unique number

Originally posted by rraghvani on September 22, 2026

I can now see, that you are doing a Ctrl+C, to copy the selected text, followed by a Ctrl+V to paste the text. What is the SetText used for?

You need to mimic user behaviour i.e. highlight the text; press ctrl+c to copy the highlighted text; navigate to the desired text control and click it; then press ctrl+v to paste the text.

Originally posted by Ty_K on September 23, 2026

Yes I know that and it works, I want the text pasted into the search box to not be hard coded in the Keyword test

Or is that not possible

For example one time it may be 53437 and another time another number

I need to be able to search for different numbers all the time

Originally posted by rraghvani on September 23, 2026

Refer to post How to assign a copied text string to a variable? | SmartBear Community

You should be able to copy the text, store it to a variable, and then use it via .SetText(variable).

Originally posted by Ty_K on September 23, 2026

Thanks for your reply, but I’m not experienced enough to know how to do that

Originally posted by rraghvani on September 23, 2026

I suggest you read Keyword Test Variables, (and Using Variables) to understand the basics. It will come in handy, when doing slightly complex tests. There’s also a video you can refer too as well, https://support.smartbear.com/testcomplete/videos/

Originally posted by Ty_K on September 23, 2026

Once again thanks for the reply but I can’t see a way of the variable being the contents of the clipboard, and without that, don’t see how I do it, the test is locate a job using the clipboard contents. I’ll just have to accept it can’t be done

Originally posted by rraghvani on September 23, 2026

Here’s an example,

I’ve copied your text response, which is stored in the clipboard. I assign the vairable to the clipboard object, then using log to output the contents of the variable. Which displays the text that I had copied.

Originally posted by Ty_K on September 24, 2026

Thanks so much again for you efforts, but the above doesn’t work for me. Nothing gets pasted for me when the test clicks in the desired text box

The text is copied, and I can manually paste into the box, but the variable command does nothing. So my set up is clearly wrong

I’m obviously a novice, and don’t want to impinge on your time

Originally posted by rraghvani on September 24, 2026

You are assigning the string value “Sys.Clipboard” to Var1, which is incorrect. You need to assign the object property of Sys.Clipboard to Var1. Anything in double quotes is considered to be a string.

Look at the screenshot example that I have provided.

Originally posted by Ty_K on September 24, 2026

Thanks again, but I don’t know how to do that. I do not know how to change the value to assign the object of Sys.Clipboard to Var1. There are no options to enter Sys.Clipboard as an object. I’m way out of my depth.

I don’t know what to pick at all when I choose set Variable value

In the First screen what do I Pick

Is it object? Is so then what in the next screen

Then what?

And what do I pick in the next drop down after the mode has been selected

Originally posted by rraghvani on September 24, 2026

I highly suggest you learn the basics, and fully understand how Object Identification works with TestComplete. Otherwise, it’s going to be very tricky!

Setting a variable

Originally posted by Ty_K on September 24, 2026

Thanks for the reply, but that doesn’t work either

I will leave you in peace and, accept I can’t do it

Originally posted by rraghvani on September 24, 2026

This is fairly straight forward,

Double click the Value parameter, in the Set Variable Value dialog, change the Mode to be Object Property and then for Value, type in Sys.Clipboard.

Originally posted by scot1967 on September 24, 2026

Hi, when I was new to all this Record Keyword Test was useful. It didn’t always make the cleanest purpose built test but I was able to learn a lot of things like this by recording and then studying the output. If this isn’t what you are currently doing it might help expose and explain some of the things you are having trouble with. If this is what you are doing then you need to learn how to use variables like rraghvani said. Without that basic skill you wont be able to do much more than take what TestComplete hands you.

… If you find my posts helpful drop me a Like​:+1: Be sure to mark the post as the Solution​:white_check_mark: when you get one to help others out and to credit the one who helped you. :smiling_face_with_sunglasses:

Originally posted by Ty_K on September 25, 2026

That is what is set, and it still doesn’t work

I get an exception in the results of type mismatch in the logs, and no other information, so i Can’t even find a way to solve what it wrong

I’m most grateful for you trying to help, there wasn’t any need to, so that is very much appreciated, I think I’m going to look at other automation tools now.

Originally posted by Ty_K on September 25, 2026

Thanks for replying but I’m going to look at other automation tools as everything that rraghvani has tried to help with hasn’t worked.

I looked at the output in the logs and all there was showing was Type Mismatch

Originally posted by rraghvani on September 25, 2026

I’ve realised I made a slight mistake, sorry. Here are the actual steps,

Create a variable Var1 of Type StringAdd a Set Variable Value operation to your Keyword Test, select the variable Var1Click Next, and set the variableCreate a Log operation, to output the contents of variable Var1.

When you copy text, and run the Keyword test, the log will output the contents of the clipboard.