forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstackbehavior.livecodescript
More file actions
127 lines (115 loc) · 3.99 KB
/
Copy pathstackbehavior.livecodescript
File metadata and controls
127 lines (115 loc) · 3.99 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
script "InstallerStackBehavior"
################################################################################
#
# STARTUP METHOD
#
on startup
local tAction
if $1 is "install" then
put "install" into tAction
else if $1 is "doinstall" then
put "doinstall" into tAction
else if $1 is "uninstall" then
put "uninstall" into tAction
else if $1 is "douninstall" then
put "douninstall" into tAction
else
set the itemDelimiter to slash
if the last item of $0 contains "setup" then
put "uninstall" into tAction
else
put "install" into tAction
end if
end if
switch tAction
case "install"
if the environment is "installer command line" then
runFacelessInstall
else
hide me
send "runInstallerUI" to me in 0 millisecs
end if
break
case "uninstall"
if the environment is "installer command line" then
runFacelessUninstall
else
hide me
send "runUninstallerUI" to me in 0 millisecs
end if
break
case "doinstall"
runInstallerActions
break
case "douninstall"
runUninstallerActions
break
default
quit 1
end switch
end startup
-- MM-2011-04-01: Catch the relaunch message to make sure only a single installer is ever running
-- Ensures only a single updater is ever run, even if launched by multiple browsers.
on relaunch pArgs
if pArgs is empty then
return empty
else
pass relaunch
end if
end relaunch
////////////////////////////////////////////////////////////////////////////////
// Utility functions removed from the "Tools Installer" stack.
function resolveImageId pImage
return the id of image (pImage & ".png") of stack "Resources"
end resolveImageId
function resolveImageLongId pImage
return the long id of image (pImage & ".png") of stack "Resources"
end resolveImageLongId
function getInstallerType
return the cInstallerType of card "Resources" of stack "Resources"
end getInstallerType
command configureFonts pStack
switch the platform
case "win32"
if word 2 of the systemVersion >= 6 and "Segoe UI" is among the lines of the fontNames then
set the textFont of stack pStack to "Segoe UI"
set the textSize of stack pStack to 12
else if word 2 of the systemVersion >= 5 and "Tahoma" is among the lines of the fontNames then
set the textFont of stack pStack to "Tahoma"
set the textSize of stack pStack to 11
else
set the textFont of stack pStack to "MS Sans Serif"
set the textSize of stack pStack to 10
end if
break
case "linux"
set the textFont of stack pStack to "Helvetica"
set the textSize of stack pStack to 12
break
case "macos"
set the textFont of stack pStack to "Lucida Grande"
set the textSize of stack pStack to 11
break
end switch
end configureFonts
command setTitleField pField, pTitle, pSubTitle
if pSubTitle is empty then
set the text of pField to pTitle
set the textStyle of word 1 to -1 of pField to "bold"
set the textColor of word 1 to -1 of pField to "#444444"
else
set the text of pField to pSubTitle && "//" && pTitle
set the textColor of word 1 to -1 of pField to "#555555"
set the textStyle of word (-the number of words of pTitle) to -1 of pField to "bold"
set the textColor of word (-the number of words of pTitle) to -1 of pField to "#444444"
end if
end setTitleField
on errorDialog pError
if the environment is "installer command line" then
write "[" && the internet date && "]" && ": ERROR " && pError & return to stdout
quit 1
else
answer error "An error occurred when running the installer. Please submit a screenshot of this dialog to http://quality.livecode.com" & return & pError
quit 1
end if
end errorDialog