Monday, February 23, 2009

My "Windows Explorer extensions" selection

While Using Windows XP (Pro), I installed a lot of extra extensions, to tweak it and make it work as I prefer. Below, one can find a selection of my preferred Windows Explorer tweaks:
  • Copy Path: provides extra options to copy the path of a selected file
  • QTTabBar: provides a tabbed interface within Windows Explorer
  • FindTarget: adds a context menu option when right clicking on a shortcut file and allows you to open the folder were the real file resides (batch file .bat)
  • Pretty Print: adds a context menu option when right clicking on an .xml file and allows you to easily PrettyPrint the file (apply correct indentations, see previous post in this blog)
  • ResHack: adds a context menu option when right clicking on a .exe file and allows you to easily open the file with ResHacker. This little tool can be used to change/extract resource used by the executable file.
  • Grep this folder, Tail this file: extra context menu options to easily grep within all files in a folder (and subfolders), and context menu option to easily tail the selected file (see previous post in this blog)
  • Unlocker: application that can detect when a file is locked, and allows you to release the lock so one can delete/move/rename/overwrite/... the file or release your external disk/stick.
  • New folder button: extra button in the explorer toolbar (and F12) to easily create a new folder within the current folder (press shift + enter to open the folder immediately after creating)
    NOT needed for Windows 7: press Ctrl+Shift+N
  • Open command window here: extra context menu option when right clicking on a file or a folder to easily open a command (cmd) windows at the current folder. (batch file .bat)
  • Aero cursor: better looking mouse cursor, the same as used in Windows Vista
  • Junctions: junctions / symbolic links / hard links context menu. Most programs see junctions as standard folders, while these are links to folders at other locations.
Download all required files for all these extensions at once here.

Update 27/03/2009: Easy-setup exe files create for aero cursor and copy path. Small registry mistake solved in ‘Open command window here’ script. Updated package with all files.

Update 12/03/2010: Updated to Dropbox links.

Update 12/05/2012: New copy path tool, Junctions added.

Office Ribbon lint Quick Access toolbar

Within Word 2007, one can choose some commands to be available in the 'Quick Access toolbar'. Those commands will always be visible, so it can be useful to put here the most used commands, or the commands which are hard to find within the Ribbon interface.


Below, one can see the commands I find most useful while working with large documents, profiles, etc.


Word2007RibbonENG.pngWord2007RibbonNL.png

Word 2013:

Word2013lint

Word2013lint-namesExcel 2013:

Excel2013lintExcel2013lint-names
All these personal quick access toolbar customizations can be imported using these .exportedUI files.

importCustomizationFiles

Update 13/11/2009: Added "Sort" button and dutch translated menu.

Update 13/11/2013: Added Word 2013 overview, Excel overview, exportUI files

MaxiVista in different environments


I'm using MaxiVista a lot, as well at home as at the office. It's great to be able to easily extend your desktop over the network onto an old pc, resulting in a very large screen managed with only one keyboard and mouse.

But I was facing the following problem when switching between my home environment and work environment: different IP addresses are used, resulting in MaxiVista to only function correctly when some manual configuration was updated and the PC rebooted, each time! While looking into this, I noticed the IP address of the server to connect to, was kept into the regstry key: HKEY_CURRENT_USER\Software\MaxiVista\A3\username\b1, b2 and b3. So by changing these values to the correct IP, and only then starting up MaxiVista, I was able to quickly switch between my environments. But yet I was facing another issue, I couldn't use static IP in one of my environments, so I wanted to automatically detect the correct IP address linked to a hostname. So, I wrote the following little batch script to get everything working nicely. One can copy-paste this into a .bat textfile, replace maxivistaserverhostname and username and run it. This way of working can of course be used anywhere else when to link a hostname to an IP address within a batch script.

@echo off
rem stop applications
taskkill /F /IM MaxiVistaA.exe
rem ping host
SET HOSTNAME=maxivistaserverhostname
SET USERNAME=username
ping -n 1 -w 1 %HOSTNAME% > %TEMP%.\ping.txt
setlocal enabledelayedexpansion
set ip=
set SEPARATOR=/
for /f "usebackq delims=[] tokens=2" %%i in (`find "[" "%TEMP%\ping.txt"`) do (
  set ip=%%i
)
> %TEMP%.\ping.txt ECHO %ip%
for /f "usebackq tokens=1,2,3,4 delims=. " %%i in (%TEMP%\ping.txt) do (
  reg add "HKCU\Software\MaxiVista\A3\%USERNAME%" /v "b1" /t REG_DWORD /d "%%i" /f
  reg add "HKCU\Software\MaxiVista\A3\%USERNAME%" /v "b2" /t REG_DWORD /d "%%j" /f
  reg add "HKCU\Software\MaxiVista\A3\%USERNAME%" /v "b3" /t REG_DWORD /d "%%k" /f
  reg add "HKCU\Software\MaxiVista\A3\%USERNAME%" /v "b4" /t REG_DWORD /d "%%l" /f
)
:: Delete the temporary ping file
DEL %TEMP%.\ping.txt
start "MaxiVista" "C:\Program Files\MaxiVista\MaxiVistaA.exe"
@echo on

