Is It possible to store clipboard data to array of variable

Hello ,I have scenerio in UiAutomation to copy values from clipboard and store to array of string…I can store variable from get from clipboard…But how its possible to store array of string

1 Like

@sathya_auto

-Use the “Get From Clipboard” activity to retrieve the content from the clipboard. This activity stores the clipboard content in a variable.

-If the clipboard content contains multiple values separated by a specific delimiter you need to split the content into an array of strings. You can use the String.Split method in combination with the Environment.NewLine or the delimiter that separates the values.

string values = clipboardContent.Split(new string{ Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

Cheers…!

Hi @sathya_auto ,

What kind of data you want to get from clipborad? there are many ways to get specific text from resultant data using regex or Split.


I have to copy number …the flow is that iam clicking access mail…then click on clipboard…all iam doing inside do while loop

1 Like

Getting as string is possible
But converting that string to array of string depends on delimiter present in that string

Whatever be it
Comma
Semi Colon
Colon
Space
Tab
Or just NewLine

then you can split based on them using SPLIT method like this

Use a assign activity like this

arr_input = Split(your string variable, “delimiter”)

This gives arr_input variable with array of string values
Example
arr_input = Split(strinput.ToString, Environment.NewLine)

Here we are trying to split based on NewLine

Hope this clarifies
Cheers @sathya_auto

ok…i tried …this scenerio doesnt work without delimiter…Thankyou guys…
Cheers

1 Like

Ohhhh, if you are processing these rows one by one then you can assign an empty array of string before the loop as below:

arr = New String(){}

and inside your loop after Get From Clipboard, append result to arr.

1 Like

ok how i can add to data column in Excel…ie… array of string to Column in Excel

Please follow the below post:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.