set shellScriptReturn to do shell script "ldapsearch -x -h YOUR_LDAP_SERVER -LLL cn=`whoami` passwordExpirationTime" as text set n to (text 1 thru 14 of word -1 of shellScriptReturn) as number set expiryDate to date "Monday, December 1, 1000 12:00:0 AM" set expiryDate's year to n div 1.0E+10 - 1 set expiryDate's day to (n mod 1.0E+10 div 100000000) * 32 set expiryDate's day to n mod 100000000 div 1000000 set expiryDate's time to n mod 1000000 div 10000 * hours + n mod 10000 div 100 * minutes + n mod 100 set expiryDays to ((expiryDate - (current date)) div days) log expiryDays if expiryDays < DAYS_TO_NOTIFY and expiryDays > 0 then set theReply to display dialog "Your password will expire in " & expiryDays & " day(s). Do you want to change it now?" buttons {"Yes", "No"} default button 1 if button returned of theReply is "Yes" then tell application "Safari" activate make new document at the beginning of documents set the URL of the front document to "YOUR_WEBBASED_PASSWORD_SITE" set the bounds of window 1 to {0, 22, 900, 644} close (every window whose name is "Untitled 1") end tell end if else if expiryDays < 1 then set shellScriptReturn to do shell script "ldapsearch -x -h YOUR_LDAP_SERVER -LLL cn=`whoami` loginGraceRemaining | grep loginGraceRemaining:' '" as text set k to (text 1 thru 1 of word -1 of shellScriptReturn) as number if k is not 0 then set theReply to display dialog "You have no grace logins remaining. Click on Yes to change your password now." buttons {"Yes"} default button 1 if button returned of theReply is "Yes" then tell application "Safari" activate make new document at the beginning of documents set the URL of the front document to "YOUR_WEBBASED_PASSWORD_SITE" set the bounds of window 1 to {0, 22, 900, 644} close (every window whose name is "Untitled 1") end tell end if else display dialog "Your account has used all of its grace logins. Please contact the help desk to have your account reset." buttons {"Okay"} default button 1 end if end if