Tag Archives: Windows 7

I like using the Import Pictures and Videos wizard in Windows 7 when transferring pictures from my digital camera because it can create a separate folder for each date. But it lacks the ability to rename the individual files based on date. I want my image filenames to be YYYY.MM.DD_001.jpg, where the trailing number increments for that date.

To get the filename just right, I use Advanced Renamer, a free program for renaming multiple files or folders at once. Advanced Renamer can read information from the image file (like the date the picture was taken).

Importing the images

Connect the device or memory card to your computer. In the AutoPlay dialog box that appears, click Import pictures and videos using Windows.

Windows 7 AutoPlay dialog box

Windows 7 AutoPlay dialog box

The default settings will create a single folder with today’s date, which is not what we want. To change the settings that are used when importing pictures and videos, click Import settings in the Import Pictures and Videos dialog box.

Windows 7 Import Settings dialog box

Windows 7 Import Settings dialog box

Under the Folder name menu, choose Date Taken + Tag and click OK. The import process will restart and you’ll be prompted to enter a tag. The tag isn’t important, so just click Import.

Configuring Advanced Renamer

It takes two methods to get the names the way I want them. The first method changes the filename to use the year, month, and day information, and increment a trailing number. The second method changes the new filename to lowercase. If you prefer your file extensions to be in uppercase, you can skip the second method.

Advanced Renamer - Renaming method list

Advanced Renamer - Renaming method list

Under Add batch method, click New Name, and either select the desired date conventions from the options, adding any separator characters you wish, or copy the code below to use YYYY.MM.DD_001.EXT.

<IMG Year>.<IMG Month>.<IMG Day>_<Inc NrDir:001>.<Ext>

Under Add batch method, click New Case and then choose Set lower case. In the Apply to menu, choose Name and extension.

Click the Add button and browse to the parent folder. The files should appear in the list, and the new filename will be displayed. Check for any errors or problems with the filename, then click Start Batch.

Move the files into a single directory

Now that the pictures are all correctly named, I no longer need them to be in date-based folders. It’s more convenient to have them in a single folder from which I can organize them.

To do this, I use a batch file that moves any files in a sub-folder into the parent folder.

Set sOriginFolder="PATHTOPARENTDIRECTORY"

For /f "Tokens=*" %%a in ('Dir %sOriginFolder% /a-d /s /b') do (
	move "%%a" %sOriginFolder%
)

Replace PATHTOPARENTDIRECTORY with the full path to the parent folder, then run the batch file.

That’s it. Now I have a single folder of images that are uniquely named according to date taken.

Update 5.5.11: I’ve written a better macro that doesn’t require a separate batch file and registry merge file. Please check out the new post at:

Programmatically re-enabling Word COM add-ins

A few months ago, I wrote a post on fixing Word 2007 add-in issues with a registry merge. In this post, I’ll take that idea a little further and explain how to automatically detect and fix add-ins through the use of a macro that runs each time Word is opened and a batch file that runs the registry merge file. All the end-user needs to do to repair the missing functionality is close and reopen Word.

The idea is that, in a corporate environment, there are certain important add-ins that must be running in order for Word to work normally. A good example would be an add-in that integrates Word with a document management system. Should that integration be lost because the add-in failed to load, data may be lost. Because there is no way to force Word to load certain add-ins, and there is no built-in function in Word for warning users when critically important don’t load, I decided to come up with a method for alerting the user to the problem and then fixing it with as little inconvenience as possible.

The example code in this post assumes the workstation is running Office 2007 on Windows XP (32-bit). I would think that the method could be adapted to other environments (Windows 7, Office 2010) without too much trouble. I’ve tried to note where differences come up on Windows 7 and 64-bit operating systems.

The process has four components:

  • an autoexec Word 2007 macro that runs each time Word is opened
  • a batch file that runs the registry merge file and writes an entry to a log file
  • the registry merge file that contains the correct LoadBehavior settings for the add-ins
  • a text file that acts as a log

The macro can be added to Normal.dotm or saved to a new .dotm file placed in the startup directory. The .bat batch file, .reg registry file, and .txt log file can be put anywhere, but in this example, they will be saved to a new folder C:Word Add-ins fix.

In the code examples below, I’ll be using the Acrobat PDFMaker Office COM Addin as the add-in that must always be loaded. This plugin is installed with Acrobat versions 8.1 and above and adds an Acrobat tab to the ribbon.

The macro

