Is there a way to copy+paste from email to a form?

So this is essentially what I’m trying to do:

  • Visit site
  • Click a button
  • Email arrives with code
  • Copy code within email
  • Paste into field on site
  • Click button

I have it all set up but can’t figure out how to go about copying the code within the email and pasting in the field. The email is the exact same format every time, but obviously a new email is sent with a new code for each. Any ideas?

Btw email I’m just using a browser based client (protonmail), which I’ll already be logged in with.

One idea I had was to run 2 separate scripts, one for copying the code in the email, storing in CSV, and then running another script to use the code in the CSV to paste into the field. Am I over complicating things with this?

To get the text from the email I recommend:

  • XClick (set focus on the email)
  • XType | ${KEY_CTRL+KEY_A}
  • XType | ${KEY_CTRL+KEY_V}

=> now the value is in !clipboard

See also Desktop automation-number harvesting from desktop screen and Desktop Automation - OCR Latest Entry In A List

1 Like

Thanks for that - let me try it out.

What are your thoughts on whether to create 2 separate scripts or somehow use a single one? Is there a way to switch between tabs in the same script?

So every time I try to use !clipboard it keeps copying the xpath target:

    {
  "Command": "XClick",
  "Target": "xpath=//*[@id=\"message0\"]/div[2]/div[3]/div/table[2]/tbody/tr/td/table/tbody/tr[5]/td/div/table/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/th/table/tbody/tr/td/div/span/strong",
  "Value": ""
},
{
  "Command": "XType",
  "Target": "${KEY_CTRL+KEY_A}",
  "Value": ""
},
{
  "Command": "XType",
  "Target": "${KEY_CTRL+KEY_V}",
  "Value": ""
}

Would this be correct? Sorry, kinda new to UI.vision and I can’t seem to find an example for this. The text I’m copying isn’t in a cell, just plain text on the page. Also the path portion I put in target does highlight the text it seems, just don’t know what to do from there to copy it. Thanks in advance.

This is a long work and need more steps

Need login in email, refresh email in box, open exact email you need, select part of code and copy and paste it in another page

Yes, I know. I have the rest of the code. I just need help with this one part.

Strange… can you record a video that shows the problem?

And/or: Try using an image instead of XPath.

Yeah I can - is the code I copied here supposed to work? And what do you mean by use an image exactly? To focus on? What I did was used auto mode to click the wanted area, and then just copied over that path to the click command.

Edit: I managed to get it to focus on the email, however when it does CTRL+A, it highlights everything on the page rather than just that one line. Also where in the code would I actually copy the text?

This work can be done with standard selenium command, no need Xtype and XClick