Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

too-lazy-to-refresh

language platform

the page I stared at for way too long: "اکنون زمان ثبت نام شما نمی باشد."

a tiny script that reloads a page for me and screams when something finally changes.

the story

So it was انتخاب واحد day at Sharif. Courses. Scarce ones. The kind where if you blink, the seat is gone and you're spending a semester in a class you didn't want at 8am on a Saturday.

The website was supposed to open at 8:00. It didn't. I'm pretty sure an admin somewhere forgot to hit a button.

Meanwhile, every other student was doing the thing: refresh, nothing, refresh, nothing, refresh, sigh. Some gave up and went back to sleep. A few probably refreshed until their fingers filed a complaint.

Me? I was too lazy to sit there refreshing... and also not lazy enough to just miss it. Those two feelings, at the exact same time. So instead of refreshing a page for an hour, I spent a suspiciously similar amount of time making my laptop do it for me. Worth it. Obviously.

what it does

Every ~30 seconds it:

  1. reloads the انتخاب واحد page in Chrome
  2. presses Enter (the page is a form POST, so Chrome asks "Confirm Form Resubmission" — Enter says "yeah, continue")
  3. checks if the phrase "اکنون زمان ثبت نام شما نمی باشد." ("it's not your registration time yet") is still there
  4. if that phrase is gone → registration is probably open → it blasts a loud, obnoxious alarm on repeat until I drag myself to the keyboard and hit Ctrl+C

Basically: a personal "wake up, it's open" pager. For free. In AppleScript. Don't judge.

how to run it

osascript watch-courses.applescript

Better version for the "I'm going to sleep" scenario (keeps the Mac awake so it doesn't doze off and miss the moment):

caffeinate -dimsu osascript watch-courses.applescript

Stop it with Ctrl+C, or:

pkill -f watch-courses.applescript

one-time setup (macOS being macOS)

  • Chrome: turn on View → Developer → Allow JavaScript from Apple Events (this is how the script peeks at the page text).
  • Accessibility: give your terminal app permission in System Settings → Privacy & Security → Accessibility (this is how it presses Enter). First run will also pop an "allow Terminal to control Chrome" prompt — say yes.

tweaks

  • Interval: change the delay 27.8 line near the bottom. Smaller = checks more often = catches the opening faster (but hammers the server more). ~10s is a reasonable "I'm serious about this course" setting.
  • Watching a different site? Swap the Persian phrase in the script for whatever "it's closed" text your page shows.
  • Alarm sound: it uses Sosumi because it's nice and piercing. Any file in /System/Library/Sounds/ works.

disclaimer

It's a hack. It worked for me. If a course gets away from you, that's between you and the registrar, not me. 🫡

About

A tiny AppleScript that refreshes my Sharif University course-registration page and blasts an alarm the moment it opens.

Topics

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages