-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdetect-plugins.applescript
executable file
·96 lines (90 loc) · 4.4 KB
/
detect-plugins.applescript
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
-- detect-plugins.applescript
-- ServeBox
-- Created by Alex Coomans on 8/2/08.
-- Copyright 2008 __MyCompanyName__. All rights reserved.
(*
do shell script "ls /Applications/servebox/services/plugins"
set plugingroups to the result
set numgroups to the number of paragraphs in plugingroups
if numgroups > 0 then
repeat with I from 1 to numgroups
set plugingroupname to paragraph I of plugingroups
--do shell script "cd /Applications/servebox/services/plugins/" & plugingroupname
do shell script "ls /Applications/servebox/services/plugins/" & plugingroupname
set pluginnames to the result
set numplugins to the number of paragraphs in pluginnames
repeat with I from 1 to numplugins
set pluginexecname to paragraph I of pluginnames
do shell script "defaults read /Applications/servebox/services/plugins/" & plugingroupname & "/" & pluginexecname & "/Contents/" & pluginexecname & "-Info CFBundleIconFile"
set imageiconfile to the result
set newImage to load image imageiconfile
set imagebutton to button ("button" & I & "-" & plugingroupname)
call method "setImage:" of imagebutton with parameter newImage
end repeat
end repeat
end if *)
global imagenew
global imageiconfile
global imageiconfile1
-- script
do shell script "ls /Applications/servebox/services/plugins"
set plugingroups to the result
set numgroups to the number of paragraphs in plugingroups
--display dialog plugingroups
if numgroups > 0 then
repeat with currentgroup from 1 to numgroups
set plugingroupname to paragraph currentgroup of plugingroups
--do shell script "cd /Applications/servebox/services/plugins/" & plugingroupname
do shell script "ls /Applications/servebox/services/plugins/" & plugingroupname
set pluginnames to the result
set groupheadername to "groupheader" & currentgroup
--display dialog groupheadername
--display dialog plugingroupname
set the contents of text field groupheadername to plugingroupname
--set groupheadernametitle to (text field groupheadername of window "servebox")
--set title of groupheadernametitle to plugingroupname
--set visible of "sepg" & currentgroup & "1" to true
set numplugins to the number of paragraphs in pluginnames
repeat with I from 1 to numplugins
set pluginexecname to paragraph I of pluginnames
--display dialog pluginexecname
set sbplugin to "/Applications/servebox/services/plugins/" & plugingroupname & "/" & pluginexecname
--set sbplugin to (choose folder with prompt "Choose an sbplugin")
--set pluginname to name of (info for sbplugin)
--tell application "Finder" to set group1 to container of sbplugin as text
--tell application "Finder" to set groupname to POSIX path of group1
--set groupname to name of (info for (POSIX file groupname))
--tell application "System Events" to set sbplugin1 to POSIX path of sbplugin
set resourcepath to sbplugin & "/Contents/Resources/"
tell application "System Events"
set sourceplist to sbplugin & "/Contents/Info.plist"
set iconfile to (value of property list item "SBIcon" of property list file sourceplist)
set mainnib to (value of property list item "SBMainNIB" of property list file sourceplist)
set windowname to (value of property list item "SBMainWindow" of property list file sourceplist)
set mainscript to (value of property list item "SBMainCode" of property list file sourceplist)
set sbname to (value of property list item "SBName" of property list file sourceplist)
end tell
display dialog "Plugin Name: " & pluginexecname & "
Group Name: " & plugingroupname & "
Resource Path: " & resourcepath & "
Icon File: " & iconfile & "
Main NIB: " & mainnib & "
Window Name: " & windowname & "
Main Script: " & mainscript
--display dialog resourcepath & iconfile
set imageiconfile to resourcepath & iconfile
--set imageiconfile to POSIX path of imageiconfile
--set newImage to load image imageiconfile
--display dialog "g" & currentgroup & "b" & I
set imagebutton to button ("g" & currentgroup & "b" & I) of tab view item "hometab" of tab view "maintabs" of window "servebox"
--display dialog imageiconfile
--call method "setImage:" of imagebutton with parameter newImage
set imagenew to "a"
set imagenew to load image imageiconfile --"applications.png"
--display dialog imagenew
call method "setImage:" of imagebutton with parameter imagenew
set title of imagebutton to sbname
set enabled of imagebutton to true
end repeat
end repeat
end if