Hi guys. One or two further suggestions, if I may…
If you’re using the path to command, and then concatenating text to complete the path, there are a couple of points to bear in mind.
Lets break down this form of construct:
set prefPath to path to preferences
set thePlist to (prefPath & "loginwindow.plist") as text
The actual stages involved might be itemised as:
set prefPath to path to preferences
-- result is an alias:
--> alias "startup disk:Users:username:Library:Preferences:"
set thePlist to (prefPath & "loginwindow.plist") as text
-- items in parentheses are evaluated first:
--> prefPath & "loginwindow.plist"
-- result of concatenation is a list:
--> {alias "startup disk:Users:username:Library:Preferences:", "loginwindow.plist"}
-- the next operation is a coercion:
--> {alias "startup disk:Users:username:Library:Preferences:", "loginwindow.plist"} as text
-- result of coercion to text is dependent on the value of AppleScript's text item delimiters:
--> "startup disk:Users:username:Library:Preferences:loginwindow.plist"
(* if text item delimiters are set to anything other than "" or {""}, the result will differ *)
-- the final operation assigns the result to the variable 'thePlist'
Now let’s compare that with another approach:
set prefPath to path to preferences as Unicode text
set thePlist to prefPath & "loginwindow.plist"
While this may look very similar, here’s what it does:
set prefPath to path to preferences as Unicode text
-- result is text (this is no coercion; the 'as type' parameter specifies the type of result returned by 'path to'):
--> "startup disk:Users:username:Library:Preferences:"
set thePlist to prefPath & "loginwindow.plist"
-- result of concatenation is text:
--> "startup disk:Users:username:Library:Preferences:loginwindow.plist"
-- the final operation assigns the result to the variable 'thePlist'
So the latter approach is less complex, involves fewer operations, executes faster “ and is less likely to return unexpected results. In addition, Unicode text paths are generally preferable to strings since, on some machines, file paths may include Unicode-only characters (which could cause the script to fail).
That said, we should be able to skip a few steps here anyway. Instead of this (for which, incidentally, the Finder tell statement isn’t needed)…
set prefPath to path to preferences
set thePlist to (prefPath & "loginwindow.plist") as text
set backupPlist to (prefPath & "loginwindow_old.plist") as text
tell application "Finder"
set theP to POSIX path of thePlist
set backupP to POSIX path of backupPlist
end tell
… we could jump straight to the POSIX paths:
set prefPath to POSIX path of (path to preferences)
set theP to prefPath & "loginwindow.plist"
set backupP to prefPath & "loginwindow_old.plist"
Another little refinement might be to replace this repeat loop…
tell application "System Events"
set t to login items
repeat with i from 1 to (length of t)
delete (first login item)
end repeat
end tell
… with a single command:
tell application "System Events" to delete login items
One final observation is probably worth mentioning. Apple advises that using sudo(8) and with administrator privileges is generally unnecessary, and creates security holes. Their recommendation is to remove the sudo altogether.
I hope none of this comes across as in any way critical; most of the points are fairly minor, and the examples highlighted are generally typical. Just thought I’d butt in with a few suggested tweaks, FWIW…

BTW, since I’m currently on a slightly older version of Tiger, perhaps I can double-check this with you guys. The hidden property of login items is broken here. Specifying {hidden:false} doesn’t reveal a problem, since that’s the default “ but {hidden:true} doesn’t work, and the value of the property is always returned as missing value. (I have to use a workaround.) Since you’re specifying the property, can I assume that the bug is now fixed?