The first thing to do is to collect some information on the COM add-ins that are currently installed. Microsoft Support provides a simple macro for listing all of the COM add-ins at Some COM add-ins are not listed in the COM Add-Ins dialog box in Word. I recommend using this macro to identify the ProgID of your add-ins. The text to the left of the hyphen is the add-in’s Description and the text to the right of the hyphen is the ProgID.

Running the macro from the Microsoft site shows us that the ProgID for the Acrobat PDFMaker Office COM Addin is PDFMaker.OfficeAddin.

In Microsoft jargon, an add-in with a LoadBehavior of 3 is ‘Connected’. The COMAddIn object has a property called Connect that will be True if the add-in is Connected and False if it is not. The macro first checks the Connect property of each add-in and writes the ProgID of each Connected add-in to a string. It then checks to see if the string contains a match for each of the required add-ins. If the required add-in does not exist in the string, the macro will display a message to the user and fire the batch file to reset the LoadBehavior. It also passes the names of any not connected add-ins to the batch file as a parameter, so that information can be logged.

I found this article from MSDN on the COMAddIn object very helpful.

Sub AutoExec()
'
' FindMissingAddins Macro
' Display a message box with any critical but not 'Connected' COM add-ins
'

   Dim msg As String
   
   Dim MyAddin As COMAddIn
   Dim i As Integer, stringOfAddins As String
   
   For Each MyAddin In Application.COMAddIns
      If MyAddin.Connect = True Then
          stringOfAddins = stringOfAddins & MyAddin.ProgID & " - "
      End If
   Next
   
' Update the number of elements in the array
' Example: change to "requiredAddIns(0 To 4)" if you were checking 5 total add-ins)
   Dim requiredAddIns(0 To 0) As String
   
' Add each required AddIn to the array
   requiredAddIns(0) = "PDFMaker.OfficeAddin"
'   requiredAddIns(1) = ""
'   requiredAddIns(2) = ""
'   requiredAddIns(3) = ""
'   requiredAddIns(4) = ""
   
   For Each requiredAddIn In requiredAddIns
      If InStr(stringOfAddins, requiredAddIn) Then
         msg = msg
      Else
         msg = msg & requiredAddIn & vbCrLf
         listOfDisconnectedAddins = requiredAddIn & " " & listOfDisconnectedAddins
         listOfDisconnectedAddins = Trim(listOfDisconnectedAddins)
      End If
   Next
   
   If msg = "" Then
   Else
        MsgBox "The following important add-ins are not running: " & vbCrLf & vbCrLf & msg & vbCrLf & vbCrLf & "Please save your work, then close and reopen Word."
