OneShot

April 23, 2011

Introduction:

OneShot is a small Windows application that is easy to use and automates generation of full desktop jpg images. OneShot is a single-click application that captures desktop images in a manner suitable for DLNA (Digital Living Network Alliance®) streaming to an HDTV. This application can be used in a variety of different ways, limited only by your imagination. Although OneShot can be used with any version of Windows with the .NET Framework 3.5+ installed, it was designed specifically with Win7 and DLNA streaming in mind.

    Download OneShot.zip v 1.2.1.0 (73,888 bytes) (.NET 3.5+ required)


Configuring and Using OneShot:

OneShot.exe is a compiled C#.net application. OneShot requires .NET Framework runtime 3.5 or higher installed (included with Win7; easily installed on WinXP, Vista etc.). OneShot does not install any other dependencies, modify the registry or change the Windows OS in any way. It is self contained in one easy to use folder.

To use OneShot, follow these steps:

(1) download and unzip the oneshot.zip archive to any location. The Windows desktop is a convenient location.
(2) the unzipped folder is called OneShot. This folder initially contains 4 files: (3) open the OneShot folder
(4) drag (hold the left mouse-button down) and drop the oneshot.exe application to the Windows taskbar in the Quick Launch area to create a launch shortcut there. (Hint: Place it as the first of the Quick Launch icons; this will be very convenient for full-screen window snapshoting, as described below.)
The OneShot shortcut icon:

Now, OneShot is ready to use!
A black console window briefly flashes on the screen and disappears, providing a cue that OneShot has executed. (A slight time-delay in OneShot guarantees that the console window does not appear in the image.) See the Additional Usage Features below for information on resizing the OneShot images to exactly match the resolution of your HDTV and for other usage tips.


Using DLNA Play To with OneShot Images:

Simply right-click the playto folder and select Play To to add all the files inside this folder to a DLNA "Play To" list, or open the playto folder and select (Ctrl + Click) the files you wish to add to the DLNA "Play To" list and then right-click any of the selected images. Any DLNA compliant devices that are DMR (digital media renderer) will be displayed. For example, the picture below shows my Samsung PN51D6500 HDTV as an available DMR as well as a Western Digital "TV Live" device. For multiple DMR devices, select the DMR you wish to target:



All the image files in the playto folder or the manually selected images will be automatically added to a Win7 "Play To" window and the DLNA streaming to (say) your DLNA compliant HDTV will begin. Of course, the HDTV must be set to allow remote control by a DMC (Digital Media Controller, my laptop computer in this case). Below is a screen shot of my Win7 laptop environment showing the Windows Play to playlist window, the playto file folder and the OneShot shortcut icon positioned at the start of the Quick Launch area:



Note that if the playto folder contains any files other than media types that can be played via streaming (.jpg, .png, .wav, .mp3, .avi etc..), there will be no "Play To" selection available in the right-click context menu.

Below is a digital-camera picture of the HDTV display showing a typical desktop snapshot generated with OneShot and streamed to a Samsung PN51D6500 HDTV. The Win7 desktop image is a full-screened IE web browser window showing part of the product page for this Samsung HDTV. The default image resizing factor of 1.0 was used in this case. Note that with OneShot, it is very easy to scroll a long web page, or any long scrollable document, and rapidly generate many successive numbered jpg images in the playto folder for pushing to a HDTV for convenient display. The image name, pixel dimensions and date are displayed at the top of the HDTV display if the INFO button on the Samsung remote control is pressed.




How OneShot Names the Image Files:

If the playto folder doesn't exist, or is not accessible, a console window displays that status. If the folder exists and is accessible, OneShot examines the existing files in this folder, ignores any files without the .jpg extension, and ignores any files not matching the following pattern:
          p<number>.jpg
