Setting list item gaps in Microsoft OneNote (AutoHotKey script)

Although I like Microsoft OneNote and use it continuously, it does have a few failings. One of these is the inability to set the default styles and layout for text.

In particular, when you create a new paragraph or list entry in OneNote, the default – non-changeable – setting is to have no white space between the paragraphs.

This is very poor design and makes more than a small amount of text quite unreadable. I’ve raised this with Microsoft but who knows if or when it might be sorted.

In the mean time, I need a far quicker way of changing this. Currently, I’ve had to:

  1. Select the container with the text I want to format
  2. Use the menu to show the List Task Pane ([alt]o/L)
  3. Mouse click on the text box to change (you cannot tab into it)
  4. Change the 0.00 pt default to something like the 6.00 pt that I prefer
  5. Close the List Task Pane

Not nice!

Having determined that there is nothing clever that can be done in OneNote, I decided that the old standy “AutoHotKey” would be useful. So I’ve created a script for AutoHotKey that will change the inter-list gap for the currently selected container.

; [win]-z Set OneNote list to 6pt separation
#z::
; We need a partial title match but we will also reset to previous setting
oldTitleMatchMode := A_TitleMatchMode
SetTitleMatchMode, 2

debug            := 1                                                           ; Set to 1 to output debug messages, or 0
winTitlePart := " - Microsoft Office OneNote"   ; Partial title of ON windows
winText          := "List"                                                      ; Text to identify List Task Pane - Visible Window Text: MsoDockRight, Task Pane, List
listDefault      := "0.00 pt"                                           ; The default setting for list separation between items
listNew          := "6.00 pt"                                           ; My desired spacing between list items

; Only do something if ON is the active window
IfWinActive, %winTitlePart%
{
        ; We need the List Task Pane to be visible
        IfWinNotExist, %winTitlePart%, %winText%
        {
                ;IfEqual, debug, 1, MsgBox List not active
                ; Send chars to activate menu, can't use WinMenuSelectItem with Office apps
                ;   SendPlay is used to prevent the Windows key locking the PC (Win+L)
                SendPlay, !oL
        }
        ; List Task Pane should now be visible, save the existing setting
        ControlGetText, Var1 , RichEdit20W2, %winTitlePart%, %winText%
        ; If the current setting is the default setting then make the change
        if Var1 = %listDefault%
        {
                ; Focus on the input box & set the text
                ControlFocus, RichEdit20W2, %winTitlePart%, %winText%
                ControlSetText, RichEdit20W2, %listNew%, %winTitlePart%, %winText%
                ; This is optional to check if we were successful
                ControlGetText, Var2 , RichEdit20W2, %winTitlePart%, %winText%
                if ErrorLevel   ; i.e. it's not blank or zero then error
                        MsgBox, %Var1% - %Var2% - Problem - %ErrorLevel%.
                else
                        IfEqual, debug, 1, MsgBox, OK - %Var1% - %Var2%.
        }
        ; Close the List Task Pane (actually it closes the Task Pane, period, sorry)
        SendPlay, ^{F1}
}
else    ; ON not active so do nothing
        IfEqual, debug, 1, MsgBox, OneNote not active

SetTitleMatchMode, %oldTitleMatchMode%
return

OK, so it’s a bit rough-and-ready but it does save a whole lot of time. I’ve got this in my default AHK script so it is loaded whenever I log in and is activated with [win]z.


Technorati : , , , , , ,
Diigo Tag Search : , , , , , ,

Changing system environment variables from the Windows command line

There are several ways to change global or user environment variables manually in Windows. Most are well known so I wont repeat them here (e.g. in Vista or Windows 7, Control Panel/User Accounts, Change my environment variables).

However, sometimes you want to do this from a command (aka script or batch) file. This is not as straightforwards as it might seem. That’s because if you simply set the variable – e.g. set FRED=JimBob – it is only set while you are in that command file. Once the script has finished, the variable will no longer be set.

There are a number of examples of setting system or user environment variables available if you do a Google search but most of them are incomplete – they do not immediately make the new value available to all applications (and particularly to new command shells).

To make sure that the new value is available system-wide, you have to tell Windows to refresh the environment variable list and the easiest way to ensure this happens is to change the variable from a Windows Scripting Host (WSH) script.

