If you are trying to manage several domains with iWeb using several packages, I propose this applescript.
What it does is that it present a list of existing domain in ~/Library/Application Support/iWeb to the user for selection and run iWeb, so this script is to be run instead of iWeb.
On 1st run it ask the user to choose a name for Domain.sites2.
The script monitors iWeb and do clean-up when iWeb quits (after 5-10 seconds) then quit.
It is important to know that after you use this script, no domain file will exists with name Domain.sites2, the one that iWeb expect, except when iWeb has been started thanks to this script.
So after having use this script, it you start iWeb, a new default domain will be created, that can be useful.
Next time you run this script you'll be given the opportunity to name this new domain.
Hopping I have been clear enough.
To use it, copy paste the code in applescript editor and save it as an application that stay running. Don't give them the name iWeb as it will confuse the script. use iWeb Domain chooser for instance.
enjoy.
P.S. if only one Domain exists in ~/Library/Application Support/iWeb, iWeb is just started.
global iWebDomainFolder
global chosenDomain
global OK2Quit
set OK2Quit to false
tell application "System Events"
if exists process "iWeb" then
tell application "iWeb" to quit
repeat
delay 1
if not (exists process "iWeb") then exit repeat
end repeat
end if
end tell
set AppSupportFolder to path toapplication supportfromuser domainasstring
set iWebDomainFolder to AppSupportFolder & "iWeb"
tell application "System Events"
if (count file packages of folder iWebDomainFolder) is equal to 1 and (name of file package 1 of folder iWebDomainFolder) is equal to "Domain.sites2" then
-- there is only one iWeb domain package, just launch iWeb then.
tell application "iWeb" to activate
else
-- more than one iWeb domain package
if name of file package of folder iWebDomainFolder contains "Domain.sites2" then
try
tell me to set dReply to display dialog "This is the 1st time you run this script. It is required to name the file Domain.sites2\n\nEnter a name" buttons {"Cancel", "OK"} default button "OK" default answer "my iWeb domain"
tell application "Finder" to set name of file "Domain.sites2" of folder iWebDomainFolder to text returned of dReply & ".sites2"
my setiWebDomain()
on error number -128
-- user cancel
set OK2Quit to true
tell me to quit {}
end try
else
my setiWebDomain()
end if
end if
end tell
on setiWebDomain()
activate me
tell application "System Events" to set domainList to name of file package of folder iWebDomainFolder
set chosenDomain to choose from list domainList with title "Domain Chooser" with prompt "Choose the Domain you wish to edit"
tell application "Finder" to set name of file (item 1 of chosenDomain) of folder iWebDomainFolder to "Domain.sites2"
tell application "iWeb" to activate
end setiWebDomain
on idle {}
tell application "System Events"
if exists process "iWeb" then
return 5
else
tell application "Finder" to set name of file "Domain.sites2" of folder iWebDomainFolder to chosenDomain
set OK2Quit to true
tell me to quit {}
end if
end tell
end idle
on quit {}
if OK2Quit then
continue quit {}
else
activate me
display dialog "It is not advise to quit this application.\nIt will end automaticaly within 10 seconds after you quit iWeb" buttons "OK"
end if
end quit