Search This Blog

Wednesday, 23 July 2008

Print PDF to any printer - Without Acrobat

The previous post showed how you can print to any printer with some "secret switches" passed to Acrobat Reader®. Here is another way to print PDFs without using Acrobat at all. This is a far more efficient way of printing as it doesn't need to load Acrobat.

For this to work, your printer must support direct printing of PDF/Postscript (nearly all Postscript Level 3 printers support this).

Create a file called AutoPrintPdf.bat using a plain text editor (notepad, do not use editors like MS Word!), and enter the following inside the file:

rem ignore files that do not have a PDF extension
IF "%WD_FILE_E%" NEQ "PDF" GOTO :EOF
rem ignore all events, except FILENEW (a new file is created)
IF "%WD_REASON%" NEQ "FILENEW" GOTO :EOF
rem send it to printerport "raw" on server "server"
LPR -S server -P raw "%WD_FILE%"

Replace server with the name or ip address of the server to which the printer is connected.
Replace raw with the name of the printer. If this name contains spaces, surround the name with "quotes".

Create a new watchDirectory task, select the Run an existing .bat file plugin.
Click the "EXBAT" variable, and browse/select the AutoPrintPdf.bat you have just created.
On the Filter Events page create a filter so this task will only process files with a PDF extension.
On the Events page, only select the FILENEW option.

Or just use Foxit Reader

The current WatchDirectory release has a new task that uses Foxit Reader to print PDF's. Please see this blogpost.

Monday, 21 July 2008

Print PDF to any printer

The current implementation of WatchDirectory's Print PDF plugin always prints to the default printer. Here is a small tip if you want to print to another printer.

This is what Adobe has to say on this subject:

The DDE command line parameters for Acrobat and Reader are as follows. These are unsupported but have worked for some developers.

AcroRd32.exe /p filename
- executes the Reader and prints a file
AcroRd32.exe /t path printername drivername portname
- Initiates Acrobat Reader, prints a file while suppressing the Acrobat print dialog box, then terminates Reader.

The four parameters of the /t option evaluate to path,printername, drivername, and portname (all strings).
printername - The name of your printer.
drivername - Your printer driver’s name. Whatever appears in the Driver Used box when you view your printer’s properties.
portname - The printer's port. portname cannot contain any "/" characters; if it does, output is routed to the default port for that printer.

Note: If using Acrobat, substitute Acrobat.exe in place of AcroRd32.exe in the command lines.

The current implementation of WatchDirectory's "Print PDF" plugin passes 2 parameters to Acrobat:
/p - like above: print the pdf
/h - undocumented - do not show Acrobat's window while printing

If you want to print to another printer than the default, you need to use the "Run Any Bat File" plugin (you will find it on "New Task -> Scripting") and use the following batch file to do the printing:

rem you may need to change this, where is acrobat reader?
SET ACRO=C:\Program Files\Acrobat\Reader\AcroRd32.exe
SET TIMEOUT=60
rem if the printername doesn't contain spaces, remove the "quotes"!
SET PRINTER="My Printer"
SET GDPU=%WD_INSTDIR%\GdPUtil.exe



rem check for valid file type
IF "%WD_FILE_E%" NEQ "PDF" (
   %ANNOTATE% Warn "File not printed, only PDF files are supported"
   GOTO :Eof
)

"%GDPU%" -runkill %TIMEOUT% "%ACRO%" /t "%WD_FILE%" %PRINTER%
%ANNOTATE% Info done

Please change the script as needed (printername, location of Acrobat Reader).

Adobe® and Acrobat® are registered trademarks of Adobe.

Tuesday, 1 July 2008

WatchFTP Roadmap

This post will show you some future enhancements that are planned for WatchFTP.

version 1.1 (end of summer - probably beginning of August)
* Add support for a history database instead of plain log files

version 2.0 (no estimate yet) - this will be a free upgrade for version 1.x customers
* Tighter integration with our other program WatchDirectory - WatchFTP will be able to "alert" WatchDirectory directly about newly downloaded files. In this case WatchDirectory will not need to monitor a directory for changes.

A lot of other (smaller) features are planned, but the above are the major ones. All suggestions are welcome.

Friday, 27 June 2008

How Task History Works....

Playing with some screenshots, SnagIt and Microsoft's Gif Workshop, I have created an Animated GIF that shows how WatchDirectory's Task History Viewer works.

The Task History has all the (error) messages of your task, and can show you which files were detected and processed.

To view it "Full Size", click the picture below.

Sunday, 22 June 2008

WatchFTP 1.0

Monitor your FTP Server

After months of Beta's (thank you all for testing) last Tuesday we released WatchFTP 1.0 (also available in German).

WatchFTP monitors your FTP server for new and changed files and automatically downloads them to a Windows folder. After download, it can optionally start a batch file (for example, to import the new file into a database) and send an email.

Give WatchFTP a try and stop wasting time monitoring your FTP server with inadequate tools.

WatchDirectory Customers

WD Customers get a 25% discount, just contact us with proof of your previous purchase.

WD + WF = 100% Automation

Obviously, WatchDirectory and WatchFTP can work together. WatchFTP downloads a file and WatchDirectory processes it further.

A near future version of WatchFTP (free upgrade) will allow you to "directly trigger" WatchDirectory. WatchDirectory will not have to monitor the directory, but will receive a "signal" from WatchFTP after a download is complete.

Hope you will enjoy our new program!

Saturday, 21 June 2008

Debugging your batch files

When you use WatchDirectory's Batch File plugin or WatchFTP's Batch File Action this tip is for you!

Bat Files are great if they work, but can be a pain to "get right", especially when they run automated by our programs. The WatchFTP help-file has a section called "Troubleshooting" with a tip to debug batch files. Basically, what you need to do, is to "wrap" the batch file with another batch file that captures all your batch file's output.
The sample debugger.bat listed can be used "as is" for WatchFTP. If you want to use the same technique with WatchDirectory, you need to make a few changes (basically, change all occurences of the string WF_ to WD_).

View the Debugging Batch Files trick here.

Monday, 9 June 2008

WatchFTP Beta 7 - Only one more to go

We just released one of the last beta versions of our new program WatchFTP.

There will be one more beta after this one to make WatchFTP more "robust" in case of intermittent Internet connection problems.

You can download WatchFTP here.

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.