Updating Old Code

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
jhannamom
Newbie
Posts: 2
Joined: Tue Oct 21, 2014 6:52 pm

Updating Old Code

Post by jhannamom » Tue Oct 21, 2014 8:41 pm

I am trying to update code that was originally written by Macro Scheduler for a company that reads Linkedin Invitations and totals the number of invitations accepted daily. I believe I have corrected where the information is residing, but it is not properly putting in the persons name and they all result to "not accepted." Is there a way to view the data to see if I am getting the right input? Tag Names may have also changed ....I am new to Macro Scheduler and would love to be pointed in the right direction. Is there online documentation to help me with this? Thanks -

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Updating Old Code

Post by Marcus Tettmar » Wed Oct 22, 2014 9:17 am

Hi,

Macro Scheduler scripts have always, with only a few tiny exceptions, been backward compatible.

So I guess what you are saying is that LinkedIn has changed.

What data are you trying to view? Anything the script is entering will be visible in the script. Or if the script is reading a file or database it would be there.

Perhaps we need to see your code and a more detailed explanation of what you are trying to do to help properly.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

jhannamom
Newbie
Posts: 2
Joined: Tue Oct 21, 2014 6:52 pm

Re: Updating Old Code

Post by jhannamom » Mon Oct 27, 2014 3:08 pm

Below is the code - I have changed the IE to the new location of the sent invitations. When it is run - there are no names that are visible in the file they all come across as "names_1" and they are all set to "NO" in the file. So it seems like the fields have changed. Yes LinkedIn changed.

Let>CSV_FILE=%SCRIPT_DIR%\invites.csv

DeleteFile>CSV_FILE

Label>extract_table
IEGetTagsByAttrib>https://www.linkedin.com/inbox/#sent?su ... H,AllItems

WriteLn>CSV_FILE,1,InLoop,%AllItems_Count%,%AllItems%
If>AllItems_Count>0
Let>kk=0
Repeat>kk
Let>kk=kk+1
Let>this_item=AllItems_%kk%
WriteLn>this_item
StringReplace>this_item,CRLF,,this_item

//who is it?
RegEx>(?<=/profile/view).*?(?=</a),this_item,0,names,nm,0
RegEx>(?<=>).*,names_1,0,names,nm,0
Trim>names_1,person_name
Let>person_name="%person_name%"

//have they accepted
Pos>(Accepted),this_item,1,pAccepted
If>pAccepted>0
Let>person_accepted=YES
Else
Let>person_accepted=NO
Endif

//write results to CSV file
WriteLn>CSV_FILE,res,%person_name%,%person_accepted%

Until>kk=AllItems_Count

//is there another page?
IEGetTagsByAttrib>https://www.linkedin.com/inbox/#sent?su ... allPageRep

RegEx>\d*(?= -),allPageRep_1,0,curstart,nm,0
RegEx>(?<=- )\d*,allPageRep_1,0,curend,nm,0
RegEx>(?<=of )\d*,allPageRep_1,0,totpag,nm,0

If>curend_1<>totpag_1
//click next and loop back
IETagEventByAttrib>https://www.linkedin.com/inbox/#sent?su ... next,click,
IEWait>https://www.linkedin.com/inbox/#sent
Goto>extract_table
Endif

Endif

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Updating Old Code

Post by Marcus Tettmar » Mon Oct 27, 2014 3:50 pm

Hi,

After your regex you are not checking to see if anything was found (check the value of nm) and are continuing regardless.

Worth adding that check.

But we can deduce it is not finding anything and the most likely reason is that the HTML has changed. Some versions of IE render HTML differently. So it could either be just that IE has been updated or it could be that the web site html was changed.

So you need to look at your RegEx where you are looking for patterns in the html and make sure those patterns exist in the HTML and modify if the HTML has changed.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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