• 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
Is there a problem with FordEvents and latest Sierra????
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is there a problem with FordEvents and latest Sierra????


  • Subject: Is there a problem with FordEvents and latest Sierra????
  • From: Brian Christmas <email@hidden>
  • Date: Fri, 18 Aug 2017 14:20:54 +1000

G’day folks

Sorry to keep annoying you all, but I’m striking some really curly problems,
while extending what was already a huge Project (now running over 50,000 lines
total, split into 8 Apps).

Situation….

I’m trying to save the contents of two array controllers, each line of which
contains two dates (current date).

I’m displaying in each table as the actual ASdate; tried as text, but no
success when saving.

Now, as saving to .plist with ASdates fails, I’m trying to use Shane’s Ford to
convert each date to an NSDate.

If I convert the dates to NSDates and display them WITHIN THE TABLE, a lot of
gobblygook shows. When I try and convert them in the saving routine, and
display the NSDate, the display dialog fails.

Either way, I get this error message when saving the Array Contents.

testing Shane's script The data couldn’t be written because of an error in the
destination for the data. error number -2700 p = 101



Question 1. Do I have to convert to NSDates, as Shane's Ebook suggests, when
the dates are part of an Array Controller list of contents? (I guess the
answers Yes, as saving without converting fails)

Question 2. Should the result of reading the saved AS dates in the table
connected to the Array Controller stay as an ASDate when read?

Question 3. Why don’t the ASDates seem to be converting to NSDates?

Question 4. Is there any other way of saving the dates in a .plist file, seeing
as (my ford:tempTime) does not seem to work ?

Question 5. As I’m timing the elapsed time beteween dates (Date 2  - Date 1),
and storing ASDates, I foresee a problem when changing to and from Daylight
saving, Can I use and display NSDates (ATM, it fails)?

Question 6. Can I replace the ASDate ‘current date’ in the code below with a
displayable NSDate?? ATM trying fails with error.

Question 7. Anybody spot any obvious mistakes in my coding, please? This has
been frustrating me for several days, and I think I’ve exhausted all options.



Regards

Santa

        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



        on saveTheGeneralData()
                my fordEvent() — Works!!!
                #
                # Set the actual email addresses
                #
                set p to 1
                try
                        set oldemailEntries to jobArrayController's
arrangedObjects() as list
                        # set (my jobINArray) to jobArrayController's
arrangedObjects() as list
                        set theWholeLot to {}
                        repeat with eachline in oldemailEntries
                                say 1
                                set tempTime to (eachline's JobINTime)
                                 say 2
                                (*try
                                        set tempRealTime to current
application's date tempTime as date — FAILS
                                        say 2.1
                                on error errmsg number errnum
                                        tell application "System Events" to
display dialog ("converting " & errmsg & " " & errnum & " p = " & p as text)
giving up after 20
                                end try*)
                                try
                                        tell application "System Events" to
display dialog tempTime as text — Works, but shortened version.
                                end try
                                say 3
                                set theNSDate to (my ford:tempTime)
                                # set theNSDate to (my
fordASDateToNSDate:tempTime)
                                say 4
                                try
                                        tell application "System Events" to
display dialog (theNSDate as text) -- FAILS
                                end try
                                try
                                        tell application "System Events" to
display dialog (theNSDate's timeIntervalSince1970()) as text -- FAILS
                                end try
                                set eachline's JobINTime to theNSDate
                                say 5
                                set tempTime to (eachline's JobOUTTime)
                                say 6
                                set theNSDate to (my ford:tempTime)
                                # set theNSDate to (my
fordASDateToNSDate:tempRealTime)
                                say 8
                                set eachline's JobOUTTime to theNSDate
                                say 9
                                set end of theWholeLot to eachline
                        end repeat
                        set p to 1.1
                        say 10
                        set (my jobINArray) to theWholeLot
                on error errmsg number errnum
                        say 11
                        set (my jobINArray) to {}
                        if errnum is not in {-1728, -10000} then
                                tell application "System Events" to display
dialog ("saveTheGeneralData 1 " & errmsg & " " & errnum & " p = " & p as text)
giving up after 20
                        end if
                end try
                #
                #
                set p to 2
                try
                        set oldemailEntries to
lastCompletedJobsArrayController's arrangedObjects() as list
                        set theWholeLot to {}
                        repeat with eachline in oldemailEntries
                                set tempTime to (eachline's JobINTime)
                                set theNSDate to (my ford:tempTime)
                                set oldemailEntries's JobINTime to theNSDate
                                set tempTime to (eachline's JobOUTTime)
                                set theNSDate to (my ford:tempTime)
                                set oldemailEntries's JobOUTTime to theNSDate
                                set end of theWholeLot to eachline
                        end repeat
                        set p to 2.1
                        set (my jobOUTArray) to theWholeLot
                on error errmsg number errnum
                        set (my jobOUTArray) to {}
                        if errnum is not in {-1728, -10000} then
                                tell application "System Events" to display
dialog ("saveTheGeneralData 2 " & errmsg & " " & errnum & " p = " & p as text)
giving up after 20
                        end if
                end try
                #
                #
                try
                        set thePPath to POSIX path of ((my
mailManagerDesktopFolderPath as text) & "General Production Data.plist")
                on error errmsg number errnum
                        tell application "System Events" to display dialog
"Setting thePPath " & errmsg
                end try
                try
                        do shell script "mkdir -p " & quoted form of POSIX path
of (my mailManagerDesktopFolderPath)
                end try
                try
                        set (my daysToRemove) to (my daysToRemove) as text
                end try
                try
                        say 100
                        set myDict to current application's NSDictionary's
dictionaryWithObjects:{stationName, saveToAccountancyPath, jobINArray,
jobOUTArray, daysToRemove, unitsOfMeasurement, usesMeasurements}
forKeys:{"stationNameKey", "saveToAccountancyPathKey", "jobINKey", "jobOUTKey",
"daysToRemoveKey", "unitsOfMeasurementKey", "usesMeasurementsKey"}
                        say 101
                on error errmsg number errnum
                        tell application "System Events" to display dialog
"Setting myDict " & errmsg
                end try
                try
                        set p to 100
                        set {theData, theError} to current application's
NSPropertyListSerialization's dataWithPropertyList:myDict format:(current
application's NSPropertyListXMLFormat_v1_0) options:0 |error|:(reference)
                        set p to 101
                        if theData = missing value then error theError's
localizedDescription() as text
                        set p to 102
                        say 102
                        set {theResult, theError} to theData's
writeToFile:thePPath options:(current application's NSDataWritingAtomic)
|error|:(reference)
                        say 103
                        set p to 103
                        if not theResult as boolean then error theError's
localizedDescription() as text
                on error errmsg number errnum
                        tell application "System Events" to display dialog
"testing Shane's script " & errmsg & " error number " & errnum & " p = " & p
giving up after 20
                end try
        end saveTheGeneralData


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: Is there a problem with FordEvents and latest Sierra????
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: QuickTime replacement?
  • Next by Date: Re: Is there a problem with FordEvents and latest Sierra????
  • Previous by thread: Re: QuickTime replacement?
  • Next by thread: Re: Is there a problem with FordEvents and latest Sierra????
  • Index(es):
    • Date
    • Thread