Tips & tricks: SiteSync and the Watch mode

November 30, 2007

If you think that TSW SiteSync is only about doing synchronizations back and forth between your website, you're actually wrong :). Have a look at the feature page and you will realize that SiteSync is more than that. One of my absolute favorite features, is the Watch mode. SiteSync will go into watch mode after you've made a synchronization, but in fact, you can start watch mode from the main interface as well. Simply select a website from the main SiteSync window and then click the "Watch mode" toolbar button.

When SiteSync goes into watch mode, it monitors the root folder of your local website, as well as all it's subfolders. Whenever a file is created or modified, SiteSync will add this file to the list of files to be uploaded, without interrupting you at all. Whenever you feel like it, you may return to the watch window and click the Upload button. SiteSync will then connect to the website FTP server, and upload the files in the appropriate directories.

I use this feature all the time, when making changes to multiple files on one of my websites. It allows me to make the changes without worrying about which files have been changed and needs an upload afterwards, and it saves me from the tedious work of finding the files and uploading them to the appropriate directories in a complicated directory structure. I love it! :)

Kasper (TSW) @ 11:11 am in SiteSync

Bringing back the Auto update date with scripting

November 24, 2007

Here's another post mainly written to show you why WebCoder scripting rules :). A customer complained about the lack of the "Auto update date" feature, which was present in WebCoder 2005, as well as a long range of versions before that. I didn't think anyone was really using it, which is why it was skipped for WebCoder 2007. Now that I know that at least one person is still using it, re-implementing it using WebCoder scripting seemed like an interesting idea. And as it turned out, it was pretty easy :). Here is how you do it.

First of all, we need a way to insert the special "tag" that allows WebCoder to update the timestamp in the file. A nice approach would be to add it to the Tools part of WebCoder, but that would be a bit harder to explain (although pretty easy to carry out). Instead, simply create a User button in WebCoder, and make it execute the following simple piece of scripting code:

from System import DateTime 

ScriptUtils.InsertCode("<!--WebCoderAutoDate-->Last updated " + DateTime.Now.ToString("MM-dd-yyyy HH:mm") + "<!--/WebCoderAutoDate-->")

Once the button is clicked, WebCoder will insert the special tag. The comments simply mark the text, to allow for easy recognition. You may change both the text as well as the format string used on the ToString method, but if you do, please remember to change it in the next part as well.

Now, we need to make sure that WebCoder changes the date automatically when saving the document, so in other words, we need to know when the Save button is clicked. No problem, let's hook into the BarManager and listen for the CommandClick event - by doing so, we can monitor every single toolbar and menu item in WebCoder, and wait for the user to click the ones we're interested in. The code below should be saved as a script (select Scripting -> Create new script, paste it in and then select Save), and then you should set it to start up along with WebCoder - otherwise, it won't update your dates until the script has been manually executed. After you have saved the script, select Scripting -> Reload script menu, then select Scripting -> Manage scripts, find your script and check the auto start checkbox.


from System.Text.RegularExpressions import Regex
from System import DateTime
from ActiproSoftware.SyntaxEditor import DocumentModificationType, LineTerminator, DocumentModificationOptions
from TSW.WebCoder.Classes import DocumentController

def CommandClickHandler(s, e):
	cmd = e.Command.FullName
	if((cmd == "Files.SaveDocument") or (cmd == "Files.SaveDocumentSplitButton")):
		regex = Regex("Last updated ([0-9-/:. ]*)");
		m = regex.Match(MainForm.Editor.Document.GetText(LineTerminator.CarriageReturn))
			MainForm.Editor.Document.ReplaceText(DocumentModificationType.Replace, m.Index, m.Length, "Last updated " + DateTime.Now.ToString("MM-dd-yyyy HH:mm")  + "", DocumentModificationOptions.RetainSelection)
			DocumentController.GetInstance().ActiveDocument.Modified = False
			Editor.Document.Modified = False

MainForm.BarManager.CommandClick += CommandClickHandler

And that's it - the auto update date functionality is back, courtesy of WebCoder scripting. You gotta love that :)

Kasper (TSW) @ 4:26 pm in WebCoder

New versions released

November 19, 2007

Hello everyone. I'm happy to announce the maintenance release of all 3 current TSW applications. Please read on for more information.

TSW WebCoder 2007, version 7.04

A new version of TSW WebCoder 2007 has been released. This release fixes a couple of issues with the Extended Search (and replace) functionality, reported by some users. Besides that, it fixes an issue preventing WebCoder from running on some computers when a Panda Antivirus solution was installed.

TSW SiteSync, version 1.02

With this version of SiteSync, I've added a new settings dialog, mainly to allow for customization of the encoding and linebreak type used by the mini editor. Also, a couple of minor bugs have been fixed. Besides that, an issue preventing SiteSync from running on some computers when a Panda Antivirus solution was installed has been resolved.

TSW WebPad.NET, version 1.12

This version of WebPad.NET comes with the same fixes as WebCoder 2007, as stated above. Besides that, a minor FTP client bug was fixed.

How to upgrade

To upgrade, simply go to the appropriate product page and download the application. Install it on top of the previous version, that should cause no problems. If you have any questions or comments, please contact us.

Kasper (TSW) @ 12:44 pm in SiteSync,WebCoder,WebPad.NET

The Christmas will be pink this year!

November 15, 2007


At least here in TSW HQ - stay tuned for more information!

Kasper (TSW) @ 1:07 pm in TSW