• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Preference file problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Preference file problem


  • Subject: Preference file problem
  • From: Brian Christmas <email@hidden>
  • Date: Tue, 12 May 2015 16:29:12 +1000

G’day scripters

I’ve got a defaults preferences file that I wrote about a little while ago, and I’m trying to add two extra defaults to it. However, the two extras are not being written to the preferences file.

My question is, can I simply use the same ’tell defaults to register defaults:' line I previously used, or must I somehow add them separately? Or is my code correct and the problem lies elsewhere?

My code follows, with the two extra new preferences being clientMaxSave, startDisplayingHourlyJobsDateStore.

Regards

Santa

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 NStimeStore to my makeNSDateFrom:theTimeStore
set p to 5
tell defaults to registerDefaults:{saveLocalftpArchive:true, clientMaxSave:1000, trashNumber:1000, trashInc:100, clientInc:1, AutoEmptytrash:true, theUnprocessedSound:false, mailManagerDesktopFolderPathArchive:"", startDisplayingHourlyJobsDateStore:NStimeStore as date}
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 defaults to set NStimeStore to objectForKey_("startDisplayingHourlyJobsDateStore")
set my startDisplayingHourlyJobsDate to my makeASDateFrom:NStimeStore
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) + 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:

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Preference file problem
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: How can I add items to user defaults.
  • Next by Date: Re: Preference file problem
  • Previous by thread: Re: How can I add items to user defaults.
  • Next by thread: Re: Preference file problem
  • Index(es):
    • Date
    • Thread