Archive for September, 2011
As you all already read during last day, Microsoft showed Windows 8 at it’s Build conference. There are big changes in OS and I am sure there will be tons of articles about it. But for PowerShell enthusiasts in means something else. PowerShell version 3 is a part of new OS
Today, lot of people mentioned the most obvious changes/news/thoughts. To name a few:
- Dmitry Sotnikov – First Glimpse at PowerShell v3
- Jonathan Medd: PowerShell v3 – A Quick First Look and PowerShell ISE v3 – Now With IntelliSense
- @Jaykul – had some great tweets about short (and clever as usual) hints
After first check, I like following points:
- IntelliSense in ISE – it works in both - Script Pane and Command Pane. Watch different icons for different types.
- Commands Add-on in ISE - for me it looks like great tool for people new to PowerShell. They are able to see all possible parameters at one place and can easily fill/add it to current session. It contains question mark button which opens help for active cmdlet. When you fill all necessary parameters, you can insert result to your session. Unfortunately – it looks to me that it fully works only for cmdlets from core modules (Microsoft.PowerShell.*) and not for functions.
- Support for #region, #endregion in ISE – collapsible.
- ISE also support collapsing of expressions in brackets. As you can see on the picture it’s also highlighting matching braces.
- New way how modules loading work. You can use tab completion for functions even the module is not loaded. Again one point – what I tested till now it looks that it not work for script module (but need to test more with Export-ModuleMember).
- There is a module CimCmdlets - have to check it as it should be useful for my work.
Unfortunately I had to work today, so had not as many time as I wanted for some searching Fortunately – will have holiday for next three weeks, so there will be enough time for other posts.
It’s a year now since I bought Kindle for me. I have it still with me and frequently need to check PowerShell documentation. It led me to previous articles (1st and 2nd part) where I described in general, how to convert CHM file to MOBI. As I needed to automate it a bit, I created simple module for conversion process. Whole process is simple:
- Download ZIP file and unzip in to your module folder.
- Import module to your session (Import-Module chm2mobi).
- Run Convert-ChmToMobi <your_chm_file>.
- Copy MOBI to your e-reader and enjoy
To run it successfully, you need to have kindlegen installed on your computer and need to set alias kg to point to EXE file. On my PC I did it this way:
: Get-Alias kg | ft -auto CommandType Name Definition ----------- ---- ---------- Alias kg Dropbox:\Ruzne\KindleGen\kindlegen.exe
This is example output when generating file for PowerShell help topics (I recommend to use -Verbose parameter so you’ll see actual state of processing):
: Convert-ChmToMobi .\PSHelp.chm *********************************************** * Amazon.com kindlegen(Windows) V1.1 build 99 * * A command line e-book compiler * * Copyright Amazon.com 2010 * *********************************************** opt version: try to minimize (default) Info(prcgen): Added metadata dc:Title "Title" Info(prcgen): Added metadata dc:Date "2011/09/11" Info(prcgen): Added metadata dc:Creator "moravec" Info(prcgen): Added metadata dc:Subject "Subject" Info(prcgen): Added metadata dc:Description "Description" Info(prcgen): Parsing files 0000374 Warning(prcgen): <INPUT>, <SELECT> or <TEXTAREA> tag does no Info(prcgen): Resolving hyperlinks Info(prcgen): Resolving start reading location Info(prcgen): Added metadata Start reading "5098" Info(prcgen): Computing UNICODE ranges used in the book Info(prcgen): Found UNICODE range: Basic Latin [20..7E] Info(prcgen): Found UNICODE range: General Punctuation - Windows 1252 [201C..201E] Info(prcgen): Found UNICODE range: Latin-1 Supplement [A0..FF] Info(prcgen): Building MOBI file, record count: 0001986 Info(prcgen): Compiling HTML Parser restart information Info(prcgen): Final stats - text compressed to (in % of original size): 040.46% Info(prcgen): The document identifier is: "Title" Info(prcgen): The file format version is V6 Info(prcgen): Saving MOBI file Info(prcgen): MOBI File successfully generated!
There are still some points I need to update or change. For example:
- Easily add own Subject and Description.
- Resolve problems when kindlegen alias not presented.
- Add more control over generating files – generate only some files.
- Not show kindlegen output when not requested.
- Remove files at the end when requested.