Scripting Resources for DigitalMicrograph™ |
Add Adjustable Scale Marker |
|
Function |
Simple script to add a scale bar to the front-most image |
Version |
version:20060907, v1.0 |
Author |
D. R. G. Mitchell |
Acknowledgements |
- |
Comments |
Hold down the ALT key to get a prompt to set the font size. |
System Requirements |
Should be compatible with all recent versions of DigitalMicrograph. |
Known Issues |
- |
Supported |
Yes |
Included Files |
Main script file. |
Source Code |
// simple script to add a scale bar to an image // with the option key held down, the user is // prompted for the font size
// D. R. G. Mitchell, September 2006 // version:20060907, v1.0 // adminnospam@dmscripting.com (remove the nospam to make this email address work)
image front:=getfrontimage() imagedisplay imgdisp=front.imagegetimagedisplay(0) number nobar=imgdisp.componentcountchildrenoftype(31) number fontsize=48
if (nobar>0) { beep() if(!twobuttondialog("There is a scale bar present already!", "Replace It", "Cancel")) exit(0) }
if(optiondown()) {
if(!getnumber("Enter the font size : ",36,fontsize)) exit(0) }
imgdisp.applydatabar(0)
component scalebar=imgdisp.componentgetnthchildoftype(31,0) scalebar.componentsetfontinfo("Microsoft Sans Serif", 0, fontsize) scalebar.componentsetdrawingmode(1)// set the font to black outlined with whites
|