Fog Creek Software
Fog Creek Software

CityDesk 2.0-Documentation
Running External Programs After Publishing

If the built in features aren't enough for your site, you can program CityDesk to run an external program or batch file of your choice after publishing.

For example, you can create a batch file which modifies the HTML which was generated in any way. Or you can use an external program to upload files to your web server after the site is generated, if the built-in ftp support is not adequate for your needs.

Normally publishing consists of two steps:

  1. CityDesk generates a complete copy of the site in a temporary directory on your local hard drive.
  2. CityDesk then copies (uploads) any files which have changed from the temporary directory to the server.

You can set upyour publish locations to execute any command line you want either before or after the copying step. To do this:

*   Make sure you are in Designer Mode.

*   Click on the Locations tool or choose File  » Publish and click the Edit Locations button.

*   Edit the publish location.

*   On the last screen of the wizard, in the Run External Programs section, enter the complete command line for the program or programs you want to run.

You may provide a single command line to run before copying files and another to run after copying files. Each is optional. Surround each argument with "..." to prevent spaces in the argument from being interpreted as an argument separator. While external applications are running, the CityDesk publish window will wait patiently. When those programs are done, publishing resumes. You can still edit your site while publishing.

When you are providing an external application to run before copying files, you may use %1 in the command line. At publish time, this will be replaced with the full path to the temporary directory that CityDesk is using to build a copy of your site. For example, consider the following command line:

"notepad.exe" "%1\index.html"

This will launch Windows Notepad, allowing you to edit the index.html file from your site. As soon as the user exits Notepad, the publishing process will resume.

Note: The %1 trick only works for the command line that is run before copying files. After the files are copied, %1 is not available.

Also notice in our example the use of quotes. That is because the %1 will be replaced with a path to a folder which might include a space or two. This may confuse Notepad into thinking you are trying to open two files. To be safe always put quotes around the program name and each of the arguments you pass it.

If you need to run more than one program, you can create a batch file to execute them all.

CityDesk Documentation -  Home


©Copyright 2001-2003 Fog Creek Software, Inc. All Rights Reserved.