Author-it Tips and Tricks
Using Log Files with Author-it AfterPublish Macros PDF Print
Written by Hamish   
Saturday, 08 October 2011 05:13

One of the frustrations with Author-it AfterPublish macros is debugging them. Especially if you have a large number of macros. Something goes wrong, but you do not know what the macro was doing at the time it died. Or you are just getting unexpected results and you suspect maybe a variable is set incorrectly.

If you are writing a macro to run over a normal Word document (for example, by clicking a button on the toolbar), it is fine to just put debugging messages throughout the code using the MsgBox function. For example:

MsgBox ("Number of pages in document: " &
ActiveDocument.Range.Information(wdNumberOfPagesInDocument))

However, when running Author-it AfterPublish macros, you do not want message boxes popping up during publishing (especially if you have set up automated publishing jobs).

The solution I have come up with for this problem is a couple of simple macros that output debugging messages to a log file. You simply call a macro with the debugging message as the parameter. Using the example from above you would use:

Logs.WriteLog ("Number of pages in document: " & 
ActiveDocument.Range.Information(wdNumberOfPagesInDocument))

The WriteLog macro writes the message passed to the macro to the log file and prefixes it with the current date and time. By default, the log file is written to the publishing folder and has the same name as the published Word document with a .log extension (although this can be overridden).

Installing and getting it working

To install the log file macros:

  1. Download the Logs.bas VBA module from here.
  2. Open your Word publishing template.
  3. Open the VBA editor (in Word 2007/2010, on the Developer tab click the Visual Basic button).
  4. From the File menu select Import File...
  5. Browse to and select the Logs.bas file downloaded in step 1.
  6. Save your template.

You are now ready to write to log files. As shown above, call the Logs.WriteLog macro and pass any string as the parameter. For example:

Author-it log file example

The resultant log file will look something like this:

Author-it log file example output

Notes:

  • Writing to log files can degrade the performance of AfterPublish macros (because it increases the number of file I/O operations). You can turn logging off by setting the LogActive constant (near the top of the Logs module) to 'False':
Public Const LogActive = False
  • You can change the name of the log file by calling SetLogFileName and passing the new file name (you must also include the full path). For example:
Logs.SetLogFileName (ActiveDocument.Path & "\" & "AfterPublish.log")
Last Updated on Sunday, 09 October 2011 23:49
 
Bending Author-it Webinar (Free) PDF Print
Written by Hamish   
Friday, 23 September 2011 04:33

I am re-running my free 'Bending Author-it' webinar for the American/New Zealand timezones.

This FREE webinar will be held at the following times:

  • 0600 Australia EST Wednesday 12 October 2011
  • 0900 New Zealand NZDT Wednesday 12 October 2011
  • 1300 North America PDT Tuesday 11 October 2011
  • 1600 North America EDT Tuesday 11 October 2011
  • 2100 United Kingdom BST Tuesday 11 October 2011

Register here.

Details of the webinar below.


Out of the box, Author-it revolutionises your authoring environment and gives you so many more delivery options. But, if you dig a little deeper and get your hands dirty, you can really make Author-it work for you; give your output a unique look, effectively manage and manipulate your content, and streamline your publishing processes. 

Join me for the free 'Bending Author-it' webinar where I will show you how to 'hack' Author-it and bend it to your will. Topics include:

  • Custom titles pages
  • XML hacks
  • AfterPublish Macros.

This webinar is for anyone who is interested in seeing how to push beyond Author-it's out-of-the box functionality. However, to do the 'hacks' yourself, you will be a reasonably experienced Author-it user who has intermediate Author-it configuration skills and some technical aptitude.

This is a repeat of my 'Author-it Hacks' webinar that I delivered earlier this year. I am repeating it for the North American and New Zealand timezones.

Last Updated on Tuesday, 27 September 2011 10:05
 
Bending Author-it (a.k.a. 'Author-it Hacks') Webinar (Free) PDF Print
Written by Hamish   
Wednesday, 31 August 2011 07:35

Out of the box, Author-it revolutionises your authoring environment and gives you so many more delivery options. But, if you dig a little deeper and get your hands dirty, you can really make Author-it work for you; give your output a unique look, effectively manage and manipulate your content, and streamline your publishing processes. 

Join me for the free 'Bend Author-it' webinar where I will show you how to 'hack' Author-it and bend it to your will. Topics include:

  • Custom Titles pages
  • XML hacks
  • AfterPublish Macros.


This webinar is for anyone who is interested in seeing how to push beyond Author-it's out-of-the box functionality. However, to do the 'hacks' yourself, you will be a reasonably experienced Author-it user who has intermediate Author-it configuration skills and some technical aptitude.

This is a repeat of my 'Author-it Hacks' webinar that I delivered earlier this year. I am repeating it for the Asia Pacific/Middle East/European timezones.

This FREE webinar will be held on Wednesday, 14 September at:

  • 0900 GMT
  • 1200 Gulf Standard Time
  • 1330 India Standard Time
  • 1600 Australia WST
  • 1800 Australia EST

Register here.

Last Updated on Thursday, 01 September 2011 03:36
 
Author-it: Making Magic Happen (a.k.a. 'Author-it Hacks') Webinar PDF Print
Written by Hamish   
Tuesday, 10 May 2011 21:41

Out of the box, Author-it revolutionises your authoring environment and gives you so many more delivery options. But, if you dig a little deeper and get your hands dirty, you can really make Author-it work for you; give your output a unique look, effectively manage and manipulate your content, and streamline your publishing processes. 

Join me for the 'Author-it: Making Magic Happen' 'Author-it Hacks' webinar where I will show you how to 'work some magic' with 'hack' Author-it and bend it to your will. Topics include:

  • Custom Titles pages
  • XML hacks
  • AfterPublish Macros.

This webinar is for anyone who is interested in seeing how to push beyond Author-it's out-of-the box functionality. However, to do the 'hacks' yourself, you will be a reasonably experienced Author-it user who has intermediate Author-it configuration skills and some technical aptitude.

The webinar is at on May 24/25 at:

PDT 13:00 (24 May)
EDT 16:00 (24 May)
GMT 21:00 (24 May)
IST 01:30 (25 May)
NZT 8:00 (25 May)
AEST 6:00 (25 May)

Register here.

Last Updated on Tuesday, 17 May 2011 21:20
 
<< Start < Prev 1 2 3 4 5 Next > End >>

Page 1 of 5
Design and SEO by Webmedie
SEO Bredbånd Udvikling Internet