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
|
-- This AppleScript creates Finder aliases for all the
-- dynamically-loaded modules that "live in" in a single
-- shared library.
-- It needs a scriptable finder, and it may need some common
-- scripting additions (i.e. stuff that *I* happen to have:-)
--
-- If you compare it to MkPluginAliases.py it also serves
-- as a comparison between python and AppleScript:-)
--
-- Jack Jansen, CWI, August 1995
-- G is a list of {target, original} tuples
set G to {{"mactcp.slb", "mactcpmodules.slb"}}
set G to (G & {{"macdnr.slb", "mactcpmodules.slb"}})
set G to (G & {{"AE.slb", "toolboxmodules.slb"}})
set G to (G & {{"Ctl.slb", "toolboxmodules.slb"}})
set G to (G & {{"Dlg.slb", "toolboxmodules.slb"}})
set G to (G & {{"Evt.slb", "toolboxmodules.slb"}})
set G to (G & {{"Menu.slb", "toolboxmodules.slb"}})
set G to (G & {{"Qd.slb", "toolboxmodules.slb"}})
set G to (G & {{"Res.slb", "toolboxmodules.slb"}})
set G to (G & {{"Snd.slb", "toolboxmodules.slb"}})
set G to (G & {{"Win.slb", "toolboxmodules.slb"}})
set G to (G & {{"imgcolormap.slb", "imgmodules.slb"}})
set G to (G & {{"imgformat.slb", "imgmodules.slb"}})
set G to (G & {{"imggif.slb", "imgmodules.slb"}})
set G to (G & {{"imgjpeg.slb", "imgmodules.slb"}})
set G to (G & {{"imgop.slb", "imgmodules.slb"}})
set G to (G & {{"imgpgm.slb", "imgmodules.slb"}})
set G to (G & {{"imgppm.slb", "imgmodules.slb"}})
set G to (G & {{"imgtiff.slb", "imgmodules.slb"}})
-- Find the plugins directory
set Dir to choose folder with prompt "Where is the PlugIns directory?"
-- List everything there
set AllFiles to list folder Dir
-- Remove .slb aliases and remember .slb files
display dialog "About to remove old .slb aliases"
set LibFiles to {}
repeat with F in AllFiles
if F ends with ".slb" then
set fileRef to ((Dir as text) & F) as alias
set Info to info for fileRef
if alias of Info then
tell application "Finder"
move fileRef to trash
end tell
else
set LibFiles to (LibFiles & F)
end if
end if
end repeat
-- Open the folder, so we can talk to the finder about it
tell application "Finder"
set FinderName to open (Dir as alias)
end tell
-- The "real" mainloop: create the aliases
display dialog "About to create new .slb aliases"
repeat with Goal in G
set Dst to item 1 of Goal
set Src to item 2 of Goal
if LibFiles contains Src then
tell application "Finder"
set DstAlias to make alias to (((Dir as text) & Src) as alias)
set name of DstAlias to Dst
end tell
else
-- The original isn't there
display dialog "Skipping alias " & Dst & " to " & Src
end if
end repeat
display dialog "All done!"
|