Newsletter:

TSW Blog

A comment script for WebCoder

December 14, 2007

A potential customer wrote me an e-mail about his thoughts on WebCoder. One of the things he missed, was a way to insert comments around a piece of CSS code, using a keyboard shortcut. I wrote him back with a single line of scripting code, and advised him to put it in a User button, and then create a keyboard shortcut to that button. He wrote me back and told me that it would be great if this single script could be used both in CSS and HTML, and that it would be great to have a script for removing the comments again - doing stuff like this is handy for debugging purposes, as most of us know. Here is the script I wrote for him - hopefully someone else can use it as well, or at least learn something from it :). Here it is:

if((Editor.Document.Language.Key == "PHP") or (Editor.Document.Language.Key == "CSS")):
	startTag = "/*"
	endTag = "*/"

if(Editor.Document.Language.Key == "HTML"):
	startTag = "<!--"
	endTag = "-->"

s = Editor.SelectedView.SelectedText
if(s != ""):
	if((s.StartsWith(startTag)) and (s.EndsWith(endTag))):
		Editor.SelectedView.SelectedText = s.Substring(startTag.Length, s.Length - startTag.Length - endTag.Length)
	else:
		ScriptUtils.InsertTags(startTag, endTag)
Kasper (TSW) @ 10:06 pm in TSW

TSW phpCoder 2008 and include files

WebCoder introduced PHP IntelliSense several versions ago, where your PHP code was parsed to obtain relevant information for the IntelliSense functionality. Including files is a very used technic with PHP, and WebCoder supported this by allowing you to define paths to where you would commonly place your include files. Obviously, parsing lots of files is a big task, and should be done as rarely as possible, to save system resources. However, for some users, this wasn't enough - they have include files which include other files which... and so on. To prevent WebCoder from hogging too many resources, it stops after the first level of included files, that is, it only parses include files of the main file, and no more.

It still works like this in phpCoder 2008, but this new application does come with another way of handling include files: Project based include files. When you create a new project, you will be able to define which folders contains the included files - you can even define specific files. When you open the project, all the files are parsed and the information is cached, allowing you to see it in all project documents. This will also come in handy for people including their files dynamically, since phpCoder will no longer care whether or not you use an include statement for a file that it can actually find.

Of course, the old way still works too, if you prefer it :)

Kasper (TSW) @ 9:11 am in phpCoder

TSW phpCoder 2008 - first video

December 10, 2007

I'm very proud to show you the very first video of TSW phpCoder 2008 in action. One of my favorite features of the application is the new PHP Tidy. It will help you write prettier code, by formatting it as configured by you, as you type or when you run the function on your document. You can customize it to suit your coding style, and while it will help you keeping your own coding standards, it can help you get a better overview of other peoples code as well. Open the document, press F4, and all the code is formatted the way you prefer it. This video also shows another new feature: The live syntax check. Have a look and be sure to let me know what you think of it! Oh, and don't worry about the simple interface shown in the video - it's simply running in fullscreen mode, to focus on the feature being shown. There are a bit more to it, which you will see in the next video :)

Click here to see PHP Tidy in action

Stay tuned until next time, where I will show you something even more cool - debugging!

Kasper (TSW) @ 10:43 pm in phpCoder

Announcement: TSW phpCoder 2008

December 7, 2007

phpcoder_logo_32x32 As I hinted at earlier, I'm working on a new application. It's called TSW phpCoder, and is, as the name suggests, a dedicated PHP editor. While WebCoder keeps the broad focus, phpCoder is intended for PHP developers only. It will come with a nice set of features to keep the PHP developer happy, and the entire interface is based around writing PHP code. Obviously, you will see stuff that's in WebCoder as well, but phpCoder will be lighter, and almost every feature will be PHP related in one way or another. With that said, most PHP developers will write HTML too and even CSS on occasions - phpCoder will of course help with this, just like it helps you write PHP code. phpCoder brings new features to the table, and besides all the small adjustments and improvements, I think you will find real debugging and profiling, PHP Tidy and live syntax check among the interesting additions! I'm currently creating a couple of videos to show you this, so stay tuned - the first one will be posted within the next couple of days! If you have any suggestions or comments, let me know :)

Kasper (TSW) @ 6:04 pm in phpCoder

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.

clr.AddReferenceByPartialName("ActiproSoftware.SyntaxEditor.Net20")

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))
		if(m.Success):
			MainForm.Editor.Document.ReplaceText(DocumentModificationType.Replace, m.Index, m.Length, "Last updated " + DateTime.Now.ToString("MM-dd-yyyy HH:mm")  + "", DocumentModificationOptions.RetainSelection)
			MainForm.SaveEditorFile(DocumentController.GetInstance().ActiveDocument.Filename)
			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

