IMPORTANT NOTICE: As of 21 February, anything posted in this community WILL NOT BE MIGRATED to our new community site. We have pulled all user information and data from this site and are now in an approximately week long process of importing users, roles, and data to our new site. We are leaving this site open and active so you can post and hopefully get a response until the migration is complete. Once complete, the URL that currently takes you to this site will take you to our new site so your bookmarks will work as always. Please read the information on a New Login Process
CaptureBitmap() method saves a bitmap image to a file and returns the absolute or relative path of the captured bitmap. It is not possible to capture the image in a different format (Eg - JPEG).
However it is possible to convert the bitmap image to jpeg. This is useful as jpeg's normally will be smaller in memory. You can use freeware commandline utility "BMP2JPG" to convert the bitmap and call this from SilkTest using SYS_Execute().This utility can be download from following link:- http://www.microtom.net/?p=619The BMP2JPG command will convert a bmp to jpg. See syntax:.BMP2JPG [Source Directory or File] [Destination Directory or File] [overwrite].You can use this in your SilkTest script to convert your captured bitmap file to jpg and save it to the specified directory. See testcase below:-[-] testcase ConvertToJpg () [ ] TestApplication.SetActive() [ ] TestApplication.CheckBox.Select() [ ] TestApplication.CheckBoxDialog.SetActive() [ ] TestApplication.CheckBoxDialog.CaptureBitmap("C:\Bmptojpg\mybitmap.bmp") //capture image as bitmap [ ] [ ] SYS_Execute("C:\Bmptojpg\ConvertToJpg.bat") //call bat file that converts to jpgThe details of the bat file (C:\Bmptojpg\ConvertToJpg.bat) referenced in the script is listed below;-
cd "c:\Bmptojpg"BMP2JPG "c:\Bmptojpg\mybitmap.bmp" "c:\Bmptojpg\myjpeg.jpg" cls