-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuickMusic.applescript
More file actions
executable file
·615 lines (581 loc) · 19.9 KB
/
Copy pathQuickMusic.applescript
File metadata and controls
executable file
·615 lines (581 loc) · 19.9 KB
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
on clicked theObject
if name of theObject is "exit" then
quit
else if name of theObject is "thetoggle" then
if content of text field "triob" of window "thewindow" is "1" then
set state of button "thetoggle" of window "thewindow" to 1
set content of text field "triob" of window "thewindow" to "2"
else
if content of text field "toggler" of window "thewindow" is "0" then
set state of button "thetoggle" of window "thewindow" to 1
set content of text field "toggler" of window "thewindow" to "1"
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 44, disp_x2 - 0, disp_y2 - 20}
repeat with theV from 44 to 67 by 2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theV, disp_x2 - 0, disp_y2 - 20}
end repeat
else if content of text field "toggler" of window "thewindow" is "1" then
set content of text field "toggler" of window "thewindow" to "0"
set state of button "thetoggle" of window "thewindow" to 0
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 67, disp_x2 - 0, disp_y2 - 20}
repeat with theX from 67 to 44 by -2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theX, disp_x2 - 0, disp_y2 - 20}
end repeat
end if
end if
else if name of theObject is "uberbutton" then
set i to contents of control "therating" of window "thewindow"
tell application "iTunes"
set newrate to (i * 20)
set rating of current track to newrate
end tell
else if name of theObject is "viewbtn" then
if content of theObject is 0 then
tell application "iTunes"
activate
end tell
tell application "System Events"
keystroke "3" using {command down, option down}
end tell
set the contents of text field "viewref" of window "thewindow" to "0"
else if content of theObject is 1 then
tell application "iTunes"
activate
end tell
set the contents of text field "viewref" of window "thewindow" to "1"
tell application "System Events"
keystroke "4" using {command down, option down}
end tell
else if content of theObject is 2 then
tell application "iTunes"
activate
end tell
set the contents of text field "viewref" of window "thewindow" to "2"
tell application "System Events"
keystroke "5" using {command down, option down}
end tell
end if
else if name of theObject is "artsearch" then
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_artist to the artist of the current track
else
set cur_artist to ""
end if
end tell
end using terms from
set x to cur_artist
set contents of text field "thesearch" of window "thewindow" to x
if state of button "sandp" of window "thewindow" is 0 then
tell application "System Events"
keystroke tab
end tell
else
set state of button "sandp" of window "thewindow" to 0
tell application "System Events"
keystroke tab
end tell
delay 2
set state of button "sandp" of window "thewindow" to 1
end if
else if name of theObject is "5size" then
tell application "iTunes"
activate
end tell
tell application "System Events"
keystroke "l" using command down
key code 29 using {command down}
end tell
else if name of theObject is "1size" then
tell application "iTunes"
activate
end tell
tell application "System Events"
keystroke "l" using command down
key code 18 using {command down}
end tell
else if name of theObject is "2size" then
tell application "iTunes"
activate
end tell
tell application "System Events"
keystroke "l" using command down
key code 19 using {command down}
end tell
else if name of theObject is "fitsize" then
tell application "iTunes"
activate
end tell
tell application "System Events"
keystroke "l" using command down
key code 20 using {command down}
end tell
else if name of theObject is "fullsize" then
tell application "iTunes"
activate
end tell
tell application "System Events"
keystroke "f" using command down
end tell
else if name of theObject is "vizbtn" then
tell application "iTunes"
activate
end tell
tell application "System Events"
keystroke "t" using command down
end tell
else if name of theObject is "playbtn" then
tell application "iTunes"
playpause
end tell
else if name of theObject is "prevbtn" then
tell application "iTunes"
previous track
end tell
else if name of theObject is "nextbtn" then
tell application "iTunes"
next track
end tell
else if name of theObject is "ami" then
tell application "System Events"
set fapp to the name of the first process whose frontmost is true
end tell
set the contents of text field "appi" of window "thewindow" to fapp
delay 1
end if
set appname to contents of text field "app1" of window "thewindow"
tell application appname
activate
end tell
end clicked
on mouse exited theObject event theEvent
if name of theObject is "thetoggle" then
if contents of text field "area1" of window "thewindow" is "3" then
beep
else if contents of text field "triob" of window "thewindow" is "1" then
set content of text field "toggler" of window "thewindow" to "0"
set state of button "thetoggle" of window "thewindow" to 0
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 67, disp_x2 - 0, disp_y2 - 20}
repeat with theX from 67 to 44 by -2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theX, disp_x2 - 0, disp_y2 - 20}
end repeat
end if
else if name of theObject is "titletext" then
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track
set cur_artist to the artist of the current track
else
set cur_song to "No song info available"
set cur_artist to "Unknown"
end if
end tell
end using terms from
tell window "thewindow"
set the contents of text field "titleText" to cur_song
end tell
else if name of theObject is "rec1" then
set levwasVar to contents of text field "levwas" of window "thewindow"
set contents of the control "therating" of window "thewindow" to levwasVar
end if
end mouse exited
on mouse entered theObject event theEvent
if name of theObject is "thetoggle" then
if content of text field "toggler" of window "thewindow" is "0" then
set state of button "thetoggle" of window "thewindow" to 1
set content of text field "toggler" of window "thewindow" to "1"
set content of text field "triob" of window "thewindow" to "1"
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 44, disp_x2 - 0, disp_y2 - 20}
repeat with theV from 44 to 67 by 2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theV, disp_x2 - 0, disp_y2 - 20}
end repeat
end if
else if name of theObject is "titletext" then
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track
set cur_artist to the artist of the current track
else
set cur_song to "No song info available"
set cur_artist to "Unknown"
end if
end tell
end using terms from
tell window "thewindow"
set the contents of text field "titleText" to cur_artist
end tell
else if name of theObject is "sq1" then
set contents of the control "therating" of window "thewindow" to 1
else if name of theObject is "sq2" then
set contents of the control "therating" of window "thewindow" to 2
else if name of theObject is "sq3" then
set contents of the control "therating" of window "thewindow" to 3
else if name of theObject is "sq4" then
set contents of the control "therating" of window "thewindow" to 4
else if name of theObject is "sq5" then
set contents of the control "therating" of window "thewindow" to 5
else if name of theObject is "playbtn" then
beep
else if name of theObject is "nextbtn" then
beep
else if name of theObject is "prevbtn" then
beep
else if name of theObject is "exit" then
beep
else
delay 1
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track
set cur_artist to the artist of the current track
else
set cur_song to "No song info available"
set cur_artist to "Unknown"
end if
end tell
end using terms from
tell window "thewindow"
set the contents of text field "titleText" to cur_song
end tell
if content of text field "toggler" of window "thewindow" is "0" then
set state of button "thetoggle" of window "thewindow" to 1
set content of text field "toggler" of window "thewindow" to "1"
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 44, disp_x2 - 0, disp_y2 - 20}
repeat with theV from 44 to 67 by 2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theV, disp_x2 - 0, disp_y2 - 20}
end repeat
delay 1
set content of text field "toggler" of window "thewindow" to "0"
set state of button "thetoggle" of window "thewindow" to 0
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 67, disp_x2 - 0, disp_y2 - 20}
repeat with theX from 67 to 44 by -2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theX, disp_x2 - 0, disp_y2 - 20}
end repeat
end if
end if
end mouse entered
on end editing theObject
set query to contents of text field "thesearch" of window "thewindow"
tell application "System Events"
if exists process "iTunes" then
set bob to visible of process "iTunes"
end if
end tell
tell application "iTunes"
set fred to minimized of front browser window
set col to collapsed of window "iTunes"
set vis to visible of window "iTunes"
end tell
tell application "iTunes"
activate
end tell
tell application "System Events"
tell application "iTunes"
activate
play
end tell
keystroke "l" using command down
keystroke tab
keystroke tab
keystroke "a"
keystroke (ASCII character 8)
keystroke query
keystroke tab
keystroke "£" using command down
end tell
if content of text field "viewref" of window "thewindow" is "0" then
tell application "System Events"
keystroke "3" using {command down, option down}
end tell
else if content of text field "viewref" of window "thewindow" is "1" then
tell application "System Events"
keystroke "4" using {command down, option down}
end tell
else if content of text field "viewref" of window "thewindow" is "2" then
tell application "System Events"
keystroke "5" using {command down, option down}
end tell
end if
if state of button "sandp" of window "thewindow" is 1 then
tell application "System Events"
tell application "iTunes"
stop
end tell
keystroke "a" using command down
keystroke space
tell application "System Events"
if exists process "iTunes" then
set visible of process "iTunes" to bob
end if
end tell
tell application "iTunes"
set visible of window "iTunes" to vis
set minimized of front browser window to fred
set collapsed of window "iTunes" to col
end tell
end tell
end if
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track
set cur_artist to the artist of the current track
else
set cur_song to "No song info available"
set cur_artist to "Unknown"
end if
end tell
end using terms from
tell window "thewindow"
set the contents of text field "titleText" to cur_song
end tell
end end editing
on mouse down theObject
if name of theObject is "theslider" then
if content of text field "muter" of window "thewindow" is "t" then
set y to content of text field "volset" of window "thewindow"
set contents of slider "theslider" of window "thewindow" to y
set content of text field "muter" of window "thewindow" to "f"
tell application "iTunes"
set the sound volume to y
end tell
else if content of text field "muter" of window "thewindow" is "tp" then
set content of text field "muter" of window "thewindow" to "f"
set y to content of text field "volset" of window "thewindow"
set content of text field "muter" of window "thewindow" to "f"
tell application "iTunes"
set x to sound volume
set z to y
set a to 1
play
end tell
repeat z times
set sound volume to (a)
set a to a + 1
set contents of slider "theslider" of window "thewindow" to (a - 1)
end repeat
end if
end if
end mouse down
on action theslider
using terms from application "iTunes"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track
set cur_artist to the artist of the current track
else
set cur_song to "No song info available"
set cur_artist to "Unknown"
end if
end tell
end using terms from
tell window "thewindow"
set the contents of text field "titleText" to cur_song
end tell
set y to contents of slider "theslider" of window "thewindow" as integer
if content of text field "muter" of window "thewindow" is "tp" then
tell application "iTunes"
set x to sound volume
set z to (x - y)
if z is less than 0 then set z to (z * -1)
set a to 0
repeat z + 1 times
set sound volume to (x - a)
if x is greater than y then
set a to a + 1
else if y is greater than x then
set a to a - 1
else
set sound volume to x
exit repeat
end if
end repeat
play
end tell
else if y is 0 then
tell application "iTunes"
set x to the sound volume
end tell
set content of text field "volset" of window "thewindow" to x
set content of text field "muter" of window "thewindow" to "t"
tell application "iTunes"
if (player state is playing) then
set newrandvar to 1
end if
end tell
if newrandvar is 1 then set content of text field "muter" of window "thewindow" to "tp"
tell application "iTunes"
set x to sound volume
set z to (x - y)
if z is less than 0 then set z to (z * -1)
set a to 0
repeat z + 1 times
set sound volume to (x - a)
if x is greater than y then
set a to a + 1
else if y is greater than x then
set a to a - 1
else
set sound volume to x
exit repeat
end if
end repeat
pause
end tell
else
tell application "iTunes"
set the sound volume to y
end tell
end if
end action
on will close thewindow
tell application "QuickMusic"
quit
end tell
end will close
on launched theapp
set prevsong to ""
set escape to "f"
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 44, disp_x2 - 0, disp_y2 - 20}
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track
set cur_rate to the rating of the current track
else
set cur_song to "No song info available"
set cur_artist to "Unknown"
set cur_rate to 0
end if
end tell
tell window "thewindow"
set the contents of text field "titleText" to cur_song
set the contents of control "therating" to cur_rate / 20
set contents of text field "levwas" to cur_rate / 20
end tell
end launched
on activated theapp
set escape to "f"
tell application "iTunes"
set x to the sound volume
end tell
set contents of slider "theslider" of window "thewindow" to x
repeat while escape is "f"
set prevsong to contents of text field "prevsong" of window "thewindow"
tell application "iTunes"
if exists (database ID of current track) then
set cur_song to the name of the current track
set cur_song to the name of the current track
set cur_artist to the artist of the current track
set cur_rate to the rating of the current track
else
set cur_song to "No song info available"
set cur_artist to "Unknown"
set cur_rate to 0
end if
end tell
if (cur_song is not equal to prevsong) then
tell window "thewindow"
set the contents of text field "titleText" to cur_song
set the contents of the control "therating" to cur_rate / 20
set contents of text field "levwas" to cur_rate / 20
end tell
if content of text field "toggler" of window "thewindow" is "0" then
set state of button "thetoggle" of window "thewindow" to 1
set content of text field "toggler" of window "thewindow" to "1"
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 44, disp_x2 - 0, disp_y2 - 20}
repeat with theV from 44 to 67 by 2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theV, disp_x2 - 0, disp_y2 - 20}
end repeat
tell window "thewindow"
delay 1.5
set the contents of text field "titleText" to cur_artist
end tell
delay 2
set content of text field "toggler" of window "thewindow" to "0"
set state of button "thetoggle" of window "thewindow" to 0
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 67, disp_x2 - 50, disp_y2 - 20}
repeat with theX from 67 to 44 by -2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theX, disp_x2 - 50, disp_y2 - 20}
end repeat
else
tell window "thewindow"
delay 1.5
set the contents of text field "titleText" to cur_artist
end tell
end if
set contents of text field "prevsong" of window "thewindow" to cur_song
else
tell window "thewindow"
set the contents of the control "therating" to cur_rate / 20
set contents of text field "levwas" to cur_rate / 20
set the contents of text field "titleText" to cur_song
delay 2
set the contents of text field "titleText" to cur_artist
end tell
end if
end repeat
end activated
on mouse up theObject event theEvent
set i to contents of control "therating" of window "thewindow"
tell application "iTunes"
set newrate to (i * 20)
set rating of current track to newrate
end tell
end mouse up
on should zoom theObject proposed bounds proposedBounds
if content of text field "toggler" of window "thewindow" is "0" then
set content of text field "toggler" of window "thewindow" to "1"
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 44, disp_x2 - 0, disp_y2 - 20}
repeat with theV from 44 to 67 by 2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theV, disp_x2 - 0, disp_y2 - 20}
end repeat
else
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - 67, disp_x2 - 0, disp_y2 - 20}
repeat with theX from 67 to 44 by -2
set bounds of window "thewindow" to {disp_x2 - 267, disp_y2 - theX, disp_x2 - 0, disp_y2 - 20}
end repeat
set the contents of text field "toggler" of window "thewindow" to "0"
end if
end should zoom
on will become active theObject
tell application "System Events"
set fapp to the name of the first process whose frontmost is true
end tell
set the contents of text field "app1" of window "thewindow" to fapp
end will become active