For one of the sites I develop we were thinking about using user avatars and potentially using gravatar as the default. Which got me to thinking.. what portion of our current users already have gravatars? Along comes my swiss army knife...... The script below starts from a list of emails and produces a webpage with the gravatars for the full email list. Where there is no gravatar - a default image is loaded. Pretty rudimentary - but if you are considering using gravatars - it is a quick way to see if your friends/users have accounts.
Caution: I am still new to Macrosheduler and not a tech guy - so the script is probably too long and I know there are no error checks, and it does not actually come up with a number for me - but I can 'eyeball' the output.
Code: Select all
// Macro to test for existing Gravatars from a list of email addresses
// setup options
Let>varDir=D:\DATA_Working\Macros\md5\
Let>varSize=16
Let>varRating=PG
// put the list of email addresses in the directory below - one email address per lin
Let>Emaillist=%varDir%Emaillist.txt
Let>outputfile=%varDir%GravatarCheckPage.html
// Create web page
deletefile>outputfile
WriteLn>outputfile,nWLNRes,<html> <html><head><title>MyFolks</title></head><body>
// Read each line, get hash value and output
Let>X=0
Label>FileLoop
Let>X=X+1
ReadLn>Emaillist,X,TexttoHash
If>TexttoHash=##EOF##,finish
Trim>TexttoHash,TexttoHash
LibFunc>%varDir%HashLib.dll,StringMD5,r1,TexttoHash,buf1
MidStr>r1_2,1,r1,Hashed1
LowerCase>Hashed1,Hashed1
WriteLn>outputfile,nWLNRes,<img> %TexttoHash%<br>
goto>FileLoop
Label>finish
MessageModal>Done
// Finish outputting the HTML file
WriteLn>outputfile,nWLNRes,</body></html>