Desperately need assistance with a macro

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
hassan
Newbie
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!
Attachments
Pardot.png
Pardot.png (35.14 KiB) Viewed 267 times

hassan
Newbie
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

Anyone?

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

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 
FindImagePos>%BMP_DIR%\image_1.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF

//Specify where to look for "select all" above and to the right of the orange icon (edit to suit your requirements)
Let>TopLeftX=XArr_0
Let>TopLeftY=YArr_0-300
Let>BottomRightX=XArr_0+800
Let>BottomRightY=YArr_0

//This will help you see the corners. Edit this section out.
mousemove>TopLeftX,TopLeftY
wait>3
mousemove>BottomRightX,BottomRightY

//Capture a screen area based on the rectangle we specified above, for use in FindImagePos
ScreenCapture>TopLeftX,TopLeftY,BottomRightX,BottomRightY,%TEMP_DIR%\screenrect.bmp

//Use the Image Recognition Wizard to create this code (find image and left click on center)
FindImagePos>%BMP_DIR%\image_2.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>{%XArr_0%+3200},{%YArr_0%+299}
  LClick
Endif
Always accepting custom script commissions. Message me or go here

Post Reply