Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 Location: Tampa, FL Thanks: 28 times Was thanked: 416 time(s) in 354 post(s)
|
This will create an HTML document on the clipboard. You can then paste it into a .html file. Could also modify the script to save the HTML file instead of putting it on the clipboard.
Code://Creates HTML document and copies to clipboard
//Could change to save to a file
//Setup column headings
var output = '<html><head><meta charset="utf-8"/></head><body><table border="1"><tr><th>Application</th><th>Action</th><th>Button</th><th>Gesture Name</th><th>Thumbnail</th><th>Count</th></tr>\n';
var height = 80;
//First, just the overall match counts for each gesture, regardless of application/action
var gestures = sp_config.Gestures.Where(g => g.Active).OrderBy("MatchCount desc").ToArray();
for(i = 0; i < gestures.Length; i++)
{
var memStream = new clr.System.IO.MemoryStream();
//GetImage signature: GetImage(int size, int padding, int lineWidth, object lineArrowWidth, Color lineColor, Color bgColor)
gestures[i].PointPatterns.First().GetImage(height - 10, 15, 4, 4, Color.Blue, Color.White).Save(memStream, drawing.System.Drawing.Imaging.ImageFormat.Png);
output += '<tr style="height:' + height + ';"><td></td><td></td><td></td><td>' + gestures[i].Name + '</td><td><img src="data:image/png;base64,' + clr.System.Convert.ToBase64String(memStream.ToArray()) + '" /></td><td>' + gestures[i].MatchCount + '</td></tr>\n';
memStream.Dispose();
}
//Next, add rows for Global Actions
var globalActions = sp_config.GlobalApplication.Actions.Where(a => a.Active).OrderBy("MatchCount desc").ToArray();
for(i = 0; i < globalActions.Length; i++)
{
var gestureImage = '(none)';
if(globalActions[i].GestureName !== '')
{
var gesture = sp_config.Gestures.Where(g => g.Name == globalActions[i].GestureName).First();
var memStream = new clr.System.IO.MemoryStream();
//GetImage signature: GetImage(int size, int padding, int lineWidth, object lineArrowWidth, Color lineColor, Color bgColor)
gesture.PointPatterns.First().GetImage(height - 10, 15, 4, 4, Color.Blue, Color.White).Save(memStream, drawing.System.Drawing.Imaging.ImageFormat.Png);
gestureImage = '<img src="data:image/png;base64,' + clr.System.Convert.ToBase64String(memStream.ToArray()) + '" /></td>';
memStream.Dispose();
}
output += '<tr style="height:' + height + ';"><td>Global Actions</td><td>' + globalActions[i].Description + '</td><td>' + (globalActions[i].UseSecondaryStrokeButton ? 'Secondary' : 'Primary') + '</td><td>' + globalActions[i].GestureName + '</td><td>' + gestureImage + '<td>' + globalActions[i].MatchCount + '</td></tr>\n';
}
//Finally, each Application
var applications = sp_config.Applications.Where(a => a.Active).OrderBy("Description").ToArray();
for(i = 0; i < applications.Length; i++)
{
var appName = applications[i].Description;
var appActions = applications[i].Actions.Where(a => a.Active).OrderBy("MatchCount desc").ToArray();
for(j = 0; j < appActions.Length; j++)
{
var gestureImage = '(none)';
if(appActions[j].GestureName !== '')
{
var gesture = sp_config.Gestures.Where(g => g.Name == appActions[j].GestureName).First();
var memStream = new clr.System.IO.MemoryStream();
//GetImage signature: GetImage(int size, int padding, int lineWidth, object lineArrowWidth, Color lineColor, Color bgColor)
gesture.PointPatterns.First().GetImage(height - 10, 15, 4, 4, Color.Blue, Color.White).Save(memStream, drawing.System.Drawing.Imaging.ImageFormat.Png);
gestureImage = '<img src="data:image/png;base64,' + clr.System.Convert.ToBase64String(memStream.ToArray()) + '" /></td>';
memStream.Dispose();
}
output += '<tr style="height:' + height + ';"><td>' + appName + '</td><td>' + appActions[j].Description + '</td><td>' + (appActions[j].UseSecondaryStrokeButton ? 'Secondary' : 'Primary') + '</td><td>' + appActions[j].GestureName + '</td><td>' + gestureImage + '</td><td>' + appActions[j].MatchCount + '</td></tr>\n';
}
}
output += '</table></body></html>';
//Put HTML on clipboard
clip.SetText(output);
|