Search This Blog

Saturday, 31 May 2008

WatchFTP Beta 4 - public beta

It took some time, but finally Beta 4 is available.

New in Beta 4:
  • Can run tasks as a Windows Service (*)
  • Can (optionally) remove the file from your FTP server
  • The Batch & Email actions can use a lot more variables (code stolen from WatchDirectory) - see help

WatchFTP is now "feature complete", there is no extra functionality planned.

TODO:
  • I believe there is one or two helpfiles missing
  • German helpfile
  • German translation of the program

Notes: (*) Vista compatibility testing took a long time. It should work fine now, for services and for "run as a normal program".

Download this version here and install "on top" of your current WatchFTP install:
download

Tuesday, 27 May 2008

Undocumented - Auditing with WatchDirectory

Intro

The Audit Plugin writes auditing reports for all changes detected inside the monitored directory. The format of these reports is considered not very "user friendly" by most people. In this blogpost I will show you an undocumented feature that allows you to change the appearance of these reports.

The default format

If you "do nothing", the audit information that is written looks like this:

File/Directory C:\WUTemp\Disasm.log 
   from 7/24/2005 10:41:31 AM to 7/24/2005 10:41:31 AM
[2036] 7/24/2005 10:41:31 AM, Open File by GDPLAP\\Jeremy. Program C:\WINDOWS\explorer.exe. 
   Permissions requested Delete, Read Attributes
   [2036] 7/24/2005 10:41:31 AM, Used a granted permission. Permission used Delete
   [2036] 7/24/2005 10:41:31 AM, Delete 
[2036] 7/24/2005 10:41:31 AM, Close

This tells you that user GDPLAP\\Jeremy used Windows Explorer to delete the file C:\WUTemp\Disasm.log on July 24, 2005 10:41:31 AM.

Change the report format

To change the report format, you need to create a text file named "template.txt" in the "task directory" of this auditing task. Below I assume you have named your task AuditDirectory.

  • Stop the task (AuditDirectory)
  • In the WD Control Center, select the menu "Tools -> Explore Task Directory.
    This opens Windows Explorer in the directory with all your task settings, normally
    C:\Documents and Settings\All Users\Application Data\watchDirectory
  • Open the sub-directory with the same name as your task (AuditDirectory)

Inside this directory, you need to create a file called template.txt. Write the text for the desired layout in this text file. You can use the following variables in this file:

%WD_USER%The user who "did it"
%WD_COMPUTER%The computer from which the user "did it"
%WD_PROGRAM%The program the user used
%DEFAULT%The original message-format (not very useful)

You can also use all variables listed here.

Example

User who did it %WD_USER% (on computer %WD_COMPUTER%)
Using this program %WD_PROGRAM%
The file %WD_FILE%
The original name %WD_OFILE% (if the file was renamed)
What happened is %WD_REASON%
The default auditing output:
%DEFAULT%

Friday, 23 May 2008

WatchDirectory 4.5.3

We just released a new version of WatchDirectory - v4.5.3.
New in this release:
  • New: Compatible with Windows 2008 Server.
  • Update: The previous release of the FTP plugin introduced NOOP commands to keep the connection alive. Some FTP servers have trouble with this option, so this release makes them optional.
  • Update: The "Fast Monitoring Method" would sometimes report the so-called "short filename" (file~01.txt), depending how the file was created. This new version will try to convert short filenames to their "long" equivalent.
  • Update: Added support for the new eventlog format of Windows Vista and 2008 to the Audit plugin.

Special thanks to "Jobey" who alerted us that WD would not start on Windows Server 2008. We would have found out ourself (just yesterday we added a Windows 2008 computer to our test-farm), but we did not intend to test WatchDirectory on it until the next release (originally planned at least a month from now).

Download the new release from this page. Install it in the same directory as your current install so it will "see" your current tasks and settings.
This release, like all 4.x releases, is a free update for all WatchDirectory customers with a 4.x license key.

Wednesday, 21 May 2008

Barracuda Spam Firewall

It is just awful! What a piece of junk hard-, soft-, cr*p-ware!

