Re: Is there a problem with FordEvents and latest Sierra????
Re: Is there a problem with FordEvents and latest Sierra????
- Subject: Re: Is there a problem with FordEvents and latest Sierra????
- From: Shane Stanley <email@hidden>
- Date: Fri, 18 Aug 2017 15:21:28 +1000
On 18 Aug 2017, at 2:20 pm, Brian Christmas <email@hidden> wrote:
>
> Anybody spot any obvious mistakes in my coding, please?
It's not so much your code as your whole approach. You're too busy trying to
crack some magic combination based on a bad guess, rather than trying to
understand what's happening. Most of that code is trying to solve a problem
that doesn't exist.
Run this in Script Debugger:
use AppleScript version "2.5" -- Yosemite (10.11) or later
use framework "Foundation"
use framework "AppKit"
use scripting additions
set jobArrayController to current application's NSArrayController's alloc()'s
init()
set anObj to current application's NSMutableDictionary's
dictionaryWithObjects:{"theCode", "theInsert", current date, "", 0.0, 0.0,
"plainCircle", "plainCircle"} forKeys:{"BarcodeName", "JobDetails",
"JobINTime", "JobOUTTime", "imageHeight", "imageWidth", "Started", "SENT"}
jobArrayController's addObject:anObj
set oldemailEntries to jobArrayController's arrangedObjects()
set thePPath to POSIX path of ((path to desktop as text) & "General Production
Data.plist")
set myDict to current application's NSDictionary's
dictionaryWithObjects:{"stationName", "saveToAccountancyPath", oldemailEntries,
oldemailEntries, "daysToRemove", "unitsOfMeasurement", "usesMeasurements"}
forKeys:{"stationNameKey", "saveToAccountancyPathKey", "jobINKey", "jobOUTKey",
"daysToRemoveKey", "unitsOfMeasurementKey", "usesMeasurementsKey"}
set {theData, theError} to current application's NSPropertyListSerialization's
dataWithPropertyList:myDict |format|:(current application's
NSPropertyListXMLFormat_v1_0) options:0 |error|:(reference)
if theData = missing value then error theError's localizedDescription() as text
set {theResult, theError} to theData's writeToFile:thePPath options:(current
application's NSDataWritingAtomic) |error|:(reference)
if not theResult as boolean then error theError's localizedDescription() as text
You can see that (in 10.11 and later) the scripting bridge generally takes care
of dates, and it all works fine.
Try again. If it fails on dataWithPropertyList::::, use NSLog() to log the
value of myDict to Xcode's console, so you can see what's upsetting the
applecart.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden