Saved Bookmarks
| 1. |
Solve : print record of minimized Word documents?? |
|
Answer» Quote from: Sidewinder on NOVEMBER 08, 2010, 05:32:32 AM The MRU is stored in the registry. Unfortunately it is stored as a sequence of null-terminated strings which I could not figure out how to represent in a batch file. This little snippet of VBScript code may help: Uhmm this looks complex for me. Is there any simpler explanation? Thanks. Wow! This is your lucky day. Today, and today only, explanations are just 5¢ and simpler explanations are just 7¢. As usual the script is free. Quote Const HKEY_CURRENT_USER = &H80000001 Assigns the registry key to various variables. The registry key is specific to Word 2003 and will be different for other versions. Also designates the local computer to do the processing. Quote Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ This is the heart of the script. Connects to the WMI class which contains the properties and methods needed to access the Windows registry. The MRU is a sequence of null-terminated strings, which the GetMultiStringValue returns as an array. Arrays are easy to process in VBScript, a registry sequence of null-terminated strings not so much. Quote If arrValues(0) = "" Then If the MRU is empty, this error trap will allow for a gentle landing instead of the script CRASHING into the side of a mountain. Well maybe not so dramatic, but if you have an empty MRU you'll see the results from this code. Quote If Right(LCase(WScript.FullName), 11) = "cscript.exe" Then This code formats the output returned in the array of MRU items. It queries which interpreter is being used (VBScript has two) and takes advantage of how the echo instruction works in each. And there you have it. Please pay the cashier on your way out. Good luck. |
|