• 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
Re: Absolutely perplexed!!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Absolutely perplexed!!


  • Subject: Re: Absolutely perplexed!!
  • From: Brian Christmas <email@hidden>
  • Date: Sat, 12 Aug 2017 15:40:45 +1000

Thanks again Shane.

I tried your code on my amended .plist saving, and got errors, so I reverted to
my shorter original version.

I methodically worked my way throught every setting of my Set-up Window, and
they all saved OK, using your script, UNTIL I STARTED ON THE 3 EMAIL TABLES
last of all.

Straight away I got errors in the second line of your code, so I commented it
out, and then got errors in the third line.

I then removed all the entries in the 3 email tables, and created new entries
with just the first column, a check box cell, ticked, and your code worked
perfectly.

I then typed some  single, simple words into the actual email text cell, in the
2nd column, (3rd column in 3rd table), and the code errored.

Here’s the two errors, and the code, if the length passes acceptance in posting.

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

2nd line commented out.

testing Shane’s script  missing value doesn’t understand the
“writeToFile_options_error_” message number -1708 p = 102

Should I not be using a text cell for the email addresses? It was fine before!

BRAINWAVE:::: Immediately I wrote the last line, I dragged three new text cells
into each column, and damn it, everythings now FINE!!!

Apple must have altered their code to change the behaviour of old and new text
cells, and I’ve just searched, and cannot find any notification.

Shane, I NEVER would have thought of this without your suggested alterations,
and my resultant trying to isolate what the hell was going on. So thank you
again.

Regards

Santa


on saveTheGeneralData()
                #
                # Set the actual email addresses
                #
                try
                        do shell script "mkdir -p " & quoted form of POSIX path
of (my mailManagerDesktopFolderPath)
                end try
                try
                        my openAndPreparetheTempEMailData:me
                end try
                #
                try
                        set (my theBusinessName) to (my theBusinessName) as text
                end try
                #
                #  Set up Emails
                #
                try
                        set emailText1Array to (table1ArrayController's
arrangedObjects()) as list
                        #tell application "System Events" to display dialog
(count of (emailText1Array)) & return & emailAddressOne of item 1 of
emailText1Array as text -- returns '1', '2', etc
                on error errmsg number errnum
                        if (my runForOz) then say "Array controller 1"
                        set emailText1Array to {}
                        tell application "System Events" to display dialog
("saveTheGeneralData 1 " & errmsg as text) giving up after 20
                end try
                try
                        set emailText2Array to (table2ArrayController's
arrangedObjects()) as list
                on error errmsg number errnum
                        if (my runForOz) then say "Array controller 2"
                        set emailText2Array to {}
                        tell application "System Events" to display dialog
("saveTheGeneralData 2 " & errmsg as text) giving up after 20
                end try
                try
                        set emailText3Array to (table3ArrayController's
arrangedObjects()) as list
                on error errmsg number errnum
                        if (my runForOz) then say "Array controller 3"
                        set emailText3Array to {}
                        tell application "System Events" to display dialog
("saveTheGeneralData 3 " & errmsg as text) giving up after 20
                end try
                try
                        set mailDict to current application's NSDictionary's
dictionaryWithDictionary:{mailAddressesMainErrorKey:mailAddressesMainError,
emailText1Key:emailText1Array, emailText2Key:emailText2Array,
emailText3Key:emailText3Array}
                        # tell application "System Events" to display dialog
((count of (mailDict)) & return & mailAddressesMainError as text) & return &
emailAddressOne of item 1 of emailText1Array & return & emailAddressTwo of item
1 of emailText2Array & return & emailAddressThree of item 1 of emailText3Array
as text -- returns '1', '2', etc
                on error errmsg number errnum
                        tell application "System Events" to display dialog
"saveTheGeneralData set mailDict " & errmsg & return & return & "It appears you
have not yet set all the Email recipients. " & errmsg giving up after 20
                end try
                #
                #
                try
                        set lastReceivedemailsListList to
