Facebook Programming tricks Techniques Tricks Useful

Create an Easy Facebook Birthday Reminder

We all wish our friends on their birthdays. But sometimes although rare, we forget to wish either because of some official or personal problem. In such cases there may be another option, you can wish him/her a belated Happy Birthday. But the problem here is, how to know whose birthday is the next or whose birthday has recently gone. To resolve this I have created an application for you. Just follow these instructions and you will never forget to wish your friends because each time you open your PC it will remind you about your Friend’s Birthdays.

Birthday Reminder
  • First you need to temporarily change the date format of your PC to dd-MMM-yy , it is because you are going to export all your Friend’s Birthday from Facebook to an Excel file and I want, the Birthday to be exported in dd-MMM-yy format.
  • To change the date format just click on the Calendar present at the bottom right of your screen. Then click on Change date and time settings–>Change date and time–>Change calendar setings.
  • Choose the short date dd-MMM-yy from the dropdown present under the Date formats and click OK.
  • Now Export all of your Facebook friends birthdays to an Excel file. If you don’t know how to export, then read the following article which I have posted yesterday.
  • http://www.funbutlearn.com/2012/08/export-your-facebook-friends-birthdays.html
  • I think now you are ready with .CSV file containing all of your Facebook friend’s name and Birthdays. Don’t make any change in the file.
  •  Now just copy and paste the following code in a notepad and save it in .vbs extension. 
Wscript.sleep 5000
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("D:Bday.CSV", ForReading)
strData = objTextFile.ReadAll
strData = Replace(strData, """", "")
Index = 1
today = ""
tomorrow = ""
yesterday = ""
arrLines = Split(strData, vbCrLf)
For Each arrWord In arrLines
If (Index <> 1 And arrWord <> "") Then
dsplit = Split(arrWord, ",")
dmy = Split(dsplit(1), "-")
If (Int(dmy(0)) + 1 = Day(Now) And Int(dmy(1)) = Month(Now) And Int(dmy(2)) = Year(Now)) Then
yesterday = yesterday + dsplit(0) + ", "
End If
If (Int(dmy(0)) = Day(Now) And Int(dmy(1)) = Month(Now) And Int(dmy(2)) = Year(Now)) Then
today = today + dsplit(0) + ", "
End If
If (Int(dmy(0)) - 1 = Day(Now) And Int(dmy(1)) = Month(Now) And Int(dmy(2)) = Year(Now)) Then
tomorrow = tomorrow + dsplit(0) + ", "
End If
End If
Index = Index + 1
If (yesterday <> "") Then
finalmessage = finalmessage + "Yesterday: " + Mid(yesterday, 1, Len(yesterday) - 2) + vbCrLf + vbCrLf
End If
If (today <> "") Then
finalmessage = finalmessage + "Today: " + Mid(today, 1, Len(today) - 2) + vbCrLf + vbCrLf
End If
If (tomorrow <> "") Then
finalmessage = finalmessage + "Tomorrow: " + Mid(tomorrow, 1, Len(tomorrow) - 2)
End If
If (finalmessage <> "") Then
MsgBox finalmessage, , "Birthday Reminder"
End If
  • Now a very important step is setting the path correctly. As of now, you have two files. One is the .CSV file which contains the birthdays and another is the .vbs file which contains the above code.
  • Now save the .CSV file in a safe place and never delete it, because each time you start your computer the program will access this .CSV file to fetch the Birthdays.
  • Now go to the .vbs file and look at the 4th line. There is a path “D:Bday.CSV”. It means I have kept the Bday.CSV file in D: drive. Similarly you have to give your own path to the .CSV file in the 4th line.
Please set your own path here
  • Now save the .vbs file and close it. To check the correctness of the program, double click on the .vbs file and wait for 5 seconds. It will show your friend’s birthdays if any birthday is there yesterday/today/tomorrow.
  • Now think for a while, how the code will automatically run, each time you restart your computer ? Yes, you have to put the file in windows start up folder.
  • To do this, simply open My computer and in the address bar type “C:Users%USERNAME%AppDataRoamingMicrosoftWindowsStart MenuProgramsStartup” with out the quotes and press enter.
  • This will open your start up folder. Copy only the .vbs file in the start up folder and you are done. No need to copy the .CSV file. Never change the path of the .CSV file.
  • Now restart your computer to check whether everything is working fine or not.
You may also like to see