Here is an example script to do this. Save this file as something like set-env.vbs somewhere convenient.

'Set/Change/Delete An Environment Variable
'  In this simple script, we mainly assume that the variable space is USER.
'  The variable is not only changed for the calling script, it also forces a system-wide
'    refresh of the lists so the created/updated/deleted variable is immediately available
'    to all applications.
'
'Syntax:
'  With 3 arguments
'    Creates or changes the named variable in the in the given environment variable list
'    set-env.vbs <variable type> <variable name> <assigned value>
'
'  With 2 arguments - Assumes the variable type is USER
'    Creates or changes the named variable in the current USER's environment variable list
'    set-env.vbs <variable name> <assigned value>
'
'  With 1 argument - Assumes the variable type is USER
'    Deletes the named variable from the current USER's environment variable list
'    set-env.vbs <variable name>
'
'  With no arguments
'    No action taken
'
'Where:
'  <variable type> is one of
'    "System" (HKLM),
'    "User"   (HKCU),
'    "Volatile" or "Process"
'
'Author:
'  Julian Knight, http://www.knightnet.org.uk/contact.htm
'
'License:
'  Permission is given to reuse this code in any way desired
'  No support is given or implied for this code
'

Set WSHShell = WScript.CreateObject("WScript.Shell")

' Get arguments
Set oArgs=WScript.arguments

WScript.Echo
Select Case oArgs.Count
        case 3
                ' If we have 3 arguments, assume <type> <name> <value> and create/change
                WSHShell.Environment(oArgs.item(0)).item(oArgs.item(1)) = oArgs.item(2)
                WScript.Echo "Created or Changed Environment Variable: " & oArgs.item(0) & ", " & oArgs.item(1) & ", " & oArgs.item(2)
        case 2
                ' If we have 2 arguments, assume <name> <value> and create/change in USER space
                WSHShell.Environment("USER").item(oArgs.item(0)) = oArgs.item(1)
                WScript.echo "Created or Changed Environment Variable: USER, " & oArgs.item(0) & ", " & oArgs.item(1)
        case 1
                ' If we have 1 arg, assume <name> and delete in USER space
                WSHShell.Environment("USER").Remove(oArgs.item(0))
                WScript.echo "Deleted Environment Variable: USER, " & oArgs.item(0)
        case Else
                ' Otherwise do nothing
                WScript.echo "No action"
End select
WScript.Echo

Note that in Vista or above, you will need to run the command file with elevated privileges for this to work. The normal command prompt gets this automatically but if you want to run the file from Windows Explorer, you will need to create a shortcut and change the settings.

You can now use this in your batch command scripts, for example:

@echo.
@REM change http_proxy variable for current user (forces change & refreshes system so new setting is immediately available to everything)
@cscript.exe //nologo C:\set-env.vbs http_proxy http://localhost:3128
@echo.

@choice /T 5 /D y /N /M "Switch complete, now using local proxy"
@echo.


Technorati : , , , ,

Diigo Tag Search : , , , ,

Windows 7 (Build 7000) still my main desktop OS

A quick update on Windows 7. I’m still using the version from MSDN, Build 7000.

Unfortunately, it will not let me report bugs for some reason, the “Send Feedback” link always fails to authenticate my Windows Live login. However, I do have a few issues and a few likes.

Issues with Windows 7

