This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set thePList to "Users:JoeBuhlig:Dropbox:pList:Project_Codes.plist" | |
set thePListPath to POSIX path of thePList | |
tell application "System Events" | |
tell property list file thePListPath | |
tell contents | |
set pcode to value of property list item "HouseCar" | |
set yr to text -2 thru -1 of ("00" & (year of (current date))) as number | |
set y to text -6 thru -5 of pcode as number | |
set inc to text -2 thru -1 of pcode as number | |
if (yr > y) then | |
set inc to 1 | |
else | |
set inc to inc + 1 | |
end if | |
set inc to text -2 thru -1 of ("00" & inc) | |
set newcode to yr & "HC" & inc as string | |
set value of property list item "HouseCar" to newcode | |
end tell | |
end tell | |
end tell | |
return newcode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment