-
Notifications
You must be signed in to change notification settings - Fork 48
/
416.srt
3673 lines (2708 loc) · 81.9 KB
/
416.srt
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
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:00:01.516 --> 00:00:09.566 A:middle
[ Silence ]
00:00:10.066 --> 00:00:14.036 A:middle
>> Hello, welcome to the World
Wide Developer Conference,
00:00:14.036 --> 00:00:17.926 A:middle
this is the second automation
session today, how many went
00:00:17.926 --> 00:00:19.896 A:middle
to first session
this morning...okay.
00:00:20.686 --> 00:00:25.996 A:middle
So our little presentation
about Libraries kind of got
00:00:26.046 --> 00:00:29.906 A:middle
to you a little bit huh,
you're interested in this.
00:00:30.166 --> 00:00:37.626 A:middle
This session we go in depth in
discussing AppleScript Libraries
00:00:37.846 --> 00:00:42.626 A:middle
and we'll examine not only
simple but complex ones
00:00:42.626 --> 00:00:44.366 A:middle
and we'll walk you
through the process
00:00:44.366 --> 00:00:46.876 A:middle
of how you create
those including
00:00:46.876 --> 00:00:50.336 A:middle
for the first time ever
anywhere an example of how
00:00:50.336 --> 00:00:52.196 A:middle
to create a scripting
dictionary.
00:00:52.466 --> 00:00:55.566 A:middle
I think once you
see how it's done,
00:00:55.566 --> 00:00:58.006 A:middle
it's not so frightening
it's pretty easy
00:00:58.006 --> 00:01:00.226 A:middle
to do it's just an XML file.
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:00:58.006 --> 00:01:00.226 A:middle
to do it's just an XML file.
00:01:00.876 --> 00:01:02.826 A:middle
So today we're going
to be talking
00:01:02.826 --> 00:01:07.036 A:middle
about AppleScript Libraries
and what they can do for you.
00:01:07.966 --> 00:01:12.226 A:middle
Let's try click, welcome, today
it's AppleScript Libraries,
00:01:12.226 --> 00:01:16.626 A:middle
we covered that and we're
going to be learning
00:01:16.626 --> 00:01:20.716 A:middle
about what they are,
how you incorporate them
00:01:20.716 --> 00:01:23.896 A:middle
into your environment, how
you call them, how use them,
00:01:24.176 --> 00:01:28.406 A:middle
how you create them and
how you can deploy them.
00:01:28.606 --> 00:01:32.166 A:middle
So begin with, why
Libraries...those who were
00:01:32.166 --> 00:01:37.426 A:middle
at the first session understand
that I'm one of those kind
00:01:37.426 --> 00:01:44.046 A:middle
of people that is a code
maven, I have sampled routines
00:01:44.046 --> 00:01:47.266 A:middle
that do just about
everything and I have them all
00:01:47.266 --> 00:01:51.706 A:middle
over the place on my drives
and I'm very thankful now
00:01:51.706 --> 00:01:53.846 A:middle
that we have iCloud
support so I can keep them
00:01:53.846 --> 00:01:58.206 A:middle
in one central location
but I like to use routines
00:01:58.206 --> 00:02:02.926 A:middle
and handlers in my scripts quite
a bit instead of writing code
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:01:58.206 --> 00:02:02.926 A:middle
and handlers in my scripts quite
a bit instead of writing code
00:02:02.926 --> 00:02:05.206 A:middle
over and over, I like
just getting the routines
00:02:05.206 --> 00:02:07.606 A:middle
and handlers and pasting
them into my scripts.
00:02:07.606 --> 00:02:10.656 A:middle
So if you're like me and you
use the same routine over
00:02:10.656 --> 00:02:13.296 A:middle
and over you're going
to like Libraries,
00:02:13.416 --> 00:02:14.886 A:middle
they're going to
be useful for you.
00:02:15.716 --> 00:02:18.686 A:middle
Again if you are a person
00:02:18.686 --> 00:02:23.326 A:middle
that uses third party scripting
additions to find that command
00:02:23.326 --> 00:02:26.526 A:middle
that was missing in
AppleScript you're going
00:02:26.526 --> 00:02:28.426 A:middle
to like Libraries as well.
00:02:29.956 --> 00:02:34.116 A:middle
If you just want to be someone
that can simplify your scripts
00:02:34.116 --> 00:02:36.816 A:middle
if you want to take all
this complexity and routines
00:02:36.816 --> 00:02:41.096 A:middle
and handlers out of your scripts
and just have an easier way
00:02:41.246 --> 00:02:43.796 A:middle
to manage them and to be able
00:02:43.796 --> 00:02:46.386 A:middle
to call them globally throughout
your scripts you're going
00:02:46.386 --> 00:02:47.516 A:middle
to like Libraries.
00:02:47.816 --> 00:02:50.656 A:middle
It all started because you
know once I learned how
00:02:50.656 --> 00:02:54.556 A:middle
to create a subroutine or
handler I started using them
00:02:54.556 --> 00:02:57.816 A:middle
and I would put them in my
scripts and it worked very well
00:02:58.176 --> 00:03:01.056 A:middle
and then I would create
another one and then I would put
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:02:58.176 --> 00:03:01.056 A:middle
and then I would create
another one and then I would put
00:03:01.056 --> 00:03:04.866 A:middle
in in some of my scripts and
not in some of the other ones
00:03:04.866 --> 00:03:07.406 A:middle
and I would update one but
I didn't update the other
00:03:07.406 --> 00:03:08.776 A:middle
and then I added more routines
00:03:08.776 --> 00:03:10.676 A:middle
and then the next
thing you know it gets
00:03:10.676 --> 00:03:14.586 A:middle
to be this real big jumble
that you try to manage.
00:03:14.586 --> 00:03:18.416 A:middle
Well we're solving that
issue and those problems now
00:03:19.136 --> 00:03:21.706 A:middle
in Mavericks with
the introduction
00:03:21.706 --> 00:03:23.386 A:middle
of AppleScript Libraries.
00:03:24.516 --> 00:03:27.756 A:middle
They are a new plug in
architecture for AppleScript
00:03:28.216 --> 00:03:33.566 A:middle
that allows you to create
powerful collections of handlers
00:03:34.236 --> 00:03:39.296 A:middle
and tools yourself and deploy
them across your machinery.
00:03:40.226 --> 00:03:44.636 A:middle
In addition, they differ from
the standard scripting addition
00:03:44.846 --> 00:03:48.606 A:middle
that we're used to using all
the time in a couple ways.
00:03:48.606 --> 00:03:51.616 A:middle
First of all they can be written
in AppleScript, you don't have
00:03:51.646 --> 00:03:58.016 A:middle
to know C or C ++ in order to
create an AppleScript Library.
00:03:58.296 --> 00:04:01.756 A:middle
Because Libraries are
loaded by the script,
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:03:58.296 --> 00:04:01.756 A:middle
Because Libraries are
loaded by the script,
00:04:02.106 --> 00:04:04.466 A:middle
the script is controlling
how they use
00:04:04.946 --> 00:04:08.886 A:middle
and that will help you
avoid terminology conflicts
00:04:08.886 --> 00:04:12.506 A:middle
or resource problems, all
of that kind of goes away
00:04:12.796 --> 00:04:17.005 A:middle
because the script is
loading the Library
00:04:17.005 --> 00:04:19.886 A:middle
and the Libraries
live within the space
00:04:19.886 --> 00:04:22.396 A:middle
of the application that's
executing the script.
00:04:23.616 --> 00:04:27.446 A:middle
Now AppleScript Libraries have
some extra abilities to help you
00:04:27.446 --> 00:04:29.936 A:middle
out and the first one
that's really important is
00:04:30.286 --> 00:04:33.476 A:middle
that they can take advantage
of AppleScript objective C.
00:04:34.146 --> 00:04:41.146 A:middle
AppleScript objective C exposes
the Cocoa classes to AppleScript
00:04:41.146 --> 00:04:45.176 A:middle
so things like NS String
become available to you
00:04:45.176 --> 00:04:48.886 A:middle
and all the methods from
that and the instants methods
00:04:48.886 --> 00:04:51.516 A:middle
from that now become
available for you to use
00:04:51.516 --> 00:04:55.356 A:middle
in your AppleScripts scripts
and your AppleScript Libraries.
00:04:56.246 --> 00:05:00.886 A:middle
In addition you can also have
your libraries publish their own
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:04:56.246 --> 00:05:00.886 A:middle
In addition you can also have
your libraries publish their own
00:05:00.886 --> 00:05:05.126 A:middle
terminology which means
instead of you having
00:05:05.126 --> 00:05:09.906 A:middle
to remember a specific handler
name and a specific order
00:05:10.606 --> 00:05:13.186 A:middle
of indicators or
data pass throughs
00:05:13.186 --> 00:05:16.266 A:middle
or whatever you can actually
use English like terms
00:05:16.266 --> 00:05:20.546 A:middle
that you create that work for
you and have those be the way
00:05:20.546 --> 00:05:23.856 A:middle
that you call the
AppleScript Library
00:05:23.856 --> 00:05:26.026 A:middle
so the handlers within
the Library.
00:05:26.156 --> 00:05:28.616 A:middle
So it's very powerful
and in support
00:05:28.616 --> 00:05:31.036 A:middle
of that we've created a
couple new constructs,
00:05:31.036 --> 00:05:37.006 A:middle
the first is a Script Library
reference, a way to easily refer
00:05:37.006 --> 00:05:40.446 A:middle
to a Script Library that you
have installed on your computer.
00:05:41.046 --> 00:05:44.146 A:middle
You'll see how that differs
from the old load Script
00:05:44.146 --> 00:05:48.536 A:middle
that we all used to use
as a substitute for this.
00:05:49.156 --> 00:05:52.786 A:middle
Then finally we've
created a new construct
00:05:52.786 --> 00:05:56.326 A:middle
that is called the use
clause and it's a way
00:05:56.326 --> 00:06:01.106 A:middle
to import terminology and
to bring in dictionaries
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:05:56.326 --> 00:06:01.106 A:middle
to import terminology and
to bring in dictionaries
00:06:01.186 --> 00:06:03.266 A:middle
and libraries into your script
00:06:03.266 --> 00:06:06.586 A:middle
and have them be available
globally throughout.
00:06:07.706 --> 00:06:09.076 A:middle
So let's take a look at this,
00:06:09.666 --> 00:06:15.066 A:middle
now in the old days before
this many of us have tried
00:06:15.066 --> 00:06:20.536 A:middle
to use the old script storing
techniques that we had available
00:06:20.536 --> 00:06:24.176 A:middle
through the scripting
addition of load script.
00:06:24.716 --> 00:06:29.026 A:middle
Now if you go to your library
pallet in the AppleScript editor
00:06:29.026 --> 00:06:31.246 A:middle
and you select standard
editions and you open
00:06:31.246 --> 00:06:34.936 A:middle
up the dictionary window for the
standard editions you have nine
00:06:34.936 --> 00:06:39.286 A:middle
suites in the dictionary and
one of those suites deals
00:06:39.286 --> 00:06:43.736 A:middle
with scripting commands and one
of those commands is load script
00:06:44.316 --> 00:06:47.996 A:middle
and here is the definition
for that, let's zoom that in.
00:06:48.726 --> 00:06:54.116 A:middle
Now this command was designed
for you to be able to point
00:06:54.116 --> 00:06:59.386 A:middle
at a specific script file,
load its contents into memory
00:06:59.386 --> 00:07:03.006 A:middle
and then talk to that
script file in memory
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:06:59.386 --> 00:07:03.006 A:middle
and then talk to that
script file in memory
00:07:03.006 --> 00:07:04.486 A:middle
and have it do things for you.
00:07:05.006 --> 00:07:09.496 A:middle
But there are a couple
issues with using this
00:07:09.496 --> 00:07:11.456 A:middle
and here's an example script
00:07:11.456 --> 00:07:14.826 A:middle
that uses the load
script scripting edition.
00:07:15.436 --> 00:07:18.636 A:middle
You can see that the first
thing is you have to know
00:07:18.636 --> 00:07:23.816 A:middle
where the script that you are
using as a library exists,
00:07:23.816 --> 00:07:27.186 A:middle
where is it, you have to
have its exact location
00:07:27.606 --> 00:07:29.696 A:middle
and then once you've identified
00:07:29.696 --> 00:07:33.676 A:middle
where it is then you perform
this load script and store it
00:07:33.676 --> 00:07:38.836 A:middle
into a variable that represents
the contents of that script.
00:07:39.696 --> 00:07:42.656 A:middle
Then elsewhere in your
script you talk to that
00:07:42.656 --> 00:07:46.776 A:middle
and you call its handlers or
whatever handlers are available
00:07:46.776 --> 00:07:51.526 A:middle
within it and have it work but
this is a problem because first
00:07:51.526 --> 00:07:54.726 A:middle
of all it requires that you know
exactly where it is and if it's
00:07:54.726 --> 00:07:57.366 A:middle
on a different machine then
you have to develop way
00:07:57.846 --> 00:08:00.156 A:middle
to locate folders locally,
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:07:57.846 --> 00:08:00.156 A:middle
to locate folders locally,
00:08:00.446 --> 00:08:03.186 A:middle
regardless of how drives
are named and you have
00:08:03.246 --> 00:08:06.526 A:middle
to have error handlers to
make sure that they're there
00:08:06.526 --> 00:08:07.666 A:middle
and those kind of things
00:08:08.376 --> 00:08:14.066 A:middle
and then it requires explicit
loading, explicit loading,
00:08:14.466 --> 00:08:19.556 A:middle
explicit loading of the targeted
script file, you have to do that
00:08:20.636 --> 00:08:25.426 A:middle
and it also requires that
you address the handlers
00:08:25.426 --> 00:08:29.376 A:middle
from within the loaded
script file directly and pass
00:08:29.376 --> 00:08:30.766 A:middle
through information to them.
00:08:31.286 --> 00:08:34.025 A:middle
This means that there's
no custom terminology,
00:08:34.265 --> 00:08:36.506 A:middle
you have to remember
handler names,
00:08:36.756 --> 00:08:40.256 A:middle
you have to remember the order
of the various components
00:08:40.306 --> 00:08:44.536 A:middle
of the handler and there's
no access to the power
00:08:44.856 --> 00:08:48.706 A:middle
of AppleScript objective C and
the wonderful Cocoa Libraries
00:08:48.706 --> 00:08:50.836 A:middle
that are available
too on the computer.
00:08:51.456 --> 00:08:53.006 A:middle
So there are some issues
00:08:53.006 --> 00:08:55.466 A:middle
with using the load
script scripting edition
00:08:55.936 --> 00:08:58.036 A:middle
and we've addressed
a lot of those
00:08:58.036 --> 00:09:01.936 A:middle
with our AppleScript Libraries
so let's take a look at it.
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:08:58.036 --> 00:09:01.936 A:middle
with our AppleScript Libraries
so let's take a look at it.
00:09:02.686 --> 00:09:04.826 A:middle
We're going to start
very simply;
00:09:04.826 --> 00:09:09.126 A:middle
I always like starting
exploring a new concept
00:09:09.456 --> 00:09:11.116 A:middle
in the most fundamental ways.
00:09:11.116 --> 00:09:14.176 A:middle
So we're going to look at
simple AppleScript Libraries,
00:09:14.406 --> 00:09:17.766 A:middle
you might never write
something this simple yourself
00:09:17.866 --> 00:09:20.046 A:middle
but by examining
this we're going
00:09:20.046 --> 00:09:22.906 A:middle
to learn the principles behind
this whole architecture,
00:09:23.006 --> 00:09:25.376 A:middle
is that okay, we'll
start simple...good.
00:09:25.736 --> 00:09:29.006 A:middle
Specifically we're going
to look at a problem
00:09:29.006 --> 00:09:30.306 A:middle
that exists all the time
00:09:30.636 --> 00:09:35.066 A:middle
of solving the missing command
problem, I want to be able
00:09:35.066 --> 00:09:38.836 A:middle
to do something but there's no
AppleScript command for that.
00:09:39.316 --> 00:09:42.836 A:middle
So by examining this little
issue we're going to learn how
00:09:42.836 --> 00:09:45.776 A:middle
to create and use
AppleScript Libraries.
00:09:46.776 --> 00:09:52.146 A:middle
Now for our example of a missing
command here is the new notes
00:09:52.146 --> 00:09:56.076 A:middle
application in Mavericks,
I'm going to select some text
00:09:56.076 --> 00:09:59.156 A:middle
in there and then right click
the selection so it brings
00:09:59.156 --> 00:10:00.976 A:middle
up the contextual menu.
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:09:59.156 --> 00:10:00.976 A:middle
up the contextual menu.
00:10:01.836 --> 00:10:03.646 A:middle
Now some of you might know
00:10:03.646 --> 00:10:08.346 A:middle
that for a couple system
releases now we implemented some
00:10:08.346 --> 00:10:12.216 A:middle
new text handling options
00:10:12.366 --> 00:10:16.536 A:middle
within the standard text
contextual menu and one
00:10:16.536 --> 00:10:20.816 A:middle
of them is transformations
where you have the option
00:10:20.816 --> 00:10:26.106 A:middle
to change the case of selected
text to upper case, lower case,
00:10:26.356 --> 00:10:30.606 A:middle
capitalize or that's
called word case sometimes
00:10:30.606 --> 00:10:32.636 A:middle
and you might find it
called that as well.
00:10:33.006 --> 00:10:37.386 A:middle
But this is a command that's
available on the contextual menu
00:10:38.006 --> 00:10:42.396 A:middle
but it's not available from
within AppleScript itself.
00:10:43.006 --> 00:10:46.646 A:middle
So what I want to do is
use this as an example
00:10:46.646 --> 00:10:52.016 A:middle
when we're creating our
simple library to begin with
00:10:52.766 --> 00:10:56.366 A:middle
and we're going to look
at being able to convert
00:10:56.366 --> 00:11:00.196 A:middle
to upper case transformation, so
we'll have something like how,
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:10:56.366 --> 00:11:00.196 A:middle
to upper case transformation, so
we'll have something like how,
00:11:00.196 --> 00:11:05.946 A:middle
now brown cow in lower case
transforms to how now brown cow
00:11:05.946 --> 00:11:10.206 A:middle
in upper case, we're going to
have a lower case transformation
00:11:10.506 --> 00:11:13.256 A:middle
and instead of capitalization
I'm just going
00:11:13.256 --> 00:11:15.276 A:middle
to call it a word
case transformation
00:11:15.486 --> 00:11:18.636 A:middle
where the first letter of
each word is capitalized
00:11:19.086 --> 00:11:21.956 A:middle
and this is what we're going
to use as our sample command.
00:11:22.026 --> 00:11:25.686 A:middle
We're going to look
at this in two types
00:11:25.776 --> 00:11:27.466 A:middle
of simple script libraries,
00:11:27.776 --> 00:11:32.276 A:middle
one where the library is written
entirely in native AppleScript
00:11:32.926 --> 00:11:36.736 A:middle
and two, where the library
is written using AppleScript
00:11:36.736 --> 00:11:37.736 A:middle
objective C.
00:11:38.506 --> 00:11:41.236 A:middle
So just to review
here we're going
00:11:41.236 --> 00:11:45.196 A:middle
to take this missing command of
transformed text and we're going
00:11:45.196 --> 00:11:47.506 A:middle
to use that and create
two simple libraries
00:11:47.506 --> 00:11:50.866 A:middle
to address the fact that's
it's not native in AppleScript.
00:11:50.866 --> 00:11:52.486 A:middle
We're going to create
one in AppleScript,
00:11:52.486 --> 00:11:55.606 A:middle
one in AppleScript
objective C, let's begin.
00:11:56.386 --> 00:12:01.576 A:middle
An AppleScript script
library, so it beings
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:11:56.386 --> 00:12:01.576 A:middle
An AppleScript script
library, so it beings
00:12:01.576 --> 00:12:04.986 A:middle
with having a handler some
kind of AppleScript handler
00:12:04.986 --> 00:12:07.896 A:middle
and here I have one,
you'll notice that the name
00:12:07.896 --> 00:12:11.426 A:middle
of the handler is
change case of text,
00:12:11.476 --> 00:12:13.696 A:middle
we'll use this handler
throughout here
00:12:13.936 --> 00:12:19.046 A:middle
and it has two parameters,
one is the source text
00:12:19.046 --> 00:12:22.516 A:middle
or the what you want
to transform,
00:12:22.516 --> 00:12:24.226 A:middle
the text that you
want to transform
00:12:24.606 --> 00:12:28.106 A:middle
and the second is a case
indicator and this case
00:12:28.276 --> 00:12:32.306 A:middle
of this handler it's going
to a numeric value zero
00:12:32.306 --> 00:12:36.846 A:middle
or 1 that indicates whether
you want upper or lower case.
00:12:37.486 --> 00:12:41.736 A:middle
It's a simple AppleScript
based upon your case indicator,
00:12:41.736 --> 00:12:45.176 A:middle
it creates two comparison
lists and then iterate
00:12:45.176 --> 00:12:48.226 A:middle
through all the characters
in the past text
00:12:48.226 --> 00:12:51.276 A:middle
and matches whether
it's an iteration list
00:12:51.276 --> 00:12:55.106 A:middle
and then finally returns
the resulting string back
00:12:55.106 --> 00:12:56.966 A:middle
to the script itself.
00:12:57.536 --> 00:13:00.686 A:middle
Something simple right, now
we're going to take this
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:12:57.536 --> 00:13:00.686 A:middle
Something simple right, now
we're going to take this
00:13:00.736 --> 00:13:03.476 A:middle
and make this and make
this into a library
00:13:03.756 --> 00:13:05.416 A:middle
and it's simplest
doing the following.
00:13:05.826 --> 00:13:10.156 A:middle
We're just going to take a blank
script in the AppleScript editor
00:13:10.536 --> 00:13:13.786 A:middle
and we're going to paste
the handler into this,
00:13:14.196 --> 00:13:17.666 A:middle
we're going to compile it
and then just click save
00:13:17.986 --> 00:13:21.736 A:middle
and we're going to save
it as a script file
00:13:22.286 --> 00:13:27.146 A:middle
and you'll notice we named it
AppleScript text transform is
00:13:27.146 --> 00:13:28.776 A:middle
the name of this little library.
00:13:29.196 --> 00:13:31.876 A:middle
Now libraries can
contain multiple handlers
00:13:32.076 --> 00:13:33.576 A:middle
but for our example
they're just going
00:13:33.576 --> 00:13:35.386 A:middle
to contain one handler, okay.
00:13:36.086 --> 00:13:41.846 A:middle
And we simply name the
library and then save it.
00:13:42.116 --> 00:13:44.766 A:middle
Next we install the
script library,
00:13:45.466 --> 00:13:47.526 A:middle
and the way that you
install it is you go
00:13:47.526 --> 00:13:50.606 A:middle
to your home library
folder and within
00:13:50.606 --> 00:13:54.886 A:middle
that library folder you create
a new folder called Script
00:13:55.036 --> 00:14:01.866 A:middle
Libraries and then you take your
newly saved AppleScript file
WEBVTT
X-TIMESTAMP-MAP=MPEGTS:181083,LOCAL:00:00:00.000
00:13:55.036 --> 00:14:01.866 A:middle
Libraries and then you take your
newly saved AppleScript file
00:14:03.016 --> 00:14:06.726 A:middle
and you drag that into the
Script Libraries folders
00:14:07.806 --> 00:14:10.986 A:middle
and it becomes part of
the AppleScript system
00:14:10.986 --> 00:14:14.246 A:middle
on your computer, that's it,
it's now installed for you.
00:14:15.256 --> 00:14:18.906 A:middle