I’ve got a set of existing standardUserDefaults(), and I’d like to add another item to the set, namely a date.
Trying to add the object in a separate routine also throws the same error.
I’ve tried adding the variable as a property, with the same result.
property startDisplayingHourlyJobsDate : current date
property displayHourlyJobsFlag : true
property theTimeStore : current date
on applicationWillFinishLaunching:aNotification
-- Insert code here to initialize your application before any files are opened
try
set p to 0
set my ShanesFord to current application's ObjectWithFords's alloc()'s init()
set p to 1
set my ftpPrintFlag to false
set p to 2
set my pathToDesktop to path to desktop
set p to 4
tell current application's NSUserDefaults to set defaults to standardUserDefaults()
set theTimeStore to current date
set time of theTimeStore to 0
set p to 5
tell defaults to registerDefaults:{saveLocalftpArchive:true, clientMaxSave:1000, trashNumber:1000, trashInc:100, clientInc:1, AutoEmptytrash:true, theUnprocessedSound:false, mailManagerDesktopFolderPathArchive:""}
set p to 6
try
tell defaults to set my saveLocalftpArchiveOnserver to objectForKey_("saveLocalftpArchive")
on error
set my saveLocalftpArchiveOnserver to false
end try
try
tell defaults to set my clientMax to objectForKey_("clientMaxSave")
on error
set my clientMax to 1000
end try
try
tell defaults to set my trashEmptyNumber to objectForKey_("trashNumber")
on error
set my trashEmptyNumber to 1000
end try
try
tell defaults to set my trashIncrement to objectForKey_("trashInc")
trashStepper's setIncrement:trashIncrement
on error
trashStepper's setIncrement:100
end try
try
tell defaults to set my clientIncrement to objectForKey_("clientInc")
on error
set my clientIncrement to 1
end try
try
tell defaults to set my AutomaticallyEmptytrash to objectForKey_("AutoEmptytrash")
on error
set my AutomaticallyEmptytrash to true
end try
try
tell defaults to set my theUnprocessedMailSound to objectForKey_("theUnprocessedSound")
on error
set my theUnprocessedMailSound to false
end try
try
set p to 7
tell defaults to set tempMailManagerDesktopFolderPath to objectForKey_("mailManagerDesktopFolderPathArchive")
tell application "Finder"
try
set my mailManagerDesktopFolderPath to (tempMailManagerDesktopFolderPath as text) as alias as text
end try
end tell
on error errmsg number errnum
try
do shell script "mkdir -p " & quoted form of POSIX path of ((my pathToDesktop) & "Mail Manager Folder" as text)
set my mailManagerDesktopFolderPath to ((my pathToDesktop & "Mail Manager Folder") as text) as alias as text
on error errmsg
tell application "System Events" to display dialog "applicationwillFinishLaunching setting Mail Manager Folder path error " & errmsg as text giving up after 40
end try
end try
try
set p to 8
tell current application's NSUserDefaults to set defaultsTwo to standardUserDefaults()
set p to 9
# This line throws an error
tell defaultsTwo to registerDefaults:{startDisplayingHourlyJobsDateStore:theTimeStore}
set p to 10
tell defaultsTwo to set my startDisplayingHourlyJobsDate to objectForKey_("startDisplayingHourlyJobsDateStore")
on error errmsg number errnum
tell application "System Events" to display dialog "applicationwillFinishLaunching error setting user defaults two" & errmsg & return & "error number " & errnum & " p = " & p as text giving up after 40
set my startDisplayingHourlyJobsDate to current date
end try