Are you, or is your company using the Barracuda Spam Firewall? Don't be surprised if you do not receive a response on questions....

It seems that Barracuda just deletes all email from anyone not explicitly "white listed". Also, if a message contains an URL (for example www.watchdirectory.net or some such extremely dangerous website address), it is also rejected by Barracuda...

Barracuda: Eating your Email For Pleasure

If your company uses Barracuda, Please use a hotmail or gmail address when you contact us.

Sending email with WatchDirectory - 10061 - Connection Refused by Remote Host

Most people have a firewall, spamfilter and/or virusscanner installed to protect them from the evil outside world. What some people don't realize is that these scanners also try to protect the "evil world" from you...

When you want to use WatchDirectory to send email, you need to configure its email-settings. When you press the test button an attempt is made to send an email.

This often fails..... Your firewall (spamfilter, virusscanner) detects that a program is trying to send email, ooh horror!! If it is a nice firewall, it will give you a popup window asking you to allow or deny the program (WatchDirectory) to send an email. Corporate firewalls (McAfee comes to mind) often don't ask you and just block the attempt to send email.

When WatchDirectory can not send the test-email, it asks you if you want to see the message-log. This log will typically contain something like this:

          Socket=804, RemoteIP=a0a36147, RemotePort=25
          ERROR(1038112204): SockCode=-10061 SeeCode=-36 PrevState=104
          ThisState=105 NextState=105
          Error attempting to connect. Connection refused by remote
          host.vSocket: 0 closed
The SockCode above - 10061 is the typical errorcode WatchDirectory receives when your firewall blocks the email.

How to resolve If your firewall did not prompt you to allow email access by WatchDirectory, you will need to change the firewall (spamfilter, virusscanner) settings yourself.

Some firewalls lets you configure this "per program", for others you need to completely disable "bulk email protection". Make sure to allow the following 2 programs: wdcc.exe - this is the WatchDirectory Control Center, it needs to be allowed so you can test your email settings. wdPostman.exe - this is the "System.Mail" program that sends email on behalve of all your tasks.

Monday, 5 May 2008

Quotes in batch files - Correcting a small mistake

When you enter a filename (includes program names) inside a bat file, or enter a command on a command-prompt (cmd.exe) always make sure to enter it between "quotes". Microsoft made a "small mistake" when they developed Windows-95.... They allowed spaces in file-names and directory-names. This has caused a lot of trouble over the years... You know the DEL (delete a file) command?
Simple:
DEL C:\Rubbish\GetRidOfIt.txt
No problem above, the DEL command will know what to do. However, lets assume the directory "C:\Rubbish" is actually called:
C:\My Garbage
(note the space? yes, you do!) - so you enter
DEL C:\My Garbage\GetRidOfIt.txt
One of the improvements in Win95 and above is that you can enter multiple file specs on the command-line for DEL (and a lot of other commands too). The above command will be interpreted by Windows as
DEL C:\My
DEL Garbage\GetRidOfIt.txt

Probably not what you want... The second command (DEL Garbage\....) could be in any directory where your script is running, how would you know? It would use the "current directory" to find out which file you meant.

Lets suppose you wanted to remove some files in the program-files directory:

DEL C:\Program Files\My Program\*.*
Windows would try to
DEL C:\Program
DEL Files\My
DEL Program\*.*

So....

Inside batch scripts and on command-lines, ALWAYS enclose everything in "quotes", this tells Windows: No, I am not entering multiple arguments here, please treat this as a single file-spec

DEL "C:\Program Files\My Program\*.*"
DEL "C:\My Garbage\GetRidOfIt.txt"

Why do I tell you this?

Because our WatchDirectory program and future WatchFTP program starts your batch files with a lot of %VARIABLES% (see here), and they are not surrounded with quotes!

DEL "%WD_FILE%"

Just "quote" everything in your batch script

Magical....

I promised earlier in my post on PhotoShop to write something about ImageMagick. ImageMagick is a great Open Source tool for people who want to manipulate their images. It is free to use, even for commercial purposes, I quote:
It allows you to freely download and use ImageMagick software, in whole or in part, for personal, company internal, or commercial purposes;