After examining the files in the playto folder, OneShot determines the next sequential file name to use. For example if the highest valid file name is p31.jpg, OneShot will create a new image file named p32.jpg. OneShot simply looks for the highest numerical part of the file name (it doesn't matter if existing files have missing number specifiers). The lowest file name is p0.jpg which is the splash-screen image included in the distribution. (This splash-screen can be removed if desired). OneShot creates a new high-quality (low compression) jpg image of the entire windows desktop, in the playto folder, each time it is executed. Clear the playto folder contents anytime to start the image numbering at 0.



Additional Usage Features:

Resizing the OneShot Image Files:

By default, the pixel dimensions of the images created with OneShot are equal to the current screen resolution of the computer display. The text file resize.txt can be easily modified to resize the image size generated. Initially the file specifies a scale factor of 1.0 (no rescaling). OneShot looks for the resize.txt file in the OneShot directory. If the file isn't available, OneShot defaults to no image resizing. OneShot searches for the FIRST number in the text file and interprets that as a scaling factor (e.g. 1.5 scales the image by 50% in both axes). Resizing maintains the image aspect ratio. If no number is found in the resize.txt file, no image resizing is performed. OneShot next determines the final size of the image using the scaling factor. The calculated dimensions of the final image (in either axis) must be greater than 200 pixels and less than 2000 pixels. If outside this range, the image is not resized. See the section below for typical scaling factors. A modern HDTV has a typical maximum image resolution of 1920x1080. Many laptop and desktop computers typically have screen resolutions less than the maximum HDTV value. When jpg images are streamed via DLNA to an HDTV, the images are usually by default displayed at their original pixel size and will not fill the entire HDTV display. Many HDTVs have a "zoom" function which might be x2 and x4 with scrolling capability, but it is often desirable to have the image resized to match the HDTV display in at least one axis.

The table below shows typical computer screen resolutions and the numerical scaling factor to be used with OneShot and 1920x1080 HDTV display settings. Simply modify the resize.txt file in the OneShot folder so that the first number that appears in that file is the Scaling Factor listed below for your situation. (The initial scale factor is 1.0). Other computer screen resolutions are easily calculated. With the correct scaling factor, all dimensions of the original computer screen image will be visible on a full resolution 1920x1080 HDTV while maintaining the aspect ratio of the desktop image (no stretching). With the correct scaling factor, computer monitors with a widescreen aspect ratio (16:9) will fill the HD display in both axes. For other aspect ratios, at least one of the image dimensions is guaranteed to fill the entire display.

Computer Screen SizeAspect RatioScaling Factor
1920 x 108016:91.0
1600 x 90016:91.2
1366 x 76816:91.4
1280 x 72016:91.5
1280 x 10245:41.05
1280 x 7685:31.4
1024 x 7684:31.4
800 x 6004:31.8


Full screen windows snapshot configuration:

Say you wish to take a screenshot of any full-screened application, for example you are viewing a great web page with IE (or a full screened PPT slide show) and you want a snapshot of the contents but not including the distracting top menu bars. Pressing F11 to see IE in full screen mode causes the taskbar to disappear. Nevertheless it is still possible to invoke OneShot. The method you use depends on the WinOS.

About DLNA and Win7 Play to:

Win7 has built-in DLNA support as a DMC (digital media controller) for streaming images and other multimedia files to HDTVs that support DMR (digital media renderer). Many HDTVs have only partial DLNA support as a DMP (digital media player) and can "pull" content from home network shares and other connected devices using the TV's remote control. However, with DMR support, it is often more convenient to "push" content from the laptop computer to your HDTV over a wireless LAN. The newer model Samsung HDTVs with built-in WiFi (no external USB dongles) push the convenience envelope for a wireless sharing environment through a typical home network. For example the 2011 Samsung "Smart TV" models such as the PN51D6500 have excellent support for DLNA (under the Samsung name AllShare®) and built-in WiFi.


Problems with Play To playlist initialization:

It has been noted that sometimes the Win7 DLNA "Play To" window doesn't launch properly and a message "failed to initialize playlist.." appears. It is not clear why this happens (I have observed this), but one solution that has worked for my configuration (Win7 Home Premium updated to 4/2011) is described here: Phantom Playlists in WMP 12 (Win7 Ultimate RTM bits, x64).

I have found that simply following the first step suggested and deleting the .wpl playlist files in %LOCALAPPDATA%\Microsoft\Media Player resolved the problem. In my case, it was NOT nececessary to delete all the *.wmdb database files. The explanation might be a corrupt playlist.



References