Archive for March, 2009


Processing a Folder of Files

March 29, 2009

A few days ago I was speaking to one of my users about creating some PDF files from Microsoft Word and securing them so that they can’t be copied or printed.  Rather than using expensive software from Adobe or a generic creator like CutePDF I recommended using the add-in for Word 2007 that Microsoft provide as it provides some useful accessibility options (thanks to JISC TechDis for highlighting that one to me).

Unfortunately the add-in doesn’t have an option to secure a PDF so that’s where using a tool like PDFTK can help.  Being a command line tool though and the user having to produce more than 100 PDFs meant that a little help could come in handy.   Making use of the select folder VBScript I refined a little while ago, I created a generic VBScript to take a folder selection from a user and a command line operation via a simply single line input box to then process every file in the folder using the command line.

A percentage symbol is used as a place holder for the file path to be substituted into and any file paths for the command line (with the exception of the substitution – %) should include double quotes where there are spaces in the path.

Option Explicit

Dim strFolder, strRootFolder, strBaseCommand

'Get the information and process it
strRootFolder = SelectFolder("Select folder containing files to be processed:")
strBaseCommand = InputBox("Enter the command line to run against all files." & vbCrLf & "Place a percentage symbol (%) where the filename will be substituted")
ProcessFolder strRootFolder