emailListArrayController's arrangedObjects() as list
                on error errmsg number errnum
                        set lastReceivedemailsListList to {}
                        my displayError("saveTheGeneralData 4 " & errmsg as
text)
                end try
                try
                        set theLastMidnightCheckerStoreNSDate to my
makeNSDateFrom:theLastMidnightCheckerStore
                on error errmsg number errnum
                        set theLastMidnightCheckerStoreNSDate to my
makeNSDateFrom:((current date) - days)
                end try
                try
                        set minutes of my specialReportSentTime to 0
                        set seconds of my specialReportSentTime to 0
                        set theLastSpecialReportStoreNSDate to my
makeNSDateFrom:specialReportSentTime
                on error errmsg number errnum
                        set theLastSpecialReportStoreNSDate to my
makeNSDateFrom:((current date) - days)
                end try
                try
                        set numbersDict to current application's NSDictionary's
dictionaryWithDictionary:{sendNumbersChartAlsoKey:sendNumbersChartAlso,
sendNumbersChartOnlyKey:sendNumbersChartOnly,
numbersGraphStoreEachNumbersFileKey:numbersGraphStoreEachNumbersFile,
numbersGraphPreviousDaysPermanentKey:numbersGraphPreviousDaysPermanent,
numbersGraphPreviousWeeksPermanentKey:numbersGraphPreviousWeeksPermanent,
numbersGraphPreviousMonthsPermanentKey:numbersGraphPreviousMonthsPermanent,
numbersGraphLastYearsPermanentKey:numbersGraphLastYearsPermanent,
theNumbersGraphTypeKey:theNumbersGraphType}
                on error errmsg number errnum
                        my displayError("saveTheGeneralData set numbersDict  "
& errmsg as text)
                end try
                try
                        set theNSPreviousSunday to my makeNSDateFrom:(my
thePreviousSunday)
                on error errmsg number errnum
                        set theNSPreviousSunday to my makeNSDateFrom:(current
date)
                end try
                try
                        set minutes of (my hourlyReportsDateKeeper) to 0
                        set seconds of (my hourlyReportsDateKeeper) to 0
                        set theNShourlyReportsDateKeeper to my
makeNSDateFrom:hourlyReportsDateKeeper
                on error errmsg number errnum
                        set c to current date
                        set minutes of c to 0
                        set seconds of c to 0
                        set theNShourlyReportsDateKeeper to my makeNSDateFrom:c
                end try
                try
                        set specialReportSetterTitle to
PopUpButtonSpecialReport's title()
                on error errmsg number errnum
                        set specialReportSetterTitle to "<None>"
                end try
                try
                        if (count of (my hourlyReports)) = 0 then set (my
hourlyReports) to {"None"}
                end try
                try
                        set myDict to current application's NSDictionary's
dictionaryWithObjects:{mailDict, theBusinessName, theServerDisk,
serverBackupState, hourlyReports, theCoverPagePrinter, theSmallPaperList,
theLargePagePrinter, theLargePaperList, sayEveryErrorMessage, rtfdPapersize,
largePapersize, voiceSetter, emailsMaxRetrievable, lastReceivedemailsListList,
interarchyActivator, saveLocalftpArchiveOnserver,
theLastMidnightCheckerStoreNSDate, emailsToChooseFromSortDefiner, numbersDict,
theNShourlyReportsDateKeeper, theNSPreviousSunday, specialReportSetterTitle,
theLastSpecialReportStoreNSDate, ignoreGraphicConverterCount,
checkInterarchyEvery, theMainEmailAddress, includeCompressedExcelSpreadSheet,
maxBarcodeCharacters, printGCToA4Test, barcodeSize, dontPrintSignatures,
SendErrorMessage, SendSalesErrorMessage, shutDownCycle, errorsListDisplay,
eMailAddressesList, printBarcodes, replaceMissingFonts, activateInDesign,
AcrobatOverlap, printWithQuark, cropBoxError, cropBoxErrordpi,
salesAddressKeeperStore, printEveryImage, eMailAddressesListButton,
theGCPosition, saveToAccountancy, saveToAccountancyPath}
forKeys:{"mailDictKey", "theBusinessNameKey", "sFKey", "serverBackupStateKey",
"hourlyReportsKey", "theCoverPagePrinterKey", "theSmallPaperListKey",
"theLargePagePrinterKey", "theLargePaperListKey", "sayEveryErrorMessageKey",
"rtfdPapersizeKey", "largePapersizeKey", "voiceSetterKey",
"emailsMaxRetrievableKey", "lastReceivedemailsListKey",
"interarchyActivatorKey", "saveLocalftpArchiveOnserverKey",
"theLastMidnightCheckerStoreNSDateKey", "emailsToChooseFromSortDefinerKey",
"numbersDictKey", "hourlyReportsDateKeeperKey", "thePreviousSundayKey",
"specialReportSetterKey", "theLastSpecialReportStoreNSDateKey",
"ignoreGraphicConverterCountKey", "checkInterarchyEveryKey",
"theMainEmailAddressKey", "includeCompressedExcelSpreadSheetKey",
"maxBarcodeCharactersKey", "printGCToA4TestKey", "barcodeSizeKey",
"dontPrintSignaturesKey", "SendErrorMessageKey", "SendSalesErrorMessageKey",
"shutDownCycleKey", "errorsListDisplayKey", "eMailAddressesListKey",
"printBarcodesKey", "replaceMissingFontsKey", "activateInDesignKey",
"AcrobatOverlapKey", "printWithQuarkKey", "cropBoxErrorKey",
"cropBoxErrordpiKey", "salesAddressKeeperStoreKey", "printEveryImageKey",
"eMailAddressesListButtonKey", "theGCPositionKey", "saveToAccountancy",
"saveToAccountancyPath"}
                        if (my runForOz) then say "my dict set"
                on error errmsg number errnum
                        tell application "System Events" to display dialog
"Setting myDict " & errmsg
                end try
                try
                        set thePPath to POSIX path of ((path to desktop as
text) & "Mail Manager Folder:General Data.plist")
                on error errmsg number errnum
                        tell application "System Events" to display dialog
"Setting thePPath " & errmsg
                end try
                set thePath to ((path to desktop as text) & "Mail Manager
Folder:General Data.plist")
                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
                        set {theResult, theError} to theData's
writeToFile:thePPath options:(current application's NSDataWritingAtomic)
|error|:(reference)
                        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 & " numberr " & errnum & " p = " & p giving
up after 20
                end try
        end saveTheGeneralData


> On 12 Aug 2017, at 12:12 pm, Shane Stanley <email@hidden> wrote:
>
> On 12 Aug 2017, at 11:56 am, Brian Christmas <email@hidden
> <mailto:email@hidden>> wrote:
>>
>> If I’ve got your code working correctly
>
> The code is for writing a property list file -- that's what "writeToFile"
> means. So you use it *instead* of dicking around with System Events. The
> variable theDictionary in my sample represents the actual data you want to
> save -- it can be a dictionary, record, list, array -- whatever you want to
> save. In your original example it probably means you want to use numbersDict,
> but I'm not sure because I can't follow your code.
>
> --
> Shane Stanley <email@hidden <mailto:email@hidden>>
> <www.macosxautomation.com/applescript/apps/
> <http://www.macosxautomation.com/applescript/apps/>>, <latenightsw.com
> <http://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

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

References: 
 >Fwd: Absolutely perplexed!! (From: Brian Christmas <email@hidden>)
 >Re: Absolutely perplexed!! (From: Shane Stanley <email@hidden>)
 >Re: Absolutely perplexed!! (From: Brian Christmas <email@hidden>)
 >Re: Absolutely perplexed!! (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Absolutely perplexed!!
  • Next by Date: Apple events overridden.
  • Previous by thread: Re: Absolutely perplexed!!
  • Next by thread: Apple events overridden.
  • Index(es):
    • Date
    • Thread