There are a few restrictions (read the license) that basically boil down to: "don't pretend you created ImageMagick"

Using ImageMagick to Automate your work

WatchDirectory can be used together with ImageMagick's command-line tools to AutoMagically transform your pictures. WatchDirectory (and our upcoming WatchFTP) has the option to start a batch file for each new (image) file detected.

The most powerful ImageMagick command-line tool is the convert command, but I MUST WARN YOU before you use it...

A Warning about Convert

When you enter the CONVERT command on a command prompt, strange things may happen... Windows itself has a command called CONVERT, and it is a rather painful command if you, by accident, get its command-line options right... What the Windows CONVERT command does is a complete transformation of a disk to NTFS format (could take hours). In the below examples I make sure to enter command-lines like

"C:\Program Files\ImageMagick-6.3.7-Q16\convert.exe" bla-di-bla
and NOT
convert bla-di-bla
as that may, by accident, start the disk-convert program, instead of the picture-convert program... Anyway, it is always a good idea to use "full paths" in batch files (and always enclose them in "quotes", more on that in a future post)

Continuing...

I will give you a few very short, sweet examples of using ImageMagick's convert command in a batch file that is started by WatchDirectory's Automatically Run A Batch File plugin. This blog-post will do just one, and tries to explain all caveats, workarounds and tricks. Future posts will concentrate more on features (how to do "x" with ImageMagick/WatchDirectory).

Convert from JPG to PNG

Your batch file should look like this:

"C:\Program Files\ImageMagick-6.3.7-Q16\convert.exe" "%WD_FILE%" "%WD_FILE_D%%WD_FILE_B%.png"

What does the above translate to? All variables (like %WD_FILE%) are explained on this page. Ok, just for this first example, I'll tell you:
%WD_FILE% - This is the complete path + filename of the file that is detected by WatchDirectory, for example C:\Monitored\Subdir\Hello.jpg.
%WD_FILE_D% - The directory where the new file is found, C:\Monitored\Subdir\
%WD_FILE_B% - The filename without its extension, Hello in this case.

So, just try to see what happens when WatchDirectory starts this script for the file C:\Monitored\Subdir\Hello.jpg... The command that Windows will perform is actually (after replacement of all %VARIABLES%):

"C:\Program Files\ImageMagick-6.3.7-Q16\convert.exe" "C:\Monitored\Subdir\Hello.jpg" "C:\Monitored\Subdir\Hello.png"

Now, isn't that quite simular to the first example of ImageMagick's Convert program??? You can now probably use a lot of ImageMagick's examples together with WatchDirectory, but please don't leave yet, read on... I have more to say...

A small problem...

Did you notice that the above batch file will create the PNG file in the same directory as where the original JPG is found? WatchDirectory will detect the new PNG file and start your batch file for that file again. So, your batch file is started for the file C:\Monitored\Subdir\Hello.png and Windows will run your script as

"C:\Program Files\ImageMagick-6.3.7-Q16\convert.exe" "C:\Monitored\Subdir\Hello.png" "C:\Monitored\Subdir\Hello.png"

mmmm, it could even get worse as ImageMagick will gladly convert a PNG to PNG, and WatchDirectory will now see a changed file and start your script again (and again, and again....)

One obvious solution is to create the PNG outside the monitored directory, in that case you would use this script:

"C:\Program Files\ImageMagick-6.3.7-Q16\convert.exe" "%WD_FILE%" "C:\OtherDirectory\%WD_FILE_B%.png"

That would work.... but if you really need to have the PNG in the monitored directory, you need to make sure the script ignores files that are "already PNG":

IF /I "%WD_FILE_E%" EQU "PNG" GOTO :EOF
"C:\Program Files\ImageMagick-6.3.7-Q16\convert.exe" "%WD_FILE%" "%WD_FILE_D%%WD_FILE_B%.png"

The "IF /I "%WD_FILE_E%" EQU "PNG" GOTO :EOF" will exit the script for files with a PNG extension.
%WD_FILE_E% - the file extension in UPPERCASE

