function snap_view()
{
var browser = [BrowserController sharedBrowserController];
var tab = [browser tabController];
var doc = [tab activeTabDocument];
var view = [doc frontView];
UIGraphicsBeginImageContext(view.frame.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
var img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
var data = UIImagePNGRepresentation(img);
var ok = [data writeToFile:@"/var/tmp/out.png" atomically:NO];
return ok;
}
snap_view();