projectx_logo_128x128

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

Kasper (TSW) @ 1:07 pm in TSW

Making a mini webbrowser with WebCoder scripting

October 22, 2007

So, I thought I would do a little WebCoder scripting. We need some more demo scripts, showing off the potential off the scripting system. I created a small webbrowser, inside of WebCoder, and I'm now sharing the result with you. It could use a bit of polishing, but it works, and it has the basic webbrowser functionality, in only 61 lines of commented and nicely structured code - I think that's pretty cool! :)

So, here it is. If you wish to try it out, be sure to copy/paste it exactly like it is - the Python language is whitespace sensitive :). I know that this script is not terribly useful, but hopefully it will give you an idea of how easy it is to create something cool. I hope you can extend on this and make something even cooler! :)

# We need stuff from the .NET class library - add the
# required assemblies and then import the classes we need
clr.AddReferenceByPartialName("System.Windows.Forms")
from System.Windows.Forms import WebBrowser, ToolStrip, ToolStripButton, ToolStripTextBox, Form, DockStyle

# Create our form (the dialog window)
browserForm = Form()
browserForm.Text = "Mini browser"
browserForm.Height = 400
browserForm.Width = 600

# Create an instance of the WebBrowser control and place it correctly
browser = WebBrowser()
browser.Dock = DockStyle.Fill
browserForm.Controls.Add(browser)

# Create an instance of a ToolStrip control (the .NET toolbar) and place it in the top
toolbar = ToolStrip()
toolbar.Dock = DockStyle.Top

# Events for the buttons we are about to create
def BackButtonClick(s, e):
	browser.GoBack()

def ForwardButtonClick(s, e):
	browser.GoForward()

def GoButtonClick(s, e):
	browser.Navigate(addressBox.Text)

# Create a couple of buttons on the toolbar
backButton = ToolStripButton()
backButton.Text = "Go back";
backButton.Click += BackButtonClick
toolbar.Items.Add(backButton)

forwardButton = ToolStripButton()
forwardButton.Text = "Go forward";
forwardButton.Click += ForwardButtonClick
toolbar.Items.Add(forwardButton)

# Create a text field for entering URL's
addressBox = ToolStripTextBox()
toolbar.Items.Add(addressBox)

# Create a Go button
goButton = ToolStripButton()
goButton.Text = "Go!"
goButton.Click += GoButtonClick
toolbar.Items.Add(goButton)

# Add the toolbar to the form
browserForm.Controls.Add(toolbar)

# Navigate to the TSW blog
browser.Navigate("http://www.tsware.net/blog/")

# Show the form
browserForm.ShowDialog()
# Dispose the form, freeing up it's resources
browserForm.Dispose()
Kasper (TSW) @ 9:44 pm in WebCoder

TSW WebCoder 2007, version 7.03 released

October 12, 2007

I'm happy to announce a new minor release of TSW WebCoder 2007. This release comes with a fair amount of small fixes, tweaks and a couple of additions. Here is the list:

  • Added a setting for controlling which type of linebreak used when saving files (Unix, Mac and Windows style)
  • Tweaked the HTML IntelliSense to work better when writing within PHP strings
  • The Alt key was not handled properly when used to access the main menu
  • When creating new files from a project, the file would be empty - the project template OR the default template will now be used
  • Removed visual appearance settings for bracket highlighting from the Editor settings tab. In WebCoder 2007, they should be set from the Syntax coloring tab
  • A few very minor issues were corrected

The update has been released to replace previous versions, so if you are bothered by any of these minor bugs, just re-download from the WebCoder product page and install on top of the previous version. There should be no conflicts with datafiles from the final version of WebCoder.

Note to registered users of WebCoder: This is of course a free upgrade for you :). If you are running WebCoder 2007, version 7.00, you should be aware of the following: The location of the product key has been moved, so that WebCoder can now be registered by users not having access to the HKEY_LOCAL_MACHINE part of the registry. Instead, it will be installed in HKEY_CURRENT_USER. This means that you have to re-register the application. Simply use the same key if you still have it, or get a new one from the serial key system, as described in the e-mail you received upon purchasing WebCoder. If you have any problems, be sure to contact us.

Kasper (TSW) @ 10:31 am in WebCoder
« Previous PageNext Page »
Forums | Made with WebCoder | JustGirls.dk | ASP.NET Tutorial | C# Tutorial | AJAX Tutorial
© TSW 1998-2008
Made with WebCoder!