Scripting Resources for DigitalMicrograph™


Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio | Private | Search


Example: Image Filter Control Commands
An example script which shows how to set the GIF drift tube voltage, and aloso lists the script commands which can be used to control the Gatan Image Filter.
20040302, v1.0
D. R. G. Mitchell
System Requirements
Requires a GIF to be attached to the microscope with communications working.
Known Issues
Only the first five lines of this 'script' do anything - they set the Drift Tube to 99 volts. The remainder of the script is a listing of the commands which can be used to control the GIF.
Included Files
Main script file.
Source Code

// example to show the use of the commands to

// set the status (on/off) and voltage of the imaging filter drift tube

// in this case the script turns the drift tube on and sets it

// to 99 volts



number volts=99



okdialog("Drift Tube is "+volts)




// All the Imaging filter commands are detailed in the Gatan Imaging Filter User Guide

// under IF Control. Not everyone has this so the commands are reproduced here.

// Also the old Mac manual incorrectly describe the drift tube commands - those shown

// here are correct

// version:20040302

// (remove the nospam to make this email address work)

// D. R. G. Mitchell, , March 2004


//other universal imaging filter commands include:


number IFsetImageMode(void)

number IFIsInImageMode(void)

number IFSetEELSMode(void)

number IFIsInEELSMode(void)

number IFSetEnergyLoss(number energyloss)

number IFGetEnergyLoss(number energyloss)

number IFGetBeamEnergy(number beamenergy)

number IFSaveConfiguration(void)

number IFRestoreConfiguration(void)

number IFSetSlitWidth(number slitwidth)

number IFSetSpectrumFocus(number focusvalue)

number IFGetSpectrumFocus(number focusvalue)

number IFIlluminateSSC(void)


// filter commands specific to the GIF



most of these commands occur as pairs of commands with the general form


number IFGet*******(void)




void IFSet*******(number thevalueoftheparameter)



number IFCGetEnergy(void)

void IFCSetEnergy(number energy_eV)


for brevity only the 'Get' command is shown but remember the 'Set' will have the

form detailed above. Getting or setting on/off conditions - the values are boolean

1 = on, 0 = off


number IFCGetEnergyShift(void)

number IFCGetSpectrumOffset(void)

number IFCGetOffsetOn(void)

number IFCGetSlitWidth(void)

number IFCGetSlitIn(void)

number IFCGetTVIn(void)

number IFCGetFilterMode(void)

number IFCGetReductionType(void)

number IFCGetReductionType(number index)

(0,1,2 correspond to no reduction, magnification reduction and camera length reduction respectively)

number IFCGetNumberOfReductions(void)

number IFCGetActiveReduction(void)

number IFCGetNumberofDispersions(void)

number IFCGetActiveDispersions(void)

number IFCGetAperture(void)

number IFCGetDriftTubeVoltage(void)

note the above command only works when the drift tube is actually on. turn in on with

void IFCSetDriftTubeOn(number boolean)