1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| 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
|