Install Windows without disk drive


I've been searching for a long time to find an easy way to install Windows, only by booting from an USB-stick: no disk drive, no floppy disk, no pre-installed version of any OS required. Many resources talk about this on the net, but only one could do everything I needed and is really very easy to use!

The best freeware utility I could find so far is called WinSetupFromUSB. It has a very straightforward GUI and everything you need is included. It allows you to copy source files from a Windows setup image and copy them to your USB stick. Next you can easily boot from the USB stick (if supported by your PC and stick). I was able to install Windows 7 Beta from my USB stick with this nice tool.

Features
  • multiple Windows XP/2kX sources in the same partition (up to 10). They have to be in the first partition of the disk! Existing folders ~BT and ~LS and TXTSETUP.SIF will be renamed, and SETUPLDR.BIN and SETUPDD.SYS patched against the new names. Checksum checks are also corrected. BTS OEM folders are supported and renamed accordingly.
  • BartPE/WinBulder/UBCD4Win/WinFLPC (NOT ramdisk versions) to any primary partition. Multiple BartPE for example, in the SAME partition are NOT supported. Neither is the mix of them on a single partition.
  • Vista setup to different primary partitions. Multiple Vista sources in the SAME partition are NOT supported. Place your second Vista setup in another partition. It can be placed on any primary partition.
  • GParted 0.3.4-8 and 0.3.6-7, excellent open source partition manager.
  • SyLinux bootsector, and optionally folder, containing (Linux) distro, booting off SysLinux. For example you may extract UBCD411.ISO, and point it to this folder. Entire contents will be copied and entry for SysLinux will be added to the boot menu.
  • detects UBCD4Win and uses multiboot menu for it if folder IMAGES is found. Only default UBCD4Win multiboot options are added. Edit UBCD4Win.lst to add custom ones.
  • UBCD4Win boot menu is adjusted to boot from the selected partition. It can be placed on any primary partition.
  • if Windows setup folders (~BT and ~LS) and txtsetup.sif coexist in the same partition as BartPE/WinBuilder/UNCD4Win/WinFLPC, SETUPLDR.BIN of the latter is patched not to use txtsetup.sif in root. Checksum checks are also corrected.
  • grub4dos is the main bootloader/manager. Without it's advanced features, multiple partitions will not be easily achieved.
  • Bootsector loading GRLDR is installed in the active partition of the selected disk. Hence the requirement for active partition and MBR.
  • detailed log file is created in the folder, where program is executed from. Use it for troubleshooting. Upon next execution if log file is found, it's compressed in MS cab format, removed to BACKUPS folder and renamed with current DATE/TIME stamp.
  • upon installing grub4dos bootsector, backup of MBR and bootsector with DATE/TIME stamp are placed in BACKUPS folder. Use it in case something goes wrong.
  • if in Windows source folder winnt.sif or unattend.txt are found they will be used as answer file. Section UNATTENDED will be temporarily removed, only for the Text part of setup, and before start of GUI mode it will be merged back. PRESETUP.CMD is used for this purpose.
  • option to start the prepared USB disk in QEMU for testing purposes. Use carefully at own risk, do not attempt write operations!
  • tooltips on almost every element in the GUI
  • for multi partition USB stick use the cmd files in "files\tools\MULTIpartitionUSBstick". Works for 32bits Windows only! This is not thoroughly tested option, use at your risk.
Please read the included ReadMe.txt, it should help you get started. When in doubt hold the mouse over the element, a tooltip should help you with the choice.

Thursday, February 19, 2009

Easy PrettyPrint XML files


Xml files are much more readable, when they are 'Pretty Printed', using correct indentation.
I made a little tool which will provide a new context menu when right-clicking on an xml file: 'Pretty Print'. When clicking on it, all xml indentation will be set correctly and the original file will be overwritten with a pretty printed version of it.

Just run this setup to install this little add-on, tested in Windows XP. One can check what's inside the setup with WinRar, since you should never trust an exe coming from the net.

Update 16/02/2012: dropbox link to setup file.

Windows XP Theme color during login / logout

