Desperately need assistance with a macro

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Posts: 4
Joined: Wed Jul 10, 2019 3:56 pm

Desperately need assistance with a macro

Post by hassan » Wed Jul 10, 2019 5:10 pm

I'm a novice when it comes to "coding" and am trying to automate what will otherwise be a painstakingly tedious process;

I have a list of 13,000 records that each has a duplicate - I am using Pardot.

The goal is to merge all the duplicates and to have the master record be the record that is already entered into Salesforce.

The best way that I can think of to do that is to use the image recognition tool to locate the Salesforce Lead logo, and then have the mouse automatically move to the "top right" of the image and click "Select all" - the rest of the process is fairly standardized because all the other fields remain in the same spot.

The problem I am facing - and why I have to use image recognition as opposed to just a standard macro - is that the master record can either show up on the left or the right, and as such the program needs to spot which side is the one I want to click "select all" on.

I have managed to create a rudimentary version that works so long as the name of each prospect is roughly the same length, the problem is that when a name is either too long or too short, the cursor does not move onto the "select all" button and so the process stops in its tracks.

I will attach some screenshots so you have an idea of what it is I am looking to achieve - might not be as easily explained via text.

The attached image show the basic layout of a prospect on Pardot - the only thing is that the "master" can end up on either side of the page - the master is the one with the little orange icon - the icon is what I have been using as the image from a recognition perspective - the other image just shows an example of what I've been using within Macro Scheduler.

Please help me find a way to automate this task completely - the rest of the steps ought to be fairly straightforward to get working, it is just this one that I'm not sure how to perfect.

Thanks so much!

Posts: 4
Joined: Wed Jul 10, 2019 3:56 pm

Re: Desperately need assistance with a macro

Post by hassan » Fri Jul 12, 2019 1:17 pm


User avatar
Dorian (MJT support)
Automation Wizard
Posts: 767
Joined: Sun Nov 03, 2002 3:19 am

Re: Desperately need assistance with a macro

Post by Dorian (MJT support) » Sat Jul 13, 2019 8:13 am

If you're using Image Recognition to locate the position of the orange icon. That's your "anchor point". Your blue "select all" text will always be above it somewhere, and probably slightly to the right.

You'll have to edit this to suit your setup, but the structure of this does exactly what you need to do:

Code: Select all

//Find and Do Nothing Center of the orange icon 

//Specify where to look for "select all" above and to the right of the orange icon (edit to suit your requirements)

//This will help you see the corners. Edit this section out.

//Capture a screen area based on the rectangle we specified above, for use in FindImagePos

//Use the Image Recognition Wizard to create this code (find image and left click on center)
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts