Invalid date and time

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Invalid date and time Thu May 10, 2018 11:21 am • by Shaniya_Lebsack27
Hello.

I have a little applescript that parses a pdf and make a calendar event with it. It worked fine until High Sierra but no longer works. It does, however, work if I run it from the Script editor. Any ideas?

Thank you

G

## The script

Code: Select all
```
set leTexte to "/Users/amiral/parseur_contrat/calendrier.txt"

set input to read leTexte as "utf8" using delimiter {linefeed}

set dateGo to item 1 of input
set dateGo to date dateGo

set dateStop to item 2 of input
set dateStop to date dateStop

set destination to item 3 of input

set bus to item 4 of input
set contrat to item 5 of input
set guide to item 6 of input
set telephone to item 7 of input
set client to item 8 of input
set pax to item 9 of input

set calendarName to "Travail"
set leSommaire to destination & (" avec " as text) & client


tell application "Calendar"
   set newEvent to make new event at end of events of calendar calendarName with properties {summary:leSommaire, start date:dateGo, end date:dateStop, description:("contrat : " as text) & contrat & "
" & ("bus : " as text) & bus & "
" & ("Guide : " as text) & guide & "
" & ("Téléphone : " as text) & telephone & "
" & ("Pax : " as text) & pax}
   tell newEvent to make new display alarm at end with properties {trigger interval:-1440}
end tell

tell application "Finder"
   delete file "Macintosh HD:Users:amiral:parseur_contrat:calendrier.txt"
end tell
```


## The logs