Another option would be to configure WatchDirectory to ignore PNG files for this task.

Remove the original file after converting to PNG

Yes, I saw that coming, please try this batch file:

IF /I "%WD_FILE_E%" EQU "PNG" GOTO :EOF
"C:\Program Files\ImageMagick-6.3.7-Q16\convert.exe" "%WD_FILE%" "%WD_FILE_D%%WD_FILE_B%.png"
DEL "%WD_FILE%"

Coming next, another ImageMagick script?

ImageMagick is really a great tool to work with/transform your pictures. Doing this together with WatchDirectory allows you to Automate it! There will be future ImageMagick posts here!

Friday, 2 May 2008

Drop it.... Photoshop

Automatically photoshop your pictures, automate your droplets!

We quite often get questions about our thumbnail plugin from professional photographers. They want to do "bla bla bla" with their pictures... I don't even own a camera anymore - I am a Dinosaur in these days I guess. Most people are happy to have a task to reduce the size of a picture, some need more....

101 % flexibility

Did you know that WatchDirectory can start Batch files? - do you know what batch files are???

Did you know Photoshop can create "droplets"? Do you know what droplets are???
(actually, I didn't - someone told me)

Did you know the above makes sense, and actually can work together?

Ok, so you already know Photoshop. You can manipulate a picture "the way you want it", but it is a tedious, boring job to do with Photoshop for every single picture... You just want to do "the same thing" for every new picture....

Lets Automate (yeah!) First, you need to create a droplet in Photoshop, here is a google search for you to get the finer details: clickerdiclick The first link at the time of writing was Automate Your Favorite Photoshop Routines. Basically, a droplet is a kind of macro (action) you create in photoshop. You save this droplet on your disk somewhere (for example C:\Bin\MyDroplets\Smaller.exe) and when you drop a picture on it, it will automagically run all your tedious tasks.

Did you create your droplet? ok, now we will automate further by letting WatchDirectory automatically "drop" new pictures on your perfect droplet.

Create a new file called, for example, C:\droplets\mydroplet.bat, with notepad and make sure it has a .bat file extension! (do NOT use editors like Word for this, they add rubbish to the file that is NOT compatible with these scripts). The bat file should have the following line:

"C:\Bin\MyDroplets\Smaller.exe" "%WD_FILE%"

The above will start your droplet (smaller.exe in this example) on the new file detected by WatchDirectory! Use the Start a Batch File task to start this script.

If you want to remove the original file after this droplet did its thing, you should use this batch file:

"C:\Bin\MyDroplets\Smaller.exe" "%WD_FILE%"
DEL "%WD_FILE%"

Coming next - use ImageMagick with WatchDirectory

WatchFTP Beta

We started with a new Windows program called WatchFTP.

This program monitors an FTP site and automatically downloads new and changed files. After downloading, you can choose from several additional "actions" to perform on these files. Currently there are 2 actions you can choose from:

  1. Send an Email - to notify you of these new files
  2. Start a batch script - to do some "post processing" on the files

Obviously our WatchDirectory program, that monitors Windows folders for new/changed files, is a perfect companion to WatchFTP - or perhaps it is the other way around ;-)

This WatchFTP program is currently in Beta, we expect to release it one or two months from now - somewhere in June. If you can't wait and want to help during the beta period, please drop an email to support at WatchFTP dot com.

Gert

Welcome

Hi,

So finally I join "the future" and start blogging. Our newsletter has been on hold for a while - it is getting quite hard to email people without ending up on a spam-list, sigh...

The idea is this blog will publish small tips and tricks about our program WatchDirectory and our upcoming WatchFTP. You can expect one or two posts each month.

About me: I am Gert Rijs, owner and main developer at GdP Software. I used to work as a Java developer for a Dutch consulting firm ( http://www.Itude.com ) but started my own company a few years ago when I lived in Denmark for a year.

Our products are aimed at people wanting to automate their file-based tasks - basically, people who are as lazy (and forgetful) as I am ;-).

Hope you enjoy this blog,

Gert