Using Windows XP, I prefer the "Silver" or "Olive" windows theme colors, since I get sick of the strong blue colors used by default. Changing the theme is very easy for normal situations (right click desktop -> 'Properties' -> 'Appearance' -> 'Color scheme').
But during login and logout of Windows XP, the default colors are still used.

Using the Windows PowerToy TweakUI, one is able to easily copy some configuration out of the current desktop configuration into the default desktop configuration used during login (like settings for screensaver, mouse, etc) but the Color scheme is not copied with the PowerToy.
To easily change this setting, one can open it's registry editor and change the values manually:
Start -> 'Run' -> type 'regedit' -> 'Ok' -> Navigate to the following key: 'HKEY_CURRENT_USER\ Software\ Microsoft\ Windows\ CurrentVersion\ ThemeManager' -> Double click on the 'ColorName' element -> change the value into 'Metallic' (for Silver theme colors) or 'HomeStead' (for Olive green theme colors).

BareGrep + BareTail + UltraEdit


Monitoring very large (log)files can be done very easily with BareGrep and BareTail. Those very little applications can make a big difference when it comes to productivity and speed during monitoring of production critical systems.

Although the applications are running fine, I was often missing some small extra features. So I made some small AutoHotKey script to get what I wanted:
  • Within BareGrep: press Ctrl+Shift+U: open the file in UltraEdit and scroll to the line that was selected within BareGrep
  • Within BareGrep: press Ctrl+Shift+F: open the selected file in BareTail and find the selected line.
Besides these extra keyboard shortcuts, I also made some registry changes to add extra options in the context menu when right-clicking on a file or folder: 'Grep this folder' option will be added, which will launch BareGrep with the correct folder selected.

My complete automated setup of BareTail+ can be downloaded here. All source files are included.

Tested on Windows XP, no uninstaller available.
Update 14/09/2010: new version of AutoHotKeyScript with properties for paths of BareGrep, BareTail and editor. New version of the 'grep this folder' explorer integration.

Update 23/11/2010 v1.1: new version with support for Notepad++ editor linenumber syntax ( -n)
Update 10/03/2016 v2.0: new version with support for Ctrl+Shift+e to view selected file in Explorer, Ctrl+Shift+N (same as Ctrl+Shift+U) open selected file in text editor, integrate admin elevation when enabling or disabling explorer integration to write to registry, store user config in %userprofile% dir instead of program files dir so no admin elevation is required for preference update and config storage.

Wednesday, February 18, 2009

Babylon - Contacts


I'm a big fan of Babylon to easily translate or explain something. I also use it a lot with my own created "dictionaries". For example: I made some script to easily export all my Microsoft Outlook contacts and create a Babylon dictionary out of it. Whenever I need a name, email, phone number, ... of some contact, I just have to provide a name, company, phone number,... to immediately popup my contacts details with just a click.