'Identify each file in a folder and run the specified command against it.
Sub ProcessFolder(pstrFolder)
	Dim objCurrentFolder, objFile
	Dim colFilesInFolder
	Dim strCommand
	Dim objWSHShell, objFSO

	Set objWshShell = Wscript.CreateObject("Wscript.Shell")
	Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
	Set objCurrentFolder = objFSO.GetFolder(pstrFolder)
	Set colFilesInFolder = objCurrentFolder.Files

	For Each objFile in colFilesInFolder
		strCommand = Replace(strBaseCommand,"%","""" & objFile.Path & """")
		objWSHShell.Run strCommand
End Sub


Function SelectFolder(pstrDialogLabel)
	'Select a folder
	Const BIF_returnonlyfsdirs   = &H0001
	Const BIF_editbox            = &H0010

	Dim objBrowseFolderDialog, objFolder, objFSO, objSelection
	Dim bBrowseForFolder

	Set objBrowseFolderDialog = WScript.CreateObject("Shell.Application")

	bBrowseForFolder = true

	While bBrowseForFolder
		Set objFolder = objBrowseFolderDialog.BrowseForFolder (&H0, pstrDialogLabel, BIF_editbox + BIF_returnonlyfsdirs)

		'Check that something has been returned
		If IsValidFolder(objFolder) Then
			Set objFSO = CreateObject("Scripting.FileSystemObject")

			Set objSelection = objFolder.Self
			If objFSO.FolderExists(objSelection.Path) Then
				'A valid folder has been selected
				SelectFolder = objSelection.Path
				bBrowseForFolder = false
				'The selection is not a valid folder, try again...
				MsgBox objFolder.Title & " is not a valid folder, please select another folder" _
					, vbOKOnly & vbExclamation, "Invalid Selection"
			End If
			'Nothing was selected, so return a null string
			SelectFolder = ""
			bBrowseForFolder = false
		End If
End Function

Function IsValidFolder(pobjFolder)
	'Check that we have a valid value
	'i.e. you can concatenate it to a string
	Dim strTest

	On Error Resume Next

	strTest = " " & pobjFolder

	If Err <> 0 Then
		IsValidFolder = false
		IsValidFolder = true
	End If

	On Error GoTo 0
End Function

As it stands the folder just processes a single folder for all files (which was what I wanted), but simple amendments could allow this script to cater for specific file types (or patterns) and sub folders (a recursive call in the ProcessFolder() routine would allow this).


Dim Dim D’oh

March 26, 2009

I’ve been looking at a number of broadcast technologies recently like Adobe Connect and Instant Presenter.  Several months ago I came across Dim Dim and in essence I have been fond of this Open Source option as it offers free meetings for up to 20 users and it is constantly being developed.

Tomorrow I’m going to be demonstrating Dim Dim and Vyew to one of the Academy users as options for a meeting next week.  Not a strategic decision or anything just fulfilling a practical need.  The idea is the user will have both demonstrated and they can choose which one they will find easier.  Now my preference is for Dim Dim over Vyew for this as Vyew is more about collaboration for me whereas Dim Dim is more about presentation.

The user is going to be using our in place video conferencing equipment but someone at our end will be giving a PowerPoint presentation and someone at the other end will also be giving one.  Both systems allow PowerPoint slides to be uploaded and allow the control of the screen to be passed to different users.  If necessary both systems also have screen sharing should all the bells and whistles be in a PowerPoint presentation be necessary to view … but I will be warning of lag in viewing at the other end (there’s bound to be some latency).

I decided that I’d have a quick practice this evening to ensure that everything was up to the job and it is except I’ve discovered a bit of a glaring omission in Dim Dim.  In the current version you can pre-schedule a meeting and set everything up ahead of time … with the exception of being able to upload any documents (i.e. presentations) ahead of time.

I did a quick test by starting the meeting, uploading a  file, ending the meeting, and then starting the meeting again.  The uploaded presentation had been lost.  A quick search on the Dim Dim issue log yielded an unfortunate entry:

Log Entry EN-214

how can I load a PPT presentation prior to the start of the meeting? If I try to do this now for a 3:30 meeting, the participants receive an e-mail that the meeting has started.

Not only can you not preload presentations but when you first go into the meeting it e-mails attendees that it has started.  I guess that’s where the lobby feature comes in, but I can’t believe that such a generally progressive system missed this (basic?) feature – a bit of a Dim Dim D’oh!


Exchange Mailbox Limits Update Lag

March 19, 2009

Microsoft Exchange is a fairly ubiquitous system for handling e-mails and I made a surprising discovery today whilst amending a user’s mailbox storage limits … they don’t get updated straight away.

So lets take a little step back and look at storage limits.  First of all Exchange allows three size limits (in KB not number of mails) to be placed on user mailboxes. The first level triggers a warning to the user that they are approaching a limit … ironically the warning is an e-mail but it is a small one so this can be forgiven.  The second restricts the user’s permission to send mail (but they can still receive it).  The third limit actually stops any mail entering the inbox, but the mail server will keep mails queued up for a little while to give the user chance to make some space so all is not immediately lost if the user reaches this third and final limit – which can happen if someone bombards you with lots of e-mails with large attachments.

We impose limits on mailboxes for a number of reasons.  Ones that immediately come to mind for example are (in no particular order):

  1. It ensures that we have enough storage capacity on the mail server to handle all of the mailboxes.
  2. It ensures that users can’t monopolise the available storage space.
  3. It ensures that a user’s mail software remains responsive (though PST files can *really* trash this performance I also noted today).
  4. It ensures that mailboxes can be backed up and restored efficiently.

Occasionally however people have a need to have an increased mailbox size to get them through a busy period where they may be out of the office and unable to spend time housekeeping or if they are receiving a number of large attachments (e.g. during a funding bidding process or event registration).  On these occasions a temporary increase in mailbox size is authorised for an agreed period.

This isn’t a common occurrence and I’ve probably only amended mail storage limits some half a dozen times or so.  This change has always been picked up within a few minutes and until today I hadn’t realised how ‘lucky’ I’d been.

Today I discovered that Exchange actually works from a cached set of mailbox limits and that the default turn around time on this is up to a whopping two hours.  So this is something we’ll need to keep in mind in future though it may be that we might consider applying a registry change at some point to remedy this (though I think this is one to test on our development environment before making the change to the live system) or at least identify roughly at what time the cache refresh runs so that we can give our users a better idea of when the limits will take effect.

Whilst the #326252 Microsoft Knowledge Base article applies to Exchange 2000, some background reading suggests that this is applicable to later versions of Exchange too.


Windows Mobile Keyboard

March 8, 2009

A little while ago I spent some time outside of work struggling with a particular application on my Samsung Omnia i900 mobile phone.  It seemed like it just didn’t work properly and I almost reported it to the developers as a bug.  Just before I did I came across another piece of mobile software and noted a very similar problem and this time something clicked and I realised what the issue really was.

The problem I was experiencing was that I could navigate within the applications using my physical pointer on the touch screen of the phone, but within some parts of the application there was just no response when tapping (or double tapping).  Using the inbuilt optical mouse button had an identical non-response.  Eventually I realised that the software had been written for Windows mobile devices that had a physical D-pad.

A D-pad (or directional pad) is typically found below the screen on a Windows mobile device and has five physical buttons.  One for return (usually in the centre) and four directional buttons (up, down, left and right).  Since the Omnia has no D-pad my next thought was to have a look through the inbuilt keyboard options for an on screen keyboard with directional buttons.

By default I use the “Samsung Keyboard” which does not have any directional buttons.  A quick search through the options showed that the “MS Keyboard” was the only one to have arrow keys.  I tried using this keyboard and it did indeed resolve the navigation issue in the applications.  the only problem is that whilst I could navigate using the physical pointer and the optical mouse with this keyboard it is slow and fiddly as the keys are simply so small.  I use my fingers to do most of my interaction with my phone so I decided to continue looking for another finger friendly solution.

My first investigation was in trying to find a “virtual” or “on screen” D-pad.  Unfortunately everyone’s favourite font of all knowledge (Google) didn’t yield any usable results and so I took a step back to see if there were any keyboards for Windows mobile that could be configured to have large directional keys.

This time my search was a little more fruitful.  PCM Keyboard is an incredibly flexible keyboard for Windows Mobile devices.  Using the Microsoft emulator for WM6, a base theme package for PCM Keyboard called “dream2“, some rough documentation and several hours of confusion and frustration later and I have managed to configure more than just a simple on screen D-pad.

My solution is “DPress” a theme for PCM Keyboard.  Copy the file to your Windows mobile device and place it into the same directory as your PCM Keyboard installation (check under Program Files on whichever storage area you installed PCM Keyboard to).  Select the options for installed keyboards and the options for the PCM Keyboard.  Select DPress and ensure that you select a keyboard type (qwerty and azerty are included).  Save the changes and then the likelihood is you’ll need to restart your device and reselect the PCM Keyboard as the input option to get the DPress keyboard.

Below are some screen shots on how to access the different displays of the keyboard.  Click on the thumbnail images for larger views.

The Default - lowercaseuppercaselower case keyboard left is the default keyboard view as one might expect. From here the keyboard layout can be changed through a number of key presses. The most obvious one is pressing the shift key. This will change the layout to upper case(shown on the right). Pressing and holding the shift button will enable what is in effect caps lock and the upper case layout will remain until the layout is again changed – e.g. by pressing shift once more.

A number of keys provide quick access to in-situ additional keys.  Pressing and holding vowel keys will give access to extended character sets, similarly pressing and holding space will give access to numbers, the comma button will allow access to emoticons and the return button will give access to some function buttons (options, cut, copy, paste).  Some of these are illustrated in the following screen shots.

quick-numbers quick-extended-characters quick-emoticons

Clicking the “.,123” button swaps to a numeric keypad (left image below).  Clicking and holding the period (“.”) button swaps to a symbolic keypad (middle image below).  Finally (and the one you’ve probably been waiting for) by clicking and holding the “.,123” button a D-pad is displayed (right image below).

numeric-keypad symbolic-keypad d-pad

Quite versatile for one keyboard theme on a mobile device? I think so.

I’ll be blogging about the pieces of software I had the issues with in the not too distant future, but in the meantime enjoy the DPress keyboard. It is provided as is with no guarantees and I’m sure it probably won’t display well on every Windows Mobile device, but if it doesn’t work why not modify it yourself and modify it to suit your purposes. That’s exactly what I did with the “Dream2” theme so ultimately my thanks go to the author of that theme and PCM Keyboard.