Last Updated: February 25, 2016
·
405
· mbarinc

Automatically change the OS X Login Window text

I wrote a python script that read at random a row in a text file that contain my phrases database. Below the script:

import os,random

lines = []
fin = open('/opt/local/etc/random_login_text.list', 'r')

for line in fin.readlines():
    lines.append(line.strip())

linesRandom = random.randint(0, len(lines))
newLoginText =  lines[linesRandom -1]

print newLoginText

theCommand = 'defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "' + newLoginText + '"'
print theCommand

os.system(theCommand)

To change the text after every login, I added a call to the script in the System Preferences -> Accounts menù

Picture