Не удалось найти много документации по файлам PList, я думаю, что мне не хватает некоторого синтаксиса.
Цель - запустить скрипт и записать записи пользователя в a. plist, чтобы эти значения могли быть возвращены, даже если сценарий завершается. Более поздняя цель - вывести эти значения по электронной почте или через Google Suite. Имел возможность создавать, изменять и вызывать отдельные значения, но добавление отдельных элементов в списки и последующий вызов всего списка (или даже одного значения) пока не работает.
set CaptureFolder to (choose folder with prompt "Select Capture Folder")
set PListString to (CaptureFolder & "Capture.plist") as text
try
set PListAlias to PListString as alias
set BuildPList to false
on error
set BuildPList to true
end try
if BuildPList is false then
tell application "System Events"
set theParentDictionary to make new property list item with properties {kind:record}
set thePListFile to PListString
set thePListDir to property list file thePListFile
end tell
else
set PListPath to POSIX path of PListString
tell application "System Events"
set theParentDictionary to make new property list item with properties {kind:record}
set thePListFile to PListString
set thePListFileDir to make new property list file with properties {contents:theParentDictionary, name:thePListFile}
tell property list items of thePListFileDir
make new property list item at end with properties {kind:boolean, name:"booleanKey", value:true}
make new property list item at end with properties {kind:date, name:"dateKey", value:current date}
make new property list item at end with properties {kind:list, name:"SKUlist", value:{}}
make new property list item at end with properties {kind:list, name:"unknownDeptlist"}
make new property list item at end with properties {kind:list, name:"Folderlist"}
make new property list item at end with properties {kind:number, name:"FolderCounter", value:0}
make new property list item at end with properties {kind:record, name:"recordKey"}
make new property list item at end with properties {kind:string, name:"stringKey", value:"string value"}
end tell
end tell
end if
if BuildPList is false then
tell application "System Events"
tell property list file thePListFile
set FolderNumber to value of property list item "FolderCounter"
# This keeps erroring out
set PseudoSKU to the value of item -1 of property list item "SKUList"
#
end tell
end tell
else
set FolderNumber to {0}
end if
# Sample Loops
repeat 5 times
set FolderNumber to (FolderNumber + 1)
set FolderNumberString to FolderNumber as string
set PseudoSKU to ("SKU_" & FolderNumber)
display dialog (FolderNumberString & " " & PseudoSKU) --
tell application "System Events"
tell property list file thePListFile
set value of property list item "FolderCounter" to FolderNumber
# Same item, but in reverse
set array of property list item "SKUList" to PseudoSKU
#
end tell
end tell
end repeat
''«