For some reason, since the X.10.3 update I think, my projects .plist read has stopped working.
Does anyone know if my code below is faulty (I’ve updated it slightly to match Shanes latest ebook), or if there’s a fault somewhere else.
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
set defaults to current application's NSUserDefaults's standardUserDefaults()
set p to 5
set theTimeStore to current date
set time of theTimeStore to 0
set NStimeStore to my makeNSDateFrom:theTimeStore
defaults's registerDefaults:{saveLocalftpArchive:true, clientMaxSave:1000, trashNumber:1000, trashInc:100, clientInc:1, autoEmptytrash:false, theUnprocessedSound:false, mailManagerDesktopFolderPathArchive:"", startDisplayingHourlyJobsDateStore:NStimeStore}
set p to 6
All the below ‘set to defaults’s' revert to the properties
try
set saveLocalftpArchiveOnserver to defaults's objectForKey:"saveLocalftpArchive"
on error
set my saveLocalftpArchiveOnserver to false
end try
try
set clientMax to defaults's objectForKey:"clientMaxSave"
on error
set my clientMax to 1000
end try
try
set trashEmptyNumber to defaults's objectForKey:"trashNumber"
on error
set my trashEmptyNumber to 1000
end try
try
set trashIncrement to defaults's objectForKey:"trashInc"
trashStepper's setIncrement:trashIncrement
on error
trashStepper's setIncrement:100
end try
try
set clientIncrement to defaults's objectForKey:"clientInc"
on error
set my clientIncrement to 1
end try
try
set automaticallyEmptyTrash to defaults's objectForKey:”autoEmptytrash" —< , a tick box property entry, which now is always is ticked on startup of app.
on error
say "error in setting trash empty default” —< error never occurs
set my automaticallyEmptyTrash to true
end try
try
set theUnprocessedMailSound to defaults's objectForKey:"theUnprocessedSound"
on error
set my theUnprocessedMailSound to false
end try
try
set p to 7
set tempMailManagerDesktopFolderPath to defaults's 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
set p to 8
try
set p to 8
tell defaults to set tempStartingDate to defaults's objectForKey:"startDisplayingHourlyJobsDateStore"
if tempStartingDate = NStimeStore then
defaults's setObject:NStimeStore forKey:"startDisplayingHourlyJobsDateStore"
else
set NStimeStore to tempStartingDate
end if
set my startDisplayingHourlyJobsDate to my makeASDateFrom:NStimeStore
on error errmsg number errnum
tell application "System Events" to display dialog "applicationwillFinishLaunching error setting user defaults NStimeStore" & errmsg & return & "error number " & errnum & " p = " & p as text giving up after 40
set my startDisplayingHourlyJobsDate to (current date) + 9 * weeks
end try
set p to 11
set my displayHourlyJobsFlag to ((current date) < ((my startDisplayingHourlyJobsDate) + 8 * weeks))
set my messagesBottomtext to "Mail Manager should be processing Email normally."
set p to 9
on error errmsg number errnum
if errnum ≠ -1728 and errnum ≠ -1700 then tell application "System Events" to display dialog "applicationwillFinishLaunching error " & errmsg & return & "error number " & errnum & " p = " & p as text giving up after 40
end try
my initializingRoutine()
end applicationWillFinishLaunching: