Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to handle multiple Domain.sites2

i posted this long time ago:

https://discussions.apple.com/thread/1270976?answerId=6008805022#6008805022



revised for newer osx:


1) launch AppleScript Editor.app , it's in /Applications folder

2) copy the following into AppleScript Editor window:


do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"

delay 1

tell application "iWeb" to activate


3) select menu bar --> File --> Save as... (give it a name)

4) at File Format popup menu, select --> Application

5) make sure Options: Startup Screen is unchecked

6) click Save button

User uploaded file


Next time, instead of launch iweb, you just launch this new app.

I'd been doing this since iweb1.1.

Posted on Jul 22, 2011 12:22 PM

Reply
35 replies

Sep 12, 2011 3:54 PM in response to Cyclosaurus

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

Jun 13, 2012 12:26 PM in response to lewanm2

He sent me the file with the name domain.sites2.

How did he send the file to you?


Rename it and place it in your Users/Home/Library/Application Support/iWeb folder along with your domain file. You can make your user/library permanently visible as follows:


In Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.


To open your domain file in Lion or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.

do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"

delay 1

tell application "iWeb" to activate


You can download an already compiled version with this link: iWeb Switch Domain.


Just launch the application, find and select the domain file you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.

WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder. So rename your domain files once they've been created to something other than the default name.


OT

How to handle multiple Domain.sites2

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.