Follow these steps if you want to be able to export your own Outlook contacts to Babylon.


  1. Export MS Outlook contacts to Excel file: Menu 'File' -> 'Import and export' -> 'Export to file' -> 'Microsoft Excel 97-2003' -> 'Contacts' -> chose some location to save the file
  2. Open the generated Excel file
  3. Add a new macro in the Excel file: Menu 'Developer' -> 'Visual Basic' -> Sheet1 -> Copy-paste my macro from here :
  4. Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
      "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
    Private Type OPENFILENAME
      lStructSize As Long
      hwndOwner As Long
      hInstance As Long
      lpstrFilter As String
      lpstrCustomFilter As String
      nMaxCustFilter As Long
      nFilterIndex As Long
      lpstrFile As String
      nMaxFile As Long
      lpstrFileTitle As String
      nMaxFileTitle As Long
      lpstrInitialDir As String
      lpstrTitle As String
      flags As Long
      nFileOffset As Integer
      nFileExtension As Integer
      lpstrDefExt As String
      lCustData As Long
      lpfnHook As Long
      lpTemplateName As String
    End Type
    Sub ConvertOutlookContactsToBabylon()
        sFile = "C:\Contacts.gls"
        
        Application.ScreenUpdating = False
        ' turns off screen updating
        Application.DisplayStatusBar = True
        ' makes sure that the statusbar is visible
        Application.StatusBar = "Preparing babylon file in " + sFile
        
        '--------------------------------------------------------------------------
        'Create export file
        '--------------------------------------------------------------------------
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set f = fs.CreateTextFile(sFile, True)
        f.writeline ("### Glossary title:Contacts")
        f.writeline ("### Author:")
        f.writeline ("### Description:Contacts")
        f.writeline ("### Source language:Dutch")
        f.writeline ("### Source alphabet:Latin")
        f.writeline ("### Target language:Dutch")
        f.writeline ("### Target alphabet:Latin")
        f.writeline ("### Icon:")
        f.writeline ("### Icon2:")
        f.writeline ("### Browsing enabled?Yes")
        
        f.writeline ("### Type of glossary:00000000")
        f.writeline ("### Case sensitive words?0")
        f.writeline ("; DO NOT EDIT THE NEXT **SIX** LINES  - Babylon-Builder generated text !!!!!!")
        f.writeline ("### Glossary id:029f645f6877899f836e9c869d8a89447c6e8e9e8271769a9d659559957889978372869c8477772a9693897f5d89526e7c458944648127444854575a428a9244977c946e5b524147584c559fcc23264eac62515a414f4b8b279a224f5a42474f5f555638993bd86e5b524147584c559f908e2d60475e5a4b597e66833a32294d48429a4d5955")
        f.writeline ("### Confirmation string:7C221QRF")
        f.writeline ("### File build number:01292D7C")
        f.writeline ("### Build:")
        f.writeline ("### Glossary settings:00000000")
        f.writeline ("### Gls type:00000001")
        f.writeline ("; DO NOT EDIT THE PREVIOUS **SIX** LINES  - Babylon-Builder generated text !!!!!!")
        f.writeline ("### Part of speech table:")
        f.writeline ("### Private label id:")
        f.writeline ("### Min version:0")
        f.writeline ("### Regular expression:")
        f.writeline ("### Glossary section:")
        'Find a free column to fill with copy
        ' and find the column to copy from
        For iColumn = 1 To 65000
            'Empty column, stop loop
            colName = CStr(Worksheets(1).Cells(1, iColumn).Value)
            If colName = Empty Then
              lastColumn = iColumn
                Exit For
            End If
            
            'Columns to remove
            If colName = "E-mail Type" Or colName = "E-mail Display Name" Or colName = "E-mail 2 Type" Or colName = "E-mail 2 Type" Or colName = "E-mail 2 Display Name" Or colName = "E-mail 3 Type" Or colName = "E-mail 3 Display Name" Or colName = "Gender" Or colName = "Priority" Or colName = "Private" Or colName = "Sensitivity" Then
              Worksheets(1).Columns(iColumn).Delete (xlShiftToLeft)
              iColumn = iColumn - 1
            End If
            
        Next iColumn
        
        
        'go thru all rows
        For iRow = 2 To 65000
        
            'check if last row to do
            If Worksheets(1).Cells(iRow, 2).Value = Empty And Worksheets(1).Cells(iRow, 4).Value = Empty And Worksheets(1).Cells(iRow + 1, 2).Value = Empty And Worksheets(1).Cells(iRow + 1, 4).Value = Empty Then
                Exit For
            End If
            
            'start new line for babylon display data
            Worksheets(1).Rows(iRow + 1).Insert (xlShiftDown)
            'insert empty row between each contact
            Worksheets(1).Rows(iRow + 2).Insert (xlShiftDown)
            
            'output line, will be written to file
            sLine = ""
            
            'babylon subject
            sSubject = ""
            FullName = CStr(Worksheets(1).Cells(iRow, 2).Value) + " " + CStr(Worksheets(1).Cells(iRow, 4).Value) + "|" + CStr(Worksheets(1).Cells(iRow, 4).Value) + " " + CStr(Worksheets(1).Cells(iRow, 2).Value) + "|"
            
            'keep track of column working in, since cells will be deleted but not in header row
            iColumn = 1
            For headerColumn = 1 To (lastColumn - 1)
                If Worksheets(1).Cells(iRow, iColumn).Value <> Empty Then
                    
                    'convert value to string
                    elementValue = CStr(Worksheets(1).Cells(iRow, iColumn).Value)
                    
                    
                    'eleminiate empty birthday dates
                    If elementValue = "0/0/00" Then
                        Worksheets(1).Cells(iRow, iColumn).Value = ""
                    Else
                        'insert babylon display data
                        displayData = elementValue
                        
                        'convert email addresses to links
                        If InStr(displayData, "@") And (Not InStr(displayData, " ")) Then
                            displayData = "<a href='mailto:" + elementValue + "'>" + elementValue + "</a>"
                        End If
                        
                        'convert web links
                        If Worksheets(1).Cells(1, headerColumn).Value = "WebPage" Then
                            If Not InStr(elementValue, "http://") Then
                                displayData = "<a href='http://" + elementValue + "'>" + elementValue + "</a>"
                            Else
                                displayData = "<a href='" + elementValue + "'>" + elementValue + "</a>"
                            End If
                        End If
                        
                        'convert phone numbers
                        If InStr(Worksheets(1).Cells(1, headerColumn).Value, "Phone") Or InStr(Worksheets(1).Cells(1, headerColumn).Value, "Fax") Then
                            displayData = Replace(Replace(Replace(elementValue, "+31", "+31."), "+33", "+33."), "+32", "+32.")
                        End If
                        
                        
                        'convert categories
                        If Worksheets(1).Cells(1, headerColumn).Value = "Categories" Then
                            displayArray = Split(displayData, ";")
                            displayData = ""
                            For Each sArrayElement In displayArray
                                displayData = displayData + "<a href='bword://" + sArrayElement + "'>" + sArrayElement + "</a> "
                            Next
                        End If
                            
                            
                        'Put display data in sheet
                        Worksheets(1).Cells(iRow + 1, 1).Value = Worksheets(1).Cells(iRow + 1, 1).Value + "<b>" + Worksheets(1).Cells(1, headerColumn).Value + "</b>: " + Replace(Replace(Replace(displayData, vbCrLf, "<br>"), vbCr, "<br>"), ";", ",") + "<br>"
                        
                        
                        'replace vbCrLf vbCr ; with |
                        elementValue = Replace(Replace(Replace(Replace(elementValue, vbCrLf, "|"), vbCr, "|"), ";", "|"), "||", "|")
                        'replace all special character for babylon search data
                        replacedChars = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(elementValue, " ", "|"), ".", "|"), "@", "|"), ":", "|"), ";", "|"), "-", "|"), "/", "|"), "||", "|"), "||", "|"), "|&|", "|"), "|-|", "|"), "|.|", "|"), "|~|", "|"), "|=|", "|")
                        replacedChars = Replace(Replace(Replace(replacedChars, "+31", "0"), "+33", "0"), "+32", "0")
                        
                        If replacedChars <> elementValue Then
                            Worksheets(1).Cells(iRow, iColumn).Value = elementValue + "|" + replacedChars + "|"
                        Else
                            Worksheets(1).Cells(iRow, iColumn).Value = elementValue + "|"
                        End If
                        
                        If headerColumn = 1 Or headerColumn = 2 Or headerColumn = 3 Or headerColumn = 4 Then
                            If sSubject = "" Then
                                sSubject = elementValue
                            Else
                                sSubject = sSubject + " " + elementValue
                            End If
                        End If
                        
                    End If
                    
                    If Worksheets(1).Cells(1, headerColumn).Value <> "Notes" Then
                        sLine = sLine + Worksheets(1).Cells(iRow, iColumn).Value
                    End If
                    'handle next cell in next loop of For
                    iColumn = iColumn + 1
                Else
                    'empty column: remove cell and shift other cells left
                    'keep track of original cell location to get the heading name of the cell
                    'deleting cells is very slow!
                    'Worksheets(1).Cells(iRow, iColumn).Delete (xlShiftToLeft)
                    
                    'handle next cell in next loop of For, not needed if cells are deleted
                    iColumn = iColumn + 1
                End If
            Next headerColumn
            
            sSubject = Replace(sSubject, "|", " ")
            
            'writing to file
            
            f.writeline (Replace(sSubject + "|" + FullName + sLine, "||", "|"))
            f.writeline (Replace(CStr(Worksheets(1).Cells(iRow + 1, 1).Value), vbTab, " "))
            f.writeline ("")
            iRow = iRow + 2
        Next iRow
        
        'Close export file
        f.Close
        
        Application.ScreenUpdating = True
        ' turns off screen updating
        Application.DisplayStatusBar = True
        ' makes sure that the statusbar is visible
        MsgBox "Babylon file prepared in " + sFile
    End Sub


  5. Close Visual Basic editor

  6. Run the created Macro: Menu 'Developer' -> 'Macro' –> 'ConvertOutlookContactsToBabylon'

  7. A file called 'c:\Contacts.gls' will be created on your C: drive

  8. Open BabylonBuilder.exe and open the gls file 'c:\Contacts.gls': Menu 'File' -> 'Open' (The new version of BabylonBuilder can also be used to compile .gls to .bgl)

  9. Press 'Edit screen'

  10. Press 'Build screen'

  11. Press 'Build'

  12. A file called 'Contacts.bgl' file will be created, this is the compile Babylon dictionary.

  13. Double click the 'Contacts.bgl' file to load it into Babylon

  14. Use Babylon to search on any contact and immediately see all contact details.

Monday, February 16, 2009

First post


My first post here...still playing around with blogger options etc.
Some interesting stuff should come soon...