Hi I am writing a script for the Myth II gaming community to allow them to easily switch which server they are using. This involves moving some files around from a base folder: Myth II, to a holder folder called Plugins. When the marius.net server is enabled the marius plugins will be in the plugins folder and the playmyth plugins will be in the base Myth II folder.
Currently my Myth II folder in in my Hard Disk folder (startup disk) which means the script would only currently work if the users Myth II folder was in the same place.
I need a way of locating the myth 2 folder. But that leaves me with another problem, the paths specified in my code would then be wrong. I think I would have to use variables to pass the path into the code.
Here is my current code: It asks which server you want to activate and then sets up the files as per which server you selected. If you select the server which is already activated is tells you.
Note: It also removes a file called bungie.net from a preferences folder each time a server is switched.
display dialog "Enable Which Server?" buttons {"Marius", "PlayMyth"}
if button returned of result = "Marius" then
tell application "Finder"
if (the file "marius net Patch" of folder "Myth II ƒ" of startup disk exists) then
activate
select startup disk
open selection
select folder "Myth II ƒ" of startup disk
open selection
select file "marius net Patch" of folder "Myth II ƒ" of startup disk
move selection to folder "plugins" of folder "Myth II ƒ" of startup disk
select file "marius net DNS" of folder "Myth II ƒ" of startup disk
move selection to folder "plugins" of folder "Myth II ƒ" of startup disk
select folder "preferences" of folder "Myth II ƒ" of startup disk
open selection
select file "bungienet" of folder "preferences" of folder "Myth II ƒ" of startup disk
delete selection
close container window of folder "preferences" of folder "Myth II ƒ" of startup disk
select folder "plugins" of folder "Myth II ƒ" of startup disk
open selection
select file "PlayMyth v1.2" of folder "plugins" of folder "Myth II ƒ" of startup disk
move selection to folder "Myth II ƒ" of startup disk
select file "PMI_Classic" of folder "plugins" of folder "Myth II ƒ" of startup disk
move selection to folder "Myth II ƒ" of startup disk
select file "Patch 1.2" of folder "plugins" of folder "Myth II ƒ" of startup disk
move selection to folder "Myth II ƒ" of startup disk
close container window of folder "plugins" of folder "Myth II ƒ" of startup disk
close container window of folder "Myth II ƒ" of startup disk
close container window of startup disk
else
display dialog "Marius Already Installed"
end if
end tell
else
if button returned of result = "PlayMyth" then
tell application "Finder"
if (the file "PlayMyth v1.2" of folder "Myth II ƒ" of startup disk exists) then
activate
select startup disk
open selection
select folder "Myth II ƒ" of startup disk
open selection
select file "Patch 1.2" of folder "Myth II ƒ" of startup disk
move selection to folder "plugins" of folder "Myth II ƒ" of startup disk
select file "PlayMyth v1.2" of folder "Myth II ƒ" of startup disk
move selection to folder "plugins" of folder "Myth II ƒ" of startup disk
select file "PMI_Classic" of folder "Myth II ƒ" of startup disk
move selection to folder "plugins" of folder "Myth II ƒ" of startup disk
select folder "plugins" of folder "Myth II ƒ" of startup disk
open selection
select file "marius net Patch" of folder "plugins" of folder "Myth II ƒ" of startup disk
move selection to folder "Myth II ƒ" of startup disk
select file "marius net DNS" of folder "plugins" of folder "Myth II ƒ" of startup disk
move selection to folder "Myth II ƒ" of startup disk
close container window of folder "plugins" of folder "Myth II ƒ" of startup disk
select folder "preferences" of folder "Myth II ƒ" of startup disk
open selection
select file "bungienet" of folder "preferences" of folder "Myth II ƒ" of startup disk
delete selection
activate
select file "PlayMyth v1.2" of folder "Myth II ƒ" of startup disk
move selection to folder "plugins" of folder "Myth II ƒ" of startup disk
select file "Patch 1.2" of folder "Myth II ƒ" of startup disk
move selection to folder "plugins" of folder "Myth II ƒ" of startup disk
select file "PMI_Classic" of folder "Myth II ƒ" of startup disk
move selection to folder "plugins" of folder "Myth II ƒ" of startup disk
activate
close container window of folder "Myth II ƒ" of startup disk
close container window of folder "preferences" of folder "Myth II ƒ" of startup disk
close container window of startup disk
else
display dialog "PlayMyth Already Installed"
end if
end tell
end if
end if