Code: Select all
2018-05-10 11:00:41.164 HazelHelper[804] DEBUG: Timer scheduled for folder /Users/amiral/.Trash at 2018-05-30 23:18:28 +0000
2018-05-10 11:00:41.165 hazelworker[44099] Done processing folder Trash
2018-05-10 11:00:41.166 HazelHelper[804] DEBUG: Thread 0x600000070f00: Task removed: [44099]
2018-05-10 11:00:41.923 hazelworker[43977] DEBUG: Unexpected type for Mail download URL: (null)
2018-05-10 11:00:41.923 hazelworker[43977] DEBUG: About to process directory /Users/amiral/parseur_contrat
2018-05-10 11:00:41.928 hazelworker[43977] DEBUG: .DS_Store: File is hidden/invisible. Skipping.
2018-05-10 11:00:41.929 hazelworker[43977] calendrier.txt: Rule Ajouter au calendrier matched.
2018-05-10 11:00:41.929 hazelworker[43977] DEBUG: New rule signature. Executing actions.
Old signatures: (
)
New Signature:{displayBasename ==[cd] "calendrier" AND ANY displayExtensions ==[cd] "txt"}:{(applescript:,{
})(move:/Users/amiral/.Trash,{
    replaceExisting = 0;
    throwAwayDupes = 0;
})}
2018-05-10 11:00:42.033 hazelworker[43977] [Error] AppleScript failed: Error executing AppleScript on file /Users/amiral/parseur_contrat/calendrier.txt.
2018-05-10 11:00:42.033 hazelworker[43977] OSAScript error: {
    NSLocalizedDescription = "Invalid date and time date 10 mai 2018 23:00 of \U00abscript\U00bb.";
    NSLocalizedFailureReason = "Invalid date and time date 10 mai 2018 23:00 of \U00abscript\U00bb.";
    OSAScriptErrorAppAddressKey = "<NSAppleEventDescriptor: null()>";
    OSAScriptErrorBriefMessageKey = "Invalid date and time date 10 mai 2018 23:00 of \U00abscript\U00bb.";
    OSAScriptErrorMessageKey = "Invalid date and time date 10 mai 2018 23:00 of \U00abscript\U00bb.";
    OSAScriptErrorNumberKey = "-30720";
    OSAScriptErrorRangeKey = "NSRange: {0, 0}";
}
2018-05-10 11:00:42.033 hazelworker[43977] DEBUG: Tapping error retry sequence
2018-05-10 11:00:42.033 hazelworker[43977] DEBUG: Writing out DB file for /Users/amiral/parseur_contrat to path: /Users/amiral/Library/Application Support/Hazel/16777220-3562618.hazeldb
2018-05-10 11:00:42.034 hazelworker[43977] DEBUG: Directory /Users/amiral/parseur_contrat processed in 0.110736 seconds
2018-05-10 11:00:42.055 HazelHelper[804] DEBUG: Checking events for path /Users/amiral/parseur_contrat, folder parseur_contrat
2018-05-10 11:00:42.056 hazelworker[43977] DEBUG: Received file event: {
    date = "2018-05-10 15:00:40 +0000";
    path = "<ComNoodlesoft_NoodlePathSet: 0x7fb1b3c648c0>\n  /Users/amiral/parseur_contrat/ContratChauffeur_R124492.txt : 0\n";
}
2018-05-10 11:00:42.057 hazelworker[43977] DEBUG: Sleeping
2018-05-10 11:00:46.066 hazelworker[43977] DEBUG: Unexpected type for Mail download URL: (null)
2018-05-10 11:00:46.066 hazelworker[43977] DEBUG: About to process directory /Users/amiral/parseur_contrat
2018-05-10 11:00:46.067 hazelworker[43977] DEBUG: .DS_Store: File is hidden/invisible. Skipping.
2018-05-10 11:00:46.067 hazelworker[43977] DEBUG: Skipped /Users/amiral/parseur_contrat/calendrier.txt. File/folder not part of change set/file event.
2018-05-10 11:00:46.067 hazelworker[43977] DEBUG: Writing out DB file for /Users/amiral/parseur_contrat to path: /Users/amiral/Library/Application Support/Hazel/16777220-3562618.hazeldb
2018-05-10 11:00:46.068 hazelworker[43977] DEBUG: Directory /Users/amiral/parseur_contrat processed in 0.001804 seconds
2018-05-10 11:00:46.068 HazelHelper[804] DEBUG: Checking events for path /Users/amiral/parseur_contrat, folder parseur_contrat
2018-05-10 11:00:46.068 hazelworker[43977] DEBUG: Writing out DB file: /Users/amiral/parseur_contrat
2018-05-10 11:00:46.069 hazelworker[43977] DEBUG: Sending metrics to scheduler. Next scheduled run: 4000-12-31 19:00:00.000
2018-05-10 11:00:46.070 HazelHelper[804] DEBUG: Received metrics for folder /Users/amiral/parseur_contrat: {
    directoryDepth = 0;
    requestedSchedulingTime = "4001-01-01 00:00:00 +0000";
    triggerPaths = "<ComNoodlesoft_NoodlePathSet: 0x604000027cc0>\n";
    unavailablePaths = "{(\n)}";
}
2018-05-10 11:00:46.070 HazelHelper[804] DEBUG: Timer scheduled for folder /Users/amiral/parseur_contrat at 4001-01-01 00:00:00 +0000
2018-05-10 11:00:46.070 hazelworker[43977] Done processing folder parseur_contrat
2018-05-10 11:00:46.075 HazelHelper[804] DEBUG: Thread 0x600000070f00: Task removed: [43977]




OS X Version 10.13.4 (assemblage 17E202)
Hazel Version 4.2.4 (Build 1524)
Shaniya_Lebsack27
 
Posts: 2
Joined: Thu May 10, 2018 11:15 am

Re: Invalid date and time Mon May 14, 2018 10:52 am • by Mr_Noodle
I suggest putting in statements to print/display the values of different variables at different points in the script to debug it. That will also help isolate which line in the script is the one having problems.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Invalid date and time Mon May 14, 2018 3:58 pm • by Shaniya_Lebsack27
I'm not sure what you mean. The debug code is already telling me it's the date format that Hazel doesn't like. Yet, the script works fine when I run it manually.
Shaniya_Lebsack27
 
Posts: 2
Joined: Thu May 10, 2018 11:15 am

Re: Invalid date and time Tue May 15, 2018 10:43 am • by Mr_Noodle
Do you know which line it's referring to? Do you know what the date looks like when it first comes into the script as opposed to later on?
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support