Possibly Windows 7 Beta Issues

  • Power options only shows 2 out of 3 std options
  • Creating new folder in all users (in explorer), creates new folder but doesn’t allow rename (says folder already in use) yet allows delete
  • Screen resolution seems to randomly reset to something lower (NVIDIA WDM driver). Often can’t be put back to native resolution again without either a reboot or lots of tries and messing. Often happens after UAC prompts, sleep and logon screensaver, also sometimes when plugging in an external monitor. Trying to reset often causes Windows to go to a LOWER resolution that it started with (1024×768 which seems to be some kind of default)
  • Some folders that are accessible from Windows Explorer main interface give “Access Denied” when accessed from file open/save dialogues
  • Windows update failed from behind ISA proxy when using a proxy.pac file even though IE was working OK
  • Send Feedback failed from behind ISA proxy (even though IE works OK) – both on proxy.pac and direct proxy setting – gives invalid username/password. Actually, this always fails no matter what, it is not just a proxy issue as far as I can tell
  • Windows Mobile 6.1 device not recognised (HTC Touch HD) (Workaround: Install Windows Mobile Centre for Vista)
  • Shift-Delete on a picked file does not always delete file (shift-RMB/Delete does)
  • Windows Explorer does not always refresh correctly (e.g. Duplicate file & group entry [grouped by date], files not removed after delete), clears after F5/Refresh. Sometimes the refresh is very slow (2-3 seconds)
  • Wmic command line tool does not work correctly. The examples in Technet do not work if you want to specify an output template. The templates are not in %systemroot%\system32\wbem (note that the example given in Technet incorrect has a leading \) as expected by wmic, instead they are in a sub-folder, .\en-US and wmic cannot find them. You cannot put in a path either it seems. Copying the template to the parent folder does work. Interestingly, the “files” in the sub-folder are actually linked to sub-folders of %systemroot%\winsxs. Reported via technet.

Fundamental Windows issues still around in Windows 7

  • Can’t temporarily or quickly show hidden files and folders (for admin) – have to use the sledge-hammer approach of changing the Explorer settings which means drilling down several menus (NB: There is a script someone has written to toggle this setting)
  • When files/folders in use, Windows still doesn’t say who or what is using them! (e.g. USB)
  • Non-resizable dialog boxes (e.g. Power options/Advanced Settings, Driver Installation, …) – Even IE8 suffers from this (e.g. Customize Toolbar)


    This really is unacceptable in the 21st century!
  • Disk Management still does not allow a partition (at least the boot one) to be moved. It can be shrunk and can expand if there is space AFTER it but not if the space is BEFORE it
  • Add/Remove programmes – this is an area that Linux has really triumphed over Windows. Windows still has no standard way of keeping applications up-to-date. Also ARP still doesn’t enforce proper clean-up of data (especially the registry). At least this process is vastly quicker than previously
  • Mouse wheel scroll actions are still inconsistent (though better than previously). Some apps, you have to click in a list before the wheel will scroll (e.g. Most native Windows dialogs – add/remove programmes, Explorer) & still scroll even when the mouse is not over the list, others (e.g. Office) need only have the parent window active and don’t scroll when the mouse is not over the list
  • Still cannot easily manage NTFS links (hard/soft/parse points) even though they have been natively supported since Windows/NT! Hint: Use Link Shell Extension (though see MKLINK command line tool as well)
  • Still cannot natively mount an ISO image file (even though VHD files are now supported). Still cannot create an image natively. At least you can burn an image to CD/DVD natively now.
  • It’s inconceivable that, in this day of multiple monitors, Windows still can’t have different backgrounds on different monitors. At least there are some handy Windows shortcuts now to move windows between monitors

So, if those are the issues, what about the likes?

What I like about Windows 7

  • It is fast! Certainly a lot faster than Vista (not hard). It’s quick to start up and shut down as well
  • Left hand pane of Windows Explorer is now much better organised
  • UAC not quite as intrusive (though see issues)
  • Task bar – wasn’t sure I would like this but it does work well
  • Explorer Libraries – Nice little tweak to Windows Explorer, adds the ability to add many folders to a virtual folder and set one of them as the default write location

Hmm, that seems as though I dislike Windows 7? Well actually that impression is wrong. Windows 7 really is what Vista should have been. Lets forget Vista shall we, it was a mistake rather like Windows ME.

I’m still using Windows 7 even though I do get some problems so that should say something. If Microsoft and other key partners – hello NVIDIA! – can get the final issues sorted out, this is going to be a crackingly good operating system for any PC built in the last five to ten years.


Technorati : ,

Diigo Tag Search : ,

How to get and use your local IP address in a Windows 7 (and Vista) batch command file

If, like me, you spend a lot of time on a variety of customer sites, you will probably be familiar with the issues around swapping networks.

I’ve already blogged about the problems with Windows 7, Vista and Firefox proxy settings and I will do some more articles on getting on with problematic proxies later. However, I wanted to let people know how to get hold of your IP address from within a batch (command) file.

