How to dynamically Drag and Drop an Image next to text

Hey Guys

I am trying to dynamically Drag and Drop an Image next to text inside an image. So basically I have this image of profiles of staff members. I want to drag and drop their image next to the text of the profile image word. I would imagine I need to use some sort of ocr to get the text value of Profile Image. But how do you drag and drop the image relatively next to it.

Any ideas on how to do this?

You can use a click activity on the image and send hotkeys to copy it. Then you can use Click Text with an offset to the left or right by a few pixels, and send the hotkeys Ctrl + V to paste it.

2 Likes

You are not able to copy and paste. It has to be dragged and dropped. Hmm using click Text. This activity has never worked for me. Just in case I am doing it wrong. Do you indicate on the screen or the word itself by dragging over it. Then place the word in quotes what’s supposed to be clicked?

1 Like

You would use Attach Window for the window in which you’re working, and then find the text where you would want to click when choosing the selector for the Click Text activity.

I’m surprised copying and pasting doesn’t work, however, since even in virtual machines this is typically an option.

2 Likes

Hey Anthony. I still do not understand. Ok so then what goes in the text field, if you just locate itin the selector? How it be possible to provide an example of this click text working? I know it is a simple action I just cannot get my head round it.

Yeah I do not know why it does not work.

1 Like

I took a deeper dive into this, and Click Text won’t necessarily find the text where you want to paste. However, you can do this through keystrokes.

Let’s say you’re looking for the text “Profile Image”, and you want to put the image to the left of that. You can send hotkey Ctrl + F to open the Find box (in applications like Notepad), set the text to “Profile Image”, and send hotkey enter.

Now you will have the text highlighted on the screen. Send the left arrow hotkey 13 times (i.e. the length of the text sent to the Find dialog box), and you’ll be to the left of the found text. Make sure you have a sufficent delay between each hotkey such that the cursor moves 13 characters to the left.

2 Likes

Hmm that would work, nut the text is an image and not raw text so you cannot use control f. You need to use some sort of OCR to get the text layer then apply some sort of find.

1 Like

Can you do a find on nearby text and press the arrow key enough times to get the cursor where you need to paste?

2 Likes

Hi Anthony. The only nearby text is the header on the web page. It locates them but pressing the arrow keys skip over the image with the Profile text on it unfortunately.

Do you have any other ideas?

1 Like

It’s a last ditch effort, but you could set the process to click on some element of the page, see where the cursor goes, and adjust the offset of the coordinates. The only problem with this is that if your screen resolution changes, the bot will click somewhere else on the page.

2 Likes

Ah that works! But the screen resolution thing does pose a big problem. As this process will be running unattended on different machines. So it might not be the safest option.

1 Like

If possible, ensure the machines have the same resolution, but I agree that this may not be safe if there is a reason the resolution would likely be changed.

2 Likes

Ok thanks for your time man. I much appreciated it. :slight_smile:

1 Like