forked from surrealroad/alfred-reminders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.plist
1340 lines (1252 loc) · 48.6 KB
/
info.plist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.surrealroad.alfred-reminder</string>
<key>category</key>
<string>Productivity</string>
<key>connections</key>
<dict>
<key>357C3151-39E1-42FD-8726-BBB740E0976C</key>
<array>
<dict>
<key>destinationuid</key>
<string>A4F33D33-8B88-4725-993E-821A9D0CF057</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>85F2415F-FAB1-457A-8FD6-AD14DEBFBC53</key>
<array>
<dict>
<key>destinationuid</key>
<string>F71B4F2D-63BD-4B35-AA18-C6DDAA5A5CD9</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
<dict>
<key>destinationuid</key>
<string>9A786411-7C10-48D0-AD69-6E1E1DFB8F97</string>
<key>modifiers</key>
<integer>524288</integer>
<key>modifiersubtext</key>
<string>Show in Reminders.app</string>
</dict>
<dict>
<key>destinationuid</key>
<string>FD379784-5C4C-46D9-8D0A-36E768AF1321</string>
<key>modifiers</key>
<integer>262144</integer>
<key>modifiersubtext</key>
<string>Delete this reminder</string>
</dict>
</array>
<key>8A923D62-221E-4666-96C6-82F3B6F92834</key>
<array>
<dict>
<key>destinationuid</key>
<string>F71B4F2D-63BD-4B35-AA18-C6DDAA5A5CD9</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>9A786411-7C10-48D0-AD69-6E1E1DFB8F97</key>
<array>
<dict>
<key>destinationuid</key>
<string>159A291E-3339-491E-8D3F-79091BE0319B</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>A4F33D33-8B88-4725-993E-821A9D0CF057</key>
<array>
<dict>
<key>destinationuid</key>
<string>09C6CC9D-C9FE-4B32-BB4D-8E53F5D41AE8</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
<dict>
<key>destinationuid</key>
<string>94C011FF-2F31-415D-8811-A360D015D705</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>A725F2F1-5A55-476A-9A26-E5B2BB71200E</key>
<array>
<dict>
<key>destinationuid</key>
<string>F71B4F2D-63BD-4B35-AA18-C6DDAA5A5CD9</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
<dict>
<key>destinationuid</key>
<string>9A786411-7C10-48D0-AD69-6E1E1DFB8F97</string>
<key>modifiers</key>
<integer>524288</integer>
<key>modifiersubtext</key>
<string>Show in Reminders.app</string>
</dict>
<dict>
<key>destinationuid</key>
<string>FD379784-5C4C-46D9-8D0A-36E768AF1321</string>
<key>modifiers</key>
<integer>262144</integer>
<key>modifiersubtext</key>
<string>Delete this reminder</string>
</dict>
</array>
<key>F71B4F2D-63BD-4B35-AA18-C6DDAA5A5CD9</key>
<array>
<dict>
<key>destinationuid</key>
<string>159A291E-3339-491E-8D3F-79091BE0319B</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>FD379784-5C4C-46D9-8D0A-36E768AF1321</key>
<array>
<dict>
<key>destinationuid</key>
<string>159A291E-3339-491E-8D3F-79091BE0319B</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Jack James</string>
<key>description</key>
<string>Manages reminders in Reminders.app</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Reminders</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>4</integer>
<key>script</key>
<string>property reminderList : ""
property workflowFolder : do shell script "pwd"
property lib: load script POSIX file (workflowFolder & "/alfred_library.scpt")
property applib: load script POSIX file (workflowFolder & "/reminder_apps.scpt")
property wf: load script POSIX file (workflowFolder & "/q_workflow.scpt")
property bundleid : "com.surrealroad.alfred-reminder"
property cacheFile : "cache.plist"
set wf to wf's new_workflow_with_bundle(bundleid)
set workflowFolder of lib to workflowFolder
my alfred_script("{query}")
on alfred_script(q)
if q is "@@UPDATE@@" then
open location lib's getVersionURL(bundleid)
return
end
lib's setRemindersActive()
return lib's actionReminderQuery(q, false, applib, wf, cacheFile, reminderList)
end alfred_script</string>
<key>type</key>
<integer>6</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>F71B4F2D-63BD-4B35-AA18-C6DDAA5A5CD9</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>lastpathcomponent</key>
<false/>
<key>onlyshowifquerypopulated</key>
<true/>
<key>output</key>
<integer>0</integer>
<key>removeextension</key>
<false/>
<key>sticky</key>
<false/>
<key>text</key>
<string>{query}</string>
<key>title</key>
<string>Reminders</string>
</dict>
<key>type</key>
<string>alfred.workflow.output.notification</string>
<key>uid</key>
<string>159A291E-3339-491E-8D3F-79091BE0319B</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>4</integer>
<key>keyword</key>
<string>r</string>
<key>queuedelaycustom</key>
<integer>1</integer>
<key>queuedelayimmediatelyinitially</key>
<false/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>Processing request…</string>
<key>script</key>
<string>property cacheExpires : 2 * hours
property shouldCheckForUpdates : true
property checkFrequency : 4 * days
property showReminders : true
property currentVersion : 60
property workflowFolder : do shell script "pwd"
property lib : load script POSIX file (workflowFolder & "/alfred_library.scpt")
property wf : load script POSIX file (workflowFolder & "/q_workflow.scpt")
property update : load script POSIX file (workflowFolder & "/cache-update.scpt")
property wfname : "Reminders"
property bundleid : "com.surrealroad.alfred-reminder"
property uid : "add-reminder"
property addActionTitle : "Add Reminder"
property cacheFile : "cache.plist"
set wf to wf's new_workflow_with_bundle(bundleid)
set workflowFolder of lib to workflowFolder
my alfred_script("{query}")
on alfred_script(q)
set osver to system version of (system info)
-- if (osver does not start with "10.6" and osver does not start with "10.7" and osver does not start with "10.8") then set showReminders to false
if q is "help" then return lib's alfred_result_items({lib's reminderHelp()})
if q is "" and showReminders then set q to "all"
-- set create reminder action
set theText to ""
set theDate to ""
set thePriority to ""
set theList to ""
set theApplication to ""
set theIcon to ""
set valid to "no"
lib's setRemindersActive()
try
set reminder to lib's parseReminder(q)
set theText to theText of reminder
set theDate to theDate of reminder
set thePriority to thePriority of reminder
set valid to valid of reminder
set theList to theList of reminder
set theApplication to theApplication of reminder
set theIcon to theIcon of reminder
end try
set subtitle to lib's formatReminderSubtitle(theText, theDate, theList, theApplication, thePriority)
set addAction to ""
if ((theText is not "" and theText is not "all" and theText is not "refresh" and theText is not "overdue") or theApplication is not "") then
set addAction to lib's alfred_result_item_with_icon(uid, addActionTitle, subtitle, q, valid, theIcon)
end if
if theApplication is "" and showReminders then
if q is "refresh" then lib's spawnReminderCache(workflowFolder & "/cache-reminders.scpt", false, "")
--fetch existing reminders
set reminderList to {}
set existingReminders to lib's fetchReminderList(wf, cacheFile, cacheExpires)
set filteredReminders to lib's filterReminders(existingReminders, theText, theDate, theList)
else
set filteredReminders to {}
end if
--version check
set versionAction to ""
if shouldCheckForUpdates then
set cacheFile of update to cacheFile
set workflowFolder of update to (workflowFolder as string)
try
set versionAction to lib's alfred_version_notify(wfname, bundleid, currentVersion, wf, cacheFile, checkFrequency)
end try
end if
if ((addAction is "") and (filteredReminders is {})) then
return lib's alfred_result_items({lib's alfred_result_item_with_icon("reminder-invalid", "Reminder command not recognised or no matching reminders found", "Type r help for some examples", "", "no", theIcon)})
end if
return lib's alfred_result_items({versionAction, addAction, filteredReminders})
end alfred_script</string>
<key>subtext</key>
<string>Adds an entry to Reminders.app</string>
<key>title</key>
<string>Add Reminder</string>
<key>type</key>
<integer>6</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>A725F2F1-5A55-476A-9A26-E5B2BB71200E</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>4</integer>
<key>script</key>
<string>property reminderList : ""
property workflowFolder : do shell script "pwd"
property lib: load script POSIX file (workflowFolder & "/alfred_library.scpt")
property applib: load script POSIX file (workflowFolder & "/reminder_apps.scpt")
property wf: load script POSIX file (workflowFolder & "/q_workflow.scpt")
property bundleid : "com.surrealroad.alfred-reminder"
property cacheFile : "cache.plist"
set wf to wf's new_workflow_with_bundle(bundleid)
my alfred_script("{query}")
on alfred_script(q)
return lib's actionReminderQuery(q, true, applib, wf, cacheFile, reminderList)
end alfred_script</string>
<key>type</key>
<integer>6</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>9A786411-7C10-48D0-AD69-6E1E1DFB8F97</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>4</integer>
<key>keyword</key>
<string>radd</string>
<key>queuedelaycustom</key>
<integer>1</integer>
<key>queuedelayimmediatelyinitially</key>
<false/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>Processing request…</string>
<key>script</key>
<string>property cacheExpires : 2 * hours
property workflowFolder : do shell script "pwd"
property lib : load script POSIX file (workflowFolder & "/alfred_library.scpt")
property wf : load script POSIX file (workflowFolder & "/q_workflow.scpt")
property wfname : "Reminders"
property bundleid : "com.surrealroad.alfred-reminder"
property uid : "add-reminder"
property addActionTitle : "Add Reminder"
property cacheFile : "cache.plist"
set wf to wf's new_workflow_with_bundle(bundleid)
set workflowFolder of lib to workflowFolder
my alfred_script("{query}")
on alfred_script(q)
-- set create reminder action
set theText to ""
set theDate to ""
set thePriority to ""
set theList to ""
set theApplication to ""
set theIcon to ""
set valid to "no"
lib's setRemindersActive()
try
set reminder to lib's parseReminder(q)
set theText to theText of reminder
set theDate to theDate of reminder
set thePriority to thePriority of reminder
set valid to valid of reminder
set theList to theList of reminder
set theApplication to theApplication of reminder
set theIcon to theIcon of reminder
end try
set subtitle to lib's formatReminderSubtitle(theText, theDate, theList, theApplication, thePriority)
set addAction to ""
if ((theText is not "" and theText is not "all" and theText is not "refresh" and theText is not "overdue") or theApplication is not "") then
set addAction to lib's alfred_result_item_with_icon(uid, addActionTitle, subtitle, q, valid, theIcon)
end if
if addAction is "" then
return lib's alfred_result_items({lib's alfred_result_item_with_icon("reminder-invalid", "Add reminder command not recognised", "Type r help for some examples", "", "no", theIcon)})
end if
return lib's alfred_result_items({addAction})
end alfred_script</string>
<key>subtext</key>
<string>Adds an entry to Reminders.app</string>
<key>title</key>
<string>Add Reminder</string>
<key>type</key>
<integer>6</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>8A923D62-221E-4666-96C6-82F3B6F92834</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>4</integer>
<key>keyword</key>
<string>rshow</string>
<key>queuedelaycustom</key>
<integer>1</integer>
<key>queuedelayimmediatelyinitially</key>
<false/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>Fetching reminders…</string>
<key>script</key>
<string>property cacheExpires : 2 * hours
property workflowFolder : do shell script "pwd"
property lib : load script POSIX file (workflowFolder & "/alfred_library.scpt")
property wf : load script POSIX file (workflowFolder & "/q_workflow.scpt")
property wfname : "Reminders"
property bundleid : "com.surrealroad.alfred-reminder"
property cacheFile : "cache.plist"
property showReminders : true
set wf to wf's new_workflow_with_bundle(bundleid)
set workflowFolder of lib to workflowFolder
set osver to system version of (system info)
-- if (osver does not start with "10.6" and osver does not start with "10.7" and osver does not start with "10.8") then set showReminders to false
if showReminders then my alfred_script("{query}")
on alfred_script(q)
set theText to ""
set theDate to ""
set theList to ""
set theApplication to ""
set theIcon to ""
set valid to "no"
lib's setRemindersActive()
try
set reminder to lib's parseReminder(q)
set theText to theText of reminder
set theDate to theDate of reminder
set valid to valid of reminder
set theList to theList of reminder
set theIcon to theIcon of reminder
end try
--fetch existing reminders
set reminderList to {}
set existingReminders to lib's fetchReminderList(wf, cacheFile, cacheExpires)
set filteredReminders to lib's filterReminders(existingReminders, theText, theDate, theList)
if filteredReminders is {} then
return lib's alfred_result_items({lib's alfred_result_item_with_icon("reminder-invalid", "No matching reminders found", "Please try a different query", "", "no", theIcon)})
end if
return lib's alfred_result_items({filteredReminders})
end alfred_script</string>
<key>subtext</key>
<string>Show current reminders</string>
<key>title</key>
<string>Show Reminders</string>
<key>type</key>
<integer>6</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>85F2415F-FAB1-457A-8FD6-AD14DEBFBC53</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>4</integer>
<key>script</key>
<string>property reminderList : ""
property workflowFolder : do shell script "pwd"
property lib: load script POSIX file (workflowFolder & "/alfred_library.scpt")
property applib: load script POSIX file (workflowFolder & "/reminder_apps.scpt")
property wf: load script POSIX file (workflowFolder & "/q_workflow.scpt")
property bundleid : "com.surrealroad.alfred-reminder"
property cacheFile : "cache.plist"
set wf to wf's new_workflow_with_bundle(bundleid)
my alfred_script("{query}")
on alfred_script(q)
return lib's actionReminderQuery("##DEL##" & q, false, applib, wf, cacheFile, reminderList)
end alfred_script</string>
<key>type</key>
<integer>6</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>FD379784-5C4C-46D9-8D0A-36E768AF1321</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>lastpathcomponent</key>
<false/>
<key>onlyshowifquerypopulated</key>
<false/>
<key>output</key>
<integer>0</integer>
<key>removeextension</key>
<false/>
<key>sticky</key>
<false/>
<key>text</key>
<string>Results have been copied to the clipboard</string>
<key>title</key>
<string>Test complete</string>
</dict>
<key>type</key>
<string>alfred.workflow.output.notification</string>
<key>uid</key>
<string>09C6CC9D-C9FE-4B32-BB4D-8E53F5D41AE8</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>4</integer>
<key>script</key>
<string>property cacheExpires : 2 * hours
property workflowFolder : missing value
property lib : missing value
property wf : missing value
property update : missing value
property cacheFile : "cache.plist"
property bundleid : "com.surrealroad.alfred-reminder"
property wfname : "Reminders"
set theResult to ""
set startTime to (current date)
-- OS version
set theResult to theResult & "OS version: "
set testStart to (current date)
try
set os_version to do shell script "sw_vers -productVersion"
set theResult to theResult & os_version
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
-- timestamp
set theResult to theResult & "Current date: "
set testStart to (current date)
try
set theResult to theResult & (current date)
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
-- initialise libraries
set theResult to theResult & "Initialize workflow path: "
set testStart to (current date)
try
set workflowFolder to do shell script "pwd"
set theResult to theResult & workflowFolder
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Initialize alfred-library: "
set testStart to (current date)
try
set lib to load script POSIX file (workflowFolder & "/alfred_library.scpt")
if lib is not missing value then
set workflowFolder of lib to workflowFolder
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Initialize update-library: "
set testStart to (current date)
try
set update to load script POSIX file (workflowFolder & "/cache-update.scpt")
if update is not missing value then
set cacheFile of update to cacheFile
set workflowFolder of update to workflowFolder
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Initialize wf-library: "
set testStart to (current date)
try
set wf to load script POSIX file (workflowFolder & "/q_workflow.scpt")
set wf to wf's new_workflow_with_bundle(bundleid)
if wf is not missing value then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Initialize plist-library: "
set testStart to (current date)
try
set _plist to load script POSIX file (workflowFolder & "/_plist.scpt")
if _plist is not missing value then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
-- test determining reminders state
set theResult to theResult & "Reminders.app state: "
set testStart to (current date)
try
tell application "System Events"
set remindersIsRunning to (bundle identifier of processes) contains "com.apple.reminders"
end tell
if remindersIsRunning then
set theResult to theResult & "Running"
else
set theResult to theResult & "Not running"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
-- test reading data from reminders
set theResult to theResult & "Fetch reminder count: "
set testStart to (current date)
try
tell application id "com.apple.reminders"
set reminderList to reminders whose (completed is false)
end tell
set theResult to theResult & (count of reminderList)
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Fetch reminder info: "
set testStart to (current date)
try
set reminderText to missing value
tell application id "com.apple.reminders"
set reminderText to name of first reminder whose (completed is false)
end tell
if reminderText is not missing value then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Fetch reminder list count: "
set testStart to (current date)
try
tell application id "com.apple.reminders"
set reminderListList to lists
end tell
set theResult to theResult & (count of reminderListList)
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Fetch reminder list info: "
set testStart to (current date)
try
set reminderList to missing value
tell application id "com.apple.reminders"
set reminderList to name of first list
end tell
if reminderList is not missing value then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
-- test fetching cached variables
set theResult to theResult & "Run cache process: "
set osver to system version of (system info)
--if (osver does not start with "10.6" and osver does not start with "10.7" and osver does not start with "10.8") then
-- set cache to false
--else
set cache to true
--end if
set testStart to (current date)
if cache then
try
set cacheResult to do shell script "osascript " & quoted form of workflowFolder & "/cache-reminders.scpt"
if cacheResult is "" then
set theResult to theResult & "OK"
else
set theResult to theResult & cacheResult
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
else
set theResult to theResult & "SKIPPED"
end if
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Fetch cache timestamp: "
set testStart to (current date)
if cache then
try
set theResult to theResult & wf's get_value("timestamp", cacheFile)
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
else
set theResult to theResult & "SKIPPED"
end if
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Fetch cached reminder count: "
set testStart to (current date)
if cache then
try
set cachedReminderList to lib's getCachedReminderList(wf, cacheFile)
set theResult to theResult & (count of cachedReminderList)
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
else
set theResult to theResult & "SKIPPED"
end if
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
-- test parseReminder suite
set theResult to theResult & "Test basic query: "
set testStart to (current date)
try
set q to "something"
set qResult to lib's parseReminder(q)
if (theText of qResult) is equal to q then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test today query: "
set testStart to (current date)
try
set q to "today"
set qResult to lib's parseReminder(q)
if date string of (theDate of qResult) is equal to date string of (current date) then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test in n minutes query: "
set testStart to (current date)
try
set q to "in 5 minutes something"
set qResult to lib's parseReminder(q)
if (theDate of qResult) is equal to ((current date) + 5 * minutes) then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test in n hours query: "
set testStart to (current date)
try
set q to "in 5 hours something"
set qResult to lib's parseReminder(q)
if (theDate of qResult) is equal to ((current date) + 5 * hours) then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test in n days query: "
set testStart to (current date)
try
set q to "in 5 days something"
set qResult to lib's parseReminder(q)
if (theDate of qResult) is equal to ((current date) + 5 * days) then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test in n days y hours query: "
set testStart to (current date)
try
set q to "in 5 days 1 hour something"
set qResult to lib's parseReminder(q)
if (theDate of qResult) is equal to ((current date) + (5 * days) + hours) then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test in n hours y minutes query: "
set testStart to (current date)
try
set q to "in 5 hours 6 minutes something"
set qResult to lib's parseReminder(q)
if (theDate of qResult) is equal to ((current date) + (5 * hours) + (6 * minutes)) then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test at time query: "
set testStart to (current date)
try
set q to "at 2pm to something"
set qResult to lib's parseReminder(q)
set theTime to (current date)
set theTime's time to 14 * hours
if (time of (theDate of qResult)) is equal to (time of (theTime)) then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test tomorrow at time query: "
set testStart to (current date)
try
set q to "tomorrow at 11am to something"
set qResult to lib's parseReminder(q)
set theTime to (current date)
set theTime's time to 11 * hours
if date string of (theDate of qResult) is equal to date string of ((current date) + 24 * hours) ¬
and (time of (theDate of qResult)) is equal to (time of (theTime)) then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
set theResult to theResult & "Test in x list query: "
set testStart to (current date)
try
set q to "in something in test result list"
set qResult to lib's parseReminder(q)
if (theList of qResult) is equal to "test result" then
set theResult to theResult & "OK"
else
set theResult to theResult & "Fail"
end if
on error errMsg
set theResult to theResult & "ERROR: " & errMsg
end try
set theResult to theResult & " (" & ((current date) - testStart) & " seconds)" & return
-- test subtitle generation
set theResult to theResult & "Subtitle generation: "
set testStart to (current date)
try
set theText to "test"
set theDate to current date
set theList to "test list"
set theApplication to ""
set thePriority to "9"
set expectedResult to "Create a new reminder to test on " & (theDate as string) & " in " & quoted form of theList & " (low priority)"
set qResult to lib's formatReminderSubtitle(theText, theDate, theList, theApplication, thePriority)
if qResult is equal to expectedResult then
set theResult to theResult & "OK"
else