' Run a batch file that corrects the add-in problems in the registry and pass the list of unconnected add-ins as an argument
        Shell """C:Word Add-ins fixfixWordAddins.bat"" """ & listOfDisconnectedAddins & """"
   End If
   
End Sub

Edit the macro to fit your environment. You will need to specify each required add-in’s ProgID in the requiredAddIns array and update the number of add-ins in the array’s definition. The macro needs to be named AutoExec in order to run when Word starts.

This is the message that the user will receive if the macro finds that a required add-in is not Connected.

Clicking OK runs the batch file and closes the window.

The batch file

The batch file is called by the macro when any of the add-ins are not registered and currently connected. The batch file references the .reg file that contains the correct LoadBehavior settings and writes an event to the log with information on the username, the machine name, the datetime that the problem was discovered and which add-in(s) were not connected.

Copy the code and save it as fixWordAddins.bat to the C:Word Add-ins fix directory or wherever you want.

:: A batch file for running a registry merge to set the LoadBehavior for Word add-ins
::
@echo off

REGEDIT /S "C:Word Add-ins fixfixWordAddins.reg"

:: Let's create a little log file and output which user ran the script and at what date and time
:: Set some variables for the date. US format - not localized!
@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @( 
	Set Month=%%A
	Set Day=%%B
	Set Year=%%C
)

:: Set some variables for the time.
@For /F "tokens=1,2,3 delims=/: " %%A in ('Time /t') do @( 
	Set Hours=%%A
	Set Minutes=%%B
	Set Meridiem=%%C
)

:: Output to a log file
@echo %username% at %computername% on %Month%/%Day%/%Year% at %Hours%:%Minutes% %Meridiem% (%1) >> "C:Word Add-ins fixlog.txt"

The registry merge

Add-ins can be ‘hard-disabled’ or ‘soft-disabled’ by Word 2007. Please see my post at fixing Word 2007 add-in issues with a registry merge for more information about what this means. The following registry merge will address both issues.

The registry merge will have to be edited for your environment, too. First, find the LoadBehavior value in the the registry for each of your add-ins in either of two locations:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftOfficeWordAddins
HKEY_CURRENT_USERSoftwareMicrosoftOfficeWordAddins

If you don’t find your add-in in either of those locations, search the registry for the ProgID.

A LoadBehavior of 3 = loaded (this corresponds to a checked box in Word Options/Add-Ins)
A LoadBehavior of 2 = not loaded (this corresponds to an unchecked box in Word Options/Add-Ins)

The only add-ins that you need to worry about here are those that you want to always run (those that normally have a LoadBehavior of 3). Export those keys and add them to the .reg file.

Copy the code and save it as fixWordAddins.reg to the C:Word Add-ins fix directory or wherever you want. Edit it for the add-ins you wish to load.

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USERSoftwareMicrosoftOffice12.0WordResiliency]

[-HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice12.0WordResiliency]

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftOfficeWordAddinsPDFMaker.OfficeAddin]
"LoadBehavior"=dword:00000003

On 64-bit versions of Windows, the add-ins can be found in:
HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftOfficeWordAddins

The log file

If the log file doesn’t already exist, the batch file will create it. Each time the batch file runs, it adds a line to the end of the log file.

An entry will look something like this:

USERNAME at MACHINENAME on 06/17/2010 at 01:02 PM ("PDFMaker.OfficeAddin")

Caveats

The macros in a *.dotm can’t be edited if that template was opened from the startup location. Open a copy in another location, make your changes and save, and then overwrite the version in the startup location.

Windows 7

Note that in Windows 7, the UAC needs your permission to run a .bat file.

The Word startup location in Windows 7 (put any custom *.dotm files here):
AppDataRoamingMicrosoftWordSTARTUP

The default location of Normal.dotm in Windows 7:
AppDataRoamingMicrosoftTemplates

These are from my notes that I took when setting up IIS 7.5 on Windows 7. It’s not supposed to be a how-to, exactly. It’s just what I need to do to get my dev server up and running classic .ASP pages.

Install IIS via Control Panel -> Programs and Features -> “Turn Windows features on or off”.

Click the box next to Internet Information Services. It will become blocked, not checked, indicating some but not all features are installed. Click OK.

Once Windows has installed IIS, browse to http://localhost/ to confirm the server has started.

If you browse to an .asp page, though, you’ll get a Server Error:

HTTP Error 404.3 – Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

To enable the server to run classic .ASP pages, go back to Control Panel -> Programs and Features -> “Turn Windows features on or off”, then expand Internet Information Services -> World Wide Web Services -> Application Development Features. Check the box next to ASP, then click OK.

Parent Paths is disabled by default on IIS 7.5. To enable it, run the following command as administrator:

%systemroot%system32inetsrvAPPCMD set config "Default Web Site" -section:system.webServer/asp /enableParentPaths:"True" /commit:apphost

Credit: http://learn.iis.net/page.aspx/566/classic-asp-parent-paths-are-disabled-by-default/

Classic ASP script error messages are no longer shown in the web browser by default on IIS 7.5. Misconfigurations are hard to troubleshoot, because IIS returns only:

An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.

To enable sending detailed ASP script error messages to the Web browser (as was the case in IIS 6), run the following command as administrator:

%windir%system32inetsrvappcmd set config -section:asp -scriptErrorSentToBrowser:true

Credit: http://blogs.iis.net/bills/archive/2007/05/21/tips-for-classic-asp-developers-on-iis7.aspx

To start the default web site from the command line, run the following command as administrator:

%systemroot%system32inetsrvAPPCMD start site "Default Web Site"

To stop the default web site from the command line, run the following command as administrator:

%systemroot%system32inetsrvAPPCMD stop site "Default Web Site"

Even better, you can make shortcuts to batch files that contain those commands, and then set the shortcuts to always run as administrator.

The c:/inetpub/wwwroot directory is UAC protected. If you are going to leave UAC on (and it’s recommended that you do), you will probably want to change the permissions on the wwwroot folder so that you don’t have to click through a prompt each time you change a file.

The IIS Manager app is located at Control Panel -> Administrative Tools -> Internet Information Services (IIS) Manager.

As an IT guy in a good-sized law firm, I’m sometimes asked to make recommendations for anti-virus software.

For real-time protection that is always running on your computer, I like Microsoft Security Essentials.

Microsoft Security Essentials provides real-time protection for your home PC that helps guard against viruses, spyware, and other malicious software.
http://www.microsoft.com/security_essentials/default.aspx

If you don’t trust Microsoft, SUPERAntispyware has a terrible name but a good track record.

The SUPERAntiSpyware FREE Edition offers real-time blocking of threats.
http://www.superantispyware.com/

The SUPERAntiSpyware Portable Scanner can be run from a USB flash drive or CD without installlation.

The SUPERAntiSpyware Portable Scanner does not install anything on your Start Menu or Program Files and does not need to be uninstalled. Just download it and run it whenever you want.
http://www.superantispyware.com/portablescanner.html

Personally, I run Microsoft Security Essentials, and then do supplemental scans with the SUPERAntiSpyware Portable Scanner.

Update 2013.1.3: I’ve received a DMCA takedown notice about this page, and so I’ve removed the links to the torrents, which were out-of-date anyway.
Update 2011.5.31: ISOs of updated versions of Windows 7 with SP1 have been made available to Microsoft TechNet and MSDN subscribers. I’ve posted a link to the torrent in my post about the Windows 7 with SP1 (media refresh).

This article explains how to obtain leaked, legitimate ISOs of Windows 7 (both x86 and x64 versions), and create a bootable USB drive that can install any edition (though only Home Premium through Ultimate are recommended). It wraps up with a neat trick to extend the 30-day pre-activation ‘evaluation period’ to 120 days. This article assumes that you intend to purchase your software eventually. It does not tell you how to obtain a product activation key or circumvent activation.

Step 1: Get the RTM Windows 7 release

Windows 7 RTM is build version 6.1.7600.16385. This version was released to Microsoft TechNet and MSDN subscribers in the summer of 2009 and quickly made its way onto BitTorrent.

64-bit (x64) Windows 7 Ultimate RTM English Retail DVD ISO Image

File Name: 7600.16385.090713-1255_x64fre_client_en-us_Retail_Ultimate-GRMCULXFRER_EN_DVD.iso
Size: 3224686592 bytes
CRC: 1F1257CA
MD5: F43D22E4FB07BF617D573ACD8785C028
SHA-1: 326327CC2FF9F05379F5058C41BE6BC5E004BAA7

32-bit (x86) Windows 7 Ultimate RTM English Retail DVD ISO Image

File Name: 7600.16385.090713-1255_x86fre_client_en-us_Retail_Ultimate-GRMCULFRER_EN_DVD.iso
Size: 2501894144 bytes
CRC: C1C20F76
MD5: D0B8B407E8A3D4B75EE9C10147266B89
SHA-1: 5395DC4B38F7BDB1E005FF414DEEDFDB16DBF610

Below are the official SHA1 hashes of these releases copied and pasted from technet.microsoft.com. I’ve checked them against the actual files from the torrents and they match.

64-bit Windows 7 Ultimate
File Name: en_windows_7_ultimate_x64_dvd_x15-65922.iso
Date Published (UTC): 8/6/2009 9:59:56 AM Last Updated (UTC): 8/24/2009 8:59:33 AM
SHA1: 326327CC2FF9F05379F5058C41BE6BC5E004BAA7 ISO/CRC: 1F1257CA

32-bit Windows 7 Ultimate
File Name: en_windows_7_ultimate_x86_dvd_x15-65921.iso
Date Published (UTC): 8/6/2009 9:59:56 AM Last Updated (UTC): 8/24/2009 8:59:33 AM
SHA1: 5395DC4B38F7BDB1E005FF414DEEDFDB16DBF610 ISO/CRC: C1C20F76

As a general rule, don’t download just any torrent that you come across, and do use a hash calculator (like HashCalc) to verify that the hash of the file you’ve downloaded matches that posted by a trusted source. Download the file, calculate the hash, copy it, find a trustworthy web site (like microsoft.com) that displays the hash, and then do a Find in your browser on that page for the hash you’ve copied. If the hash you calculated matches the hash displayed on the web site, you can trust the file is legit.

Step 2: Prepare the USB drive

You’ll need a 4 GB flash drive to hold the installation files. Microsoft offers a neat little program that will extract the ISO to a USB drive and make it bootable. It can also burn the ISO to a DVD. Download the Windows 7 USB/DVD Download Tool.

If you’re currently using a 32-bit version of Windows XP or Vista and want to create a bootable USB drive containing the 64-bit (x64) version of Windows 7, you’ll need to obtain the bootsect.exe file from the 32-bit (x86) version of Windows 7.

If you want to get this file yourself, first download the 32-bit ISO. You can use any number of applications to open the ISO, but I recommend 7-Zip because it’s a great free alternative to WinZip. Open the ISO and then copy the /boot/bootsect.exe file into the same folder as the Windows7-USB-DVD-Download-Tool.exe (e.g. %USERNAME%AppDataLocalAppsWindows 7 USB DVD Download Tool).

If that’s too much work, you can Google 32-Bit Windows 7 Bootsect.exe and take your chances.

Run the tool (%USERNAME%AppDataLocalAppsWindows 7 USB DVD Download ToolWindows7-USB-DVD-Download-Tool.exe) and follow the prompts. After Windows 7 has been loaded on the USB drive, you will be able to boot from it and install Windows 7 Ultimate. (You may have to change the boot order in the BIOS to boot from USB Storage Device.)

Step 3: Configure the installer

What if you want to install an edition other than Ultimate?

Both the 32-bit and 64-bit ISOs contain all the different editions of Windows. The edition you actually install is determined by a tiny text file named ei.cfg in the /sources/ directory of the install media. If you want to install a different edition of Windows, you just need to browse the USB drive and open the /sources/ directory. Open the ei.cfg file in Notepad and change the EditionID to whatever edition you wish to install. The contents of the file will look like this:

[EditionID]
Ultimate
[Channel]
Retail
[VL]
0

The options for the EditionID are:

  • Starter
  • HomeBasic
  • HomePremium
  • Professional
  • Ultimate

In the alternative, if you delete ei.cfg, you’ll be asked to choose which edition of Windows to install during the installation process, which is probably much more useful.

For more information and links to some software that will modify the ISO for you, see How to Select Any Edition or Version (SKU) of Windows 7 to Install From Single Edition DVD Disc Media or ISO.

I would strongly recommend installing the edition that you intend to purchase, as you cannot enter a Home Premium product activation key on a system running Ultimate. You’d have to do a clean install of the edition that matches the key you bought.

Step 4: Extend your pre-activation trial for 120 days

Microsoft allows anyone to install and use any version of Windows 7 for 30 days without having to enter a product activation key. This 30-day trial period can be extended three times for a total of 120 days before the installation must be activated to continue functioning. This extension is done using a Microsoft utility called the Software License Manager (slmgr) that ships with Windows.

If you haven’t entered a product activation key, you can click Start, then right-click Computer and choose Properties to see how many days are left before activation is required. When that number approaches 0, click Start | All Programs | Accessories. Right-click Command Prompt and choose Run As Administrator. Enter your administrator password, if asked.

Type the following command and press Enter:

slmgr -rearm

Be sure to include the space after slmgr and the hyphen in front of rearm.

Restart Windows 7.

In Summary

The last days of Windows 7 RC are approaching, and I’m probably going to end up buying Home Premium. Professional would be my first choice, but it’s probably not really necessary. However, after using Ultimate for so long, I want to know that I’ll be able to get by with a reduced feature set, so I definitely want to test-drive Professional and then Home Premium before I buy.

I’m using Windows 7, trying to transfer photos from my digital camera to my laptop for the second time, but the Import Pictures and Videos wizard won’t let me. After I connect my camera and choose ‘Import pictures and videos’ from the AutoPlay dialog box, I get a message from the Import Pictures and Videos wizard that ‘No new pictures or videos were found on this device’.

Although it would have been simple to just treat the camera as a mass storage device and browse the files in Explorer, I wanted to use the wizard to create a folder for each date. Why can’t we have a button to import the same images again and again, as many times as we want?

Disconnecting and reconnecting the device didn’t help, and deleting the files and containing folder from my computer didn’t do it, either. Obviously, something was keeping track of which images were being transfered. So I started digging around and found this interesting hidden file in my user folder:

C:Users[username]AppDataLocalMicrosoftPhoto AcquisitionPreviouslyAcquired.db

I renamed it to PreviouslyAcquired.db.old, then reconnected the camera and went through the wizard again, where I was able to import the pictures a second time.

As noted in the comments below, you need to turn on Show hidden files, folders, and drives in Windows’ Folder Options dialog box in order to see the PreviouslyAcquired.db file.