• 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
please help with .plist variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

please help with .plist variables


  • Subject: please help with .plist variables
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 17 Aug 2014 14:35:35 +1000

G'day once again scripters.

I've taken John Welchs advice, and am trying to save my apps variables in a .plist file instead of a text file, and can already seem some advantages. However, I've struck a snag in that some of my variables are being errored as not keycode compliant. I don't know what that means, and searching on the net has proved fruitless.

Specifically, I need to store a list of 13 variables in the first sub-dictionary which contains…


The chosen cell of a radio button (which ATM is causing the error. I've tried setting it as text and as an integer, a display dialog as text on it shows '0'.

Text

Booleans

Integers

and also a sub-dictionary with two NSDates, so also...

NSDates


Regards

Santa




This handler is where I'm setting my playlistsRandomly as the radio buttons cell value

on retrieveDefaultsOne_(sender)
set theChoice to defaults's objectForKey_("bottomButtonChoice")
matrixPlaylistsRandomly's selectCellAtRow_column_(theChoice, 0)
set my playlistsRandomly to theChoice
end retrieveDefaultsOne_


This handler is where I (try) create the first sub-dictionary out of 5 sub-dictionaries. ATM it's failing on the first variable  my playlistsRandomly which is the radio button row variable.

on setSavingList()
try
say 1
set TheSavingList1 to current application's NSDictionary's dictionaryWithObjects_forKeys_({my playlistsRandomly, my playTracklistsRandomly, my playFullyRandomly as boolean, my playFullyRandomlySetValue as integer, my playAdvertisementTracksRandomly, my numberOfAdvertisementsLow as integer, my numberOfAdvertisementsHigh as integer, my advertisementLow as integer, my advertisementHigh as integer, my playPromotionTracksRandomly, my numberOfPromotionsLow as integer, my numberOfPromotionsHigh as integer, my promotionLow as integer, my promotionHigh as integer}, {"PlaylistsRandomlyData", "playTracklistsRandomlyData", "playFullyRandomlyData", "playFullyRandomlySetValueData", "playAdvertisementTracksRandomlyData", "numberOfAdvertisementsLowData", "numberOfAdvertisementsHighData", "advertisementLowData", "advertisementHighData", "playPromotionTracksRandomlyData", "numberOfPromotionsLowData", "numberOfPromotionsHighData", "promotionLowData", "promotionHighData"})

  on error errmsg

display dialog "setSavingList " & errmsg
end try
say 2
return TheSavingList1
end setSavingList

This handler is where i'll try and store tow NSDates, set by date pickers. Any expected problems I might encounter, I could use advice on, please.

on setNSDatesSaving()
try
  set TheSavingList3 to current application's NSDictionary's dictionaryWithObjects_forKeys_({my startDateTimeNSDAte, my finishDateTimeNSDAte}, {"startDateTimeNSDAteData", "finishDateTimeNSDAteData"})
on error errmsg
display dialog "setNSDatesSaving " & errmsg
end try
  return TheSavingList3
end setNSDatesSaving


This is my main saving handler...


on saveData() -- triggered by Save in File menu
try
if my OKtoSaveData then
try
set thePlayListArray to SelectedPlaylistsArrayController's arrangedObjects()
end try
set p to 1
if my workingFileName does not start with "ADJ " then set my workingFileName to "ADJ " & my workingFileName as text
set pathToDataFolder to path to documents folder
tell application "Finder"
if not (exists folder "ADJ Documents" of pathToDataFolder) then make new folder at pathToDataFolder with properties {name:"ADJ Documents"}
end tell
set theHFSPath to pathToDataFolder & "ADJ Documents:" & my workingFileName & ".plist" as text
set my workingFilePath to POSIX path of theHFSPath
set GeneralDataData to my setSavingList()
set IntroSignoffTracksData to my setIntroSignoffTracks()
set NSDatesSavingData to my setNSDatesSaving()
set TheHoursMinutesData to my saveTheHoursMinutes()
set myDict to current application's NSDictionary's dictionaryWithObjects_forKeys_({thePlayListArray, GeneralDataData, IntroSignoffTracksData, NSDatesSavingData, TheHoursMinutesData}, {"thePlayListArray", "GeneralDataData", "IntroSignoffTracksData", "NSDatesSavingData", "TheHoursMinutesData"})
try
display dialog workingFilePath as text
myDict's writeToFile_atomically_(workingFilePath, true)
on error errmsg
display dialog "Writing to file error " & errmsg
end try
set workingFileSaveNamePath to pathToDataFolder & "ADJ Documents:. Working File.dat" as text
set fileRef to (open for access workingFileSaveNamePath with write permission)
set eof fileRef to 0
write my workingFileName to fileRef
close access fileRef
end if
on error errmsg number errNum
try
close access fileRef
end try
display dialog "Save Data error " & errmsg & return & return & errNum & return & return & "p = " & p
end try
end saveData






 _______________________________________________
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

  • Prev by Date: Re: Please help with date format
  • Next by Date: Requesting help with ObjC conversion, please
  • Previous by thread: Re: Please help with date format
  • Next by thread: Requesting help with ObjC conversion, please
  • Index(es):
    • Date
    • Thread