AppleScript to automate Happy Birthday posts!

By DustinSmith | PhineasGage | 24 Feb 2020


I have 517 friends on facebook, and while its easy to keep track of the birthdates of the people closest to me its just not feasible to find the time to tell everyone on my friends list happy birthday.

This morning I wrote this short script that leaves a "Happy birthday!" comment on one of my friends timelines. It would be super easy to make it do more than one but I want to let this run for a few days to make sure it continues to work before that. If you use Automator on your mac you can create a calander event and even make this run every night at 12:01 to ensure you're always the first to tell your friends happy birthday. Just copy and paste the script below in your workflow. Depending on screen size you might need to adjust the points that the mouse clicks (click at {673, 373}. If you dont keep your facebook logged in; you'll also want to add a login workflow. I didn't share that part for obvious reasons. This works best with Safari. I have yet to find a way to run it with Brave yet.

I'm willing to help anyone interested in getting theirs to work if they need it. Just drop a comment with as much info about the error you're running in to as you can.

Enjoy!!

----------------------------------------------

tell application "Safari"

activate

open location "https://www.facebook.com/events/birthdays/"

tell application "System Events" to tell application process "Safari"

tell window 1

set {size, position} to {{666, 666}, {333, 128}}

end tell

end tell

delay 3

tell application "System Events"

click at {673, 373}

keystroke "Happy birthday!"

keystroke return

end tell

delay 3

quit

return

end tell

 

How do you rate this article?

1



PhineasGage
PhineasGage

“All that was great in the past was ridiculed, condemned, combated, suppressed — only to emerge all the more powerfully, all the more triumphantly from the struggle.” - Nikola Tesla

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.