forked from canalnoises/OS9GameLauncher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame Launcher.applescript
114 lines (93 loc) · 2.55 KB
/
Game Launcher.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
on settings()
global theDiskImage
global theApp
global volumeName
set theDiskImage to "OS 9 SSD:Games:Deus Ex:Deus Ex No CD.img" as alias
set volumeName to "Deus Ex"
set theApp to "OS 9 SSD:Games:Deus Ex:Deus Ex" as alias
set appName to getappName(theApp)
end settings
---
on getappName(appPath)
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set theResult to (the last text item of (appPath as string))
set AppleScript's text item delimiters to oldDelims
return theResult
end getappName
--set screenSettings to {screen size:{640, 480}, color depth:8}
on checkDock()
--Check to see if A-Dock is running. If so, remember it and then quit A-Dock.
tell application "Finder"
if exists process "A-Dock" then
return true
else
return false
end if
end tell
end checkDock
on mountImage(theImage)
tell application "Finder"
open theImage --Mount the CD image
end tell
end mountImage
on setScreens(screenSize)
Çevent JonsScrCÈ screenSize --Set the display resolution and color depth
end setScreens
on runApp(theApp)
tell application "Finder"
open theApp --Launch app
end tell
end runApp
on waitUntilQuit(waitApp)
--Watch for app to quit
set appRunning to true
repeat until appRunning is false
tell application "Finder"
if exists process waitApp then
set appRunning to true
else
set appRunning to false
end if
end tell
end repeat
end waitUntilQuit
on main()
settings()
-- Screen Settings --
set currentScreenSettings to Çevent JonsScrLÈ given Çclass for È:Çconstant ScrSMainÈ --Store current display settings
global theDiskImage
global theApp
global volumeName
set aDockRunning to checkDock()
if aDockRunning is true then
tell application "A-Dock Control" to quit
end if
-- set diskList to list disks
mountImage(theDiskImage)
-- set screens to screenSettings
runApp(theApp)
waitUntilQuit(getappName(theApp))
-- set screens to currentScreenSettings --Revert to original display settings
--Relaunch A-Dock if it was running before.
if aDockRunning is true then
tell application "A-Dock Control"
activate
end tell
end if
--Eject the CD image:
tell application "Finder" to eject disk volumeName
end main
main()
on quit {}
global aDockRunning, volumeName
-- set screens to currentScreenSettings --Revert to original display settings
--Relaunch A-Dock if it was running before.
if aDockRunning is true then
tell application "A-Dock Control"
activate
end tell
end if
--Eject the CD image:
tell application "Finder" to eject disk volumeName
end quit