@REM ipconfig | find "IPv4 Address"
@REM Find the IPv4 address from ipconfig (13th var if string is split by both @REM and space)
@for /f "usebackq tokens=13 delims=: " %%i in (`ipconfig ^| find "IPv4 Address" `) do @(
   @set MyIP=%%i
   @REM Split addr into components so networks can easily be checked
   @for /f "usebackq tokens=1-4 delims=." %%a in ('%%i') do @(
      @REM @echo %%a,%%b,%%c,%%d
      @set MyIP1=%%a
      @set MyIP2=%%b
      @set MyIP3=%%c
      @set MyIP4=%%d
   )
)

Note the space after the : on line 3. The FOR command used twice here splits the text output from what is in the () after the “in” using the defined delimiters (“:” and space in the 1st case, “.” in the 2nd). In the first FOR statement, we take element number 13 only, it ends up in variable %%i. In the second case, we take elements number 1 to 4, they go into variables %%a, %%b, %%c, %%d.

Now you have not only the full address but also the componants so if you wanted to check whether you were in a particular class C network, you could do something like:

@set corp_addr_ip4=10.97.100.0

@REM == ADD NEW ADDRESS CHECKS HERE ==
@if "%MyIP1%.%MyIP2%.%MyIP3%.0"=="%corp_addr_ip4%" @goto DOSOMETHING

That would check if your local IP address is between 10.97.100.1 and 10.97.199.254

Note that I’ve used the enhanced FOR statement – the “usebakq” makes the FOR statement more like a UNIX type one where commands are enclosed in back-quotes (`). This certainly works for Windows 7 and should, I think, work for Vista. Prior to Vista, you would need to do things differently anyway. At the very least you would have to search for “IP Address” in the FIND statement as IPCONFIG didn’t include IPv6 information.

Now that you have everything in place, you can control the proxy settings for each application that needs access out of the local network. I’ll blog about that another time.


Technorati : , , ,

Diigo Tag Search : , , ,

Critical Bug in Outlook 2007

I’ve recently stumbled on a bug in Outlook 2007. Apparently it is quite well known and the only reason that I hadn’t found it was that I don’t use Outlook as my main email client. In fact I only use email on it to handle meeting requests.

The bug is that Outlook 2007 ignores the setting regarding sending reply requests for IMAP accounts.

If this seems rather irrellivant to you, you might want to think again.

If you have an email account that receives SPAM and you access it via IMAP, Outlook 2007 will ignore your setting for reply requests (the setting is defaulted to prompt). Since many SPAM emails have reply requested turned on, you will suddenly find that Outlook is trying to send a whole load of email messages that do not appear in any folder! You haven’t been asked, it is just doing it.

This is bad enough as you are now leaking information about your account out onto the Internet – but it gets worse!

Outlook does not send the replies out using the account that recieved the SPAM, it sends them out from the DEFAULT account.

So if you have, lets say for example, a work account that doesn’t recieve significant SPAM and is your default account in Outlook. Then you have a second, personal account perhaps, that does recieve significant SPAM. You will suddenly find that Outlook is sending hidden emails from your work account – these are the reply responses from your personal account. Now you are leaking information about your work account.

Now, there is a new, big update to Outlook 2007 that has just been released. It is not yet on Windows Update but Microsoft are touting it as the biggest and best set of updates for Outlook ever – see Jimmy May’s blog post for more information. Sadly though, despite the hype, the new update does not fix this critical bug.

The update – which will be part of the Service Pack 2 (SP2) for Office 2007 – certainly does vastly speed up the operation of Outlook 2007 so there is some good news.


Technorati : , , , , ,

Diigo Tag Search : , , , , ,

Sun’s VirtualBox gets on with it!

Yep, I keep being amazed by the quality of VirtualBox which is now owned by Sun.

I need to set up a virtual machine to test and demo Sun’s Identity Management (IdM) suite and it needs to be usable with VMware too. So I headed over to the VMware Appliances web site and downloaded a pre-canned Debian 5 server.

This is recognised fine by VirtualBox! I gave the VM a Host Networked connection to the network and with no further configuration, fired up the VM. First thing was to install some additional components so I used the Debian package manager (aptitude) from the command line (no windowing GUI here!) to install the file and database and web server virtual packages. It just worked, no networking problems at all and being a Host network, it is on my local LAN as well as the Internet with no problems.

It’s nice when things “just work”. That’s how it should be!

Of course, it probably wouldn’t have been quite so simple if I wanted a desktop as well. But there are also a number of pre-canned VirtualBox VM’s for downloading.

VirtualBoxImages and HelpDeskLive.


Technorati : , , ,
Diigo Tag Search : , , ,

Windows 7 supports IPTC in JPEG Picture Files! (Not quite – Adobe XMP actually)

Wow! I’ve just discovered by accident that Windows 7 beta supports a few IPTC XMP attributes in picture files. At last, Microsoft supporting standards!

Above is a screen shot from the properties of a test picture. The Description and Origin sections seem to be standard IPTC fields and I checked them out using iTag.

In iTag the Title attribute comes out as both the Title and the Description. The Subject field doesn’t seem to be recognised nor does the comments field. Rating, Tags, Authors and Copyright are all recognised by iTag.

I’ll do some more extensive testing when I get time.

Update: I spoke too soon :( In fact, it’s rather more complex.

Using ExifTool with ExiftoolGUI, I can see that actually, Windows 7 sets BOTH some EXIF attributes and some XMP (the Adobe meta data format) attributes but NOT IPTC attributes. As it happens, iTag also understands these. Here is a table of what seems to get set.

Windows 7 Attribute EXIF Attributes XMP Attributes iTag Name (Note that iTag synchronises EXIF and XMP attributes on updates [may not be a good thing], Win7 overwrites!!!)
Title XPTitle, UserComment,

ImageDescription
Title,

Description

(Note that only the Title will show the title in Windows 7)
Title,

Description (updates EXIF ImageDescription & XMP Description, multi-lines joined with “…”)
Subject XPSubject N/A N/A
Rating (Number, 1-5) Rating (1-5), RatingPercent (as per XMP)

Rating (1-5), RatingPercent (1=1, 2=13)

(Note that Rating alone DOES show the rating stars in Windows 7)

Stars under the thumbnail
Tags (“:” separated) XPKeywords (“:” separated) LastKeywordXMP (separated by “, “)

(Note that this alone DOES show in Windows 7)
Tag Bucket
Comments (Multi-line – ctrl-enter) XPComments (Lines separated with “…”) N/A N/A
Authors Artist, XPAuthor

Creator

(Note that this alone DOES show in Windows 7)

Author
Copyright Copyright Rights Copyright

The “XP…” EXIF attributes seem to be Windows specific as ExifToolGUI doesn’t offer an edit feature for them, just lists them.

So, a rather typically Microsoft mixed bag. Why wasn’t the XMP Description attribute mapped to Windows Comments? Similarly for EXIF UserComment!

Still, it is something anyway and hopefully the table will help you choose which attributes to use for the best cross-tool support.

I will try to add some more applications to the table if I get a change, if you get there before me, please let me know and I will add the details here.

Update 2: A quick look at Wikipedia shows that Microsoft seem to be backing XMP as support is built in to a number of their photo tools. In the past I’ve stayed away from this as only Adobe and other expensive products supported it whereas IPTC had more widespread support. It seems that this may be changing now – typical – time perhaps to find a way to copy all those IPTC attributes in my photos across to XMP.

See my note about what happens with Windows 7 and iTag updates. This is BAD. Windows 7 rides roughshod over several attributes. Even worse, iTag was unable to reopen the file after Windows 7 had updated it.

So do not use Windows 7 to update image attributes if you also want to use other, more professional tools.


Technorati : , , ,
Del.icio.us : , , ,
Diigo Tag Search : , , ,

Easier posting to Blogger Blogs (Zoundry Raven)

Just a quick note to recommend some software that makes writing blog entries very much easier.

The software is called Zoundry Raven and I’m using the latest beta (under Windows 7 beta).

The editor is WYSIWYG and has a much more sensible set of standards than the built-in Blogger editor (including the beta version). It also allows you to publish the same entry to multiple blogs if needed. It has image, link and tag handling too and it makes blogging rather more pleasurable.


Update 2009-02-28
: A couple of things I wanted to add to this. Firstly, Raven isn’t actually in beta! Secondly, that the more I use it, the more I like it! It is very extensible too, I’ve just added a tag search for Diigo, the online bookmarking service that is miles better than del.icio.us and it only took 2 minutes. I have also found that I rarely need to manually adjust the html, quite a change from the native Blogger interface. Finally, adding images is a breeze; you can copy and paste and as long as you have some storage defined (I’m just using a free Google Picassa account at the moment) and Raven will automatically upload the image and sort out the links – magic! Well done Zoundry.

One final thing. Raven doesn’t have all that good a support for proxy servers at the moment. So if you are behind a Microsoft ISA Server proxy (very common in large organisations), you might need to use something like CNTLM. I’ll blog about that another time I think.


Technorati : ,

Del.icio.us : ,

Diigo Tag Search : ,

Windows 7 Beta – Now my main OS

I’m now using Windows 7 Beta (Build 7000) as my day-to-day operating system.

It is generally very well behaved I have to say and appears to be what Vista should have been from the start. Vista reminds me a lot of Windows/ME, anyone remember that? Another failed Windows build. In reality, Vista was the Windows 7 beta.

Of course, there are a few rough edges and I’ll do a post about them shortly.

The PC is a Dell M1710, 17″ screen and 4GB RAM with WiFi and an NVidia 7900 series mobile graphics card.

Windows applications I use

Following on from my post about what stops me from dropping Windows altogether, I thought that I would put together a more complete post about the Windows applications I find myself using.

  • Memory Map -
    If ActiveSync is installed, the standard license allows you to push a copy of the Windows Mobile version to a handheld along with extracts of (or whole) maps, POI, routes, etc. It is also best to plan routes and add new POI on the desktop as its easier than the small interface on the handheld. There are two versions of the software. One will only run Ordnance Survey maps due to their overly restrictive license (in any other industry they wouldn’t be allowed to get away with it). The other will run any map other than OS and also allows you to scan your own maps. If you buy the OS one for British maps, you can download the other from their US web site. Both can be installed at the same time and they don’t seem to mind.
  • Google Sketchup
  • Laridian Pocket Bible for Windows -
    I generally use the Windows Mobile version of this excellent software but sometimes have the need to see larger passages, do side-by-side comparisons or write more extensive notes. The latest versions of the desktop now synchronise notes, etc.
  • MobiPocket Reader for Windows -
    This is able to translate ebooks from HTML and PDF into its native PRC format which is what I mainly use it for. It can push the file straight to a Windows Mobile device. It can also capture RSS feeds and do reading on the desktop.
  • ActiveSync -
    Yeuch! A necessary evil. The Linux sync software is notoriously difficult to get running and keep running and there are still some Windows Mobile installations that require a Windows machine with ActiveSync. It is though, the most dreadful and unstable software I use. I keep all of the options turned off so that it doesn’t mess up the handheld.
  • MyMobile -
    This is the epitomy of a simple piece of software that just works! It allows access to the screen and keyboard of the Windows Mobile device within the desktop. Really useful if you use the phone a lot, especially as a PDA as well. It also has a file manager that is a lot faster than the ActiveSync one.
  • Microsoft Office 2007 -
    Although I often try to use OpenOffice for general tasks, there is no getting away from the fact that MS Office is light-years ahead in terms of features. If, like me, you rely on these for your day-to-day work then you need MS Office. I would say though that I would no longer purchase a copy for home use (not that I’ve ever needed to thanks to always having access to business laptops) – OpenOffice is more than sufficient for general use.
  • Internet Explorer -
    It is a sad fact that there are still too many web sites that require IE to work. Thankfully all of the banking and finance sites seem to have got their act together.

Well, it is still a pleasantly small list. Don’t get me wrong, I am not against Windows, it’s just that I like having a choice and believe that real competition is good for everyone both users and suppliers. Further, I cannot really agree with the restrictive licensing that MS are always trying to force on people given the large price they put on both the software and updates. Nor can I really agree with the stifling of innovation that is the result of overly restrictive trade practices. The competition from Linux and open source is good for the market though I would really like to see OpenOffice start to innovate more rather than trying to play catchup with Office.