How To Run Multiple Batch Files When Windows Starts (but no user logged on)
Last week I had an urgent support call to attend to as an e-commerce site I'd developed for a customer had stopped taking payments. You can imagine I jumped on to it pretty sharpish.
The problem soon became apparent - the payment-processing terminal wasn't running. The server had been re-booted and, although Domino re-started as a Service, as expected, the payment terminal didn't. This is because I (stupidly) had put a shortcut to the program in the "All Users" Startup Folder and assumed it would load if ever the machine re-started for any reason.
It turns out programs in the Startup folder only launch if a user logs in. In this case nobody did and so they never launched. Seems so obvious. What was I thinking!
As a quick fix I had them log in to Windows. I then went about finding a way to have the terminal launch without them needing to log in.
Launching Programs When Windows Boots
It turns out it's not as easy as you might imagine to run a program when Windows starts but before a user logs in. The only solution I found was to create your very own Service.
The process of creating your own service to run a batch file is documented in this Microsoft Knowledge Base article.
However, it only allows you to run one BAT file and it has to be called AutoExNT.bat. Whereas, in my case I wanted to run two different BAT files. One for each payment terminal (one live and one for testing). It turns out you can do this by calling the two (or more I guess) batch files directly from inside the AutoExNT.bat file.
Here's what my AutoExNT.bat file looks like:
start C:\path\to\batch\1\launch.bat C:\path\to\batch\2\launch.bat
The first line tells the existing command prompt to launch a new instance and load the first batch file in it. The second line then goes on to run the other batch file. The result being two command prompts running the code in the relevant batch file. Et voila.
Don't forget to install the Service with the /interactive flag set to On if you want to see the prompts yourself when you log in. Oh, and to check the Service is set to Automatic.
2/5 Comments Read - Add | Thu 18 Mar 2010 | Open »
Notes Workspace in Flex, For All You Die-Hard Fans
Don't know about you but I like to have at least one "pet project" on the go at any given time. Something for me to mess about on when I get bored during the day (yeah, right) or late at night when all the kids are in bed.
For a few days now I'd not had a project and was getting a bit restless. Then I had a brainwave - how about a Flex version of the good ol' Notes Workspace.
After a day or two's worth of spare time spent I had come up with a working prototype:
Have a play and see what you think. Try the following features:
- Drag and drop icons
- Double click icon to open the database
- Right click workspace to add a new icon
- Right click workspace to change background
- Right click icon to remove it
Note that the icons you see are the actual Icons for the database; loaded via the /$icon URL. Change the icon in Designer and it updates in the Flex version (well, when the cache updates).
Note that you need "reader" access to the DB to see the icon!
Why?
A good customer of mine is moving away from Lotus Notes (client) on their desktops but keeping the Domino server and migrating the Notes apps to the web. One of the options I've suggested to them is using a Flex framework to ease the migration.
To ease the transition for the user I had the idea of providing some familiarity in the new environment. Whether they want a reminder of the Notes client or not I don't know, but it seemed like an interesting challenge and has been a fun learning experience so far.
Whether I'd actually suggest its use or not I don't know. I just thought it might make a nice portal.
Taking it Further
The glaring omission in this prototype is that you can't add your own icons. For now it loads a pre-defined list of icons from the backend DB. For it to work the user really needs to be able to add their own and remove the ones they don't want. It also needs to remember these icons and their positions.
And what about the open/add database dialog? This is something I'll add before I consider this "finished". But should there be a pre-defined list of web-enabled/migrated applications to choose from or should it just browse all files on the server? Should it allow the user to browse to other servers?
Some other considerations:
- Stacking icons for replicas -- does that apply on the web.
- Unread count. Can this be done on the web and/or does it apply still?
- Is the option to show server name applicable?
- Would it be worth adding tabs with custom colours - ala Notes.
- Mutli-select and move.
- Keyboard navigation?
- Might be nice to be able to click to select and (re)move.
At first I thought this would be simple then, the more I thought about it, the more complex it became. That's good though, right? A pet project should know no end after all.
Taking it much further I guess you could even provide a tool to let the user migrate their existing Notes workspace to the new Flex one.
For now it's just something nice to mess about with. Maybe one day you'll be able to visit it and reminisce of the good old days...
20/33 Comments Read - Add | Tue 16 Mar 2010 | Open »
Preserving Future Memories
My childhood is well documented thanks to my mum who did a great job of photographing it and keeping chronological albums from birth up to about when we were about 16 or more. It's great that I can I go back to my parent's and look through the albums of memories I'd otherwise have forgotten.
While it was my mum that took on this responsibility in our house it's now down to me to take, store and look after these future memories for not only us, but more importantly, for the kids.
It's not that I mind it, in fact I enjoy taking photos, but I do sometimes worry about how best to preserve these memories. Remember a while back I asked if this hard drive sounded broken. It came out of a friend's external hard drive "backup" and he'd given it to me in desperation as it had all his photos and videos of his son from birth to about 3 years of age. I couldn't do anything with it and he later sent it off to a specialist company who couldn't either.
You can imagine how distraught he must have been to lose all those memories. He now uses a ReadNAS box with RAID, as do I, but is this enough? RAID won't help in a fire or a burglary.
While I could make multiple backups both locally and in the "cloud" I don't think you can beat actual physical photos. Not everything is better on a PC. For me, I don't think you can ever beat an actual book where you can turn real pages!
For the past four years on Mother's Day I've made Karen a photo-book which contains a chronological set of photos looking at the year gone by. Here they all are:
The first is told from Felix's point of view and he goes on to narrate all four of them. The latest is the larger one at the back, in which the last page has all four kids on. Karen finds it hard to keep from crying when she looks through them (as do I) and it's something I want to keep on doing until they're in their late teens.
In lieu of traditional photo albums these books at least give me some peace of mind, that should the worst happen and all photo files are lost, then it's not the end of the world. These books are precious to me and kept well out of reach of the kids who are only allowed to look at them while supervised and with clean fingers.
Look after your photos!
The first three books were printed by Jessops, while this year I tried out Blurb and was very impressed. Although quite expensive (worked out about a pound per page) it's a quality book and the "image wrap" cover is nice and the publishing software easy to use. Blurb deliver world-wide I think. Give them a shot.
3/4 Comments Read - Add | Mon 15 Mar 2010 | Open »
Photos of New Office Build From Two Years Ago
While reminiscing yesterday I uploaded a set of photos of the destruction and re-build of the garage, which became Rockall HQ. You can see all the photos here.
Some of you DIY geeks might like a look. It was also an excuse to test out the Upload button in Picassa, which works well and seamlessly integrates with my existing Google account. Nice 'n easy. Just how I like things to be.
Two years on and I have no regrets in spending 7k on a new office. It was definitely one of my better ideas and worth every penny. Without an out-of-the-house office my productivity would be almost zero. You can't work at home when you have three kids 3 and under. Not a chance.
People often say to me "I bet you need to be really disciplined to work from home" to which I normally say "Not really". I just treat it as much like a normal job as I can. Leave the house as much before 9am as I can and come back in just after 5pm.
If you're wondering how I know it came to 7k or where all the money went then here's the log of the costs I kept:
| Window | 108 |
| Heater and Lights | 150 |
| Lock | 160 |
| Skip | 145 |
| Skip | 145 |
| Sand | 101 |
| Blocks | 270 |
| Concrete for footings | 250 |
| Screwfix - misc | 62 |
| Labour | 1200 |
| Cement 10 bags of | 25 |
| Metal mesh reinforcing | 40 |
| B&Q - Misc networking bits | 65 |
| Concrete for slab | 310 |
| weather strip for door | 8 |
| Large lintel and wood | 50 |
| Lintels and bricks from Jewsons | 128 |
| Plastering | 475 |
| Blocks | 80 |
| Door | 38 |
| Door frame | 45 |
| Rendering | 760 |
| EPDM (rubber) for roof | 341 |
| Wood for roof | 480 |
| Midi Skip | 75 |
| Screwfix - misc | 165 |
| Jewsons - fascia wood etc | 157 |
| B&Q - up-n-over frame, fixings etc | 37 |
| B&Q - Guttering et misc | 94 |
| Laminate flooring | 84 |
| Masonry paint | 36 |
| Wickes -- Gate and wood | 70 |
| SUBTOTAL | 6154 |
| Furniture for office | 900 |
| TOTAL | 7054 |
My original budget was 5k, but I think that was a little unrealistic. As you can see it soon adds up.
It all leaves me wanting to demolish and rebuild something else. I love a good "project" me.
2/3 Comments Read - Add | Fri 12 Mar 2010 | Open »
Twas Two Years Ago
Anybody remember what's going on here?
How time flies...
1/8 Comments Read - Add | Thu 11 Mar 2010 | Open »
More blog entries are available in the archive »


