
// Script function: Find image with an ID.


// Unless named starting with GlobalSino, EM, My, Self, the function commands are defined 
//by Gatan DM, please see at link: http://www.globalsino.com/EM/page2597.html


image img1, img2

if ( !GetFrontImage( img1 ) )
 Throw( "No image displayed." )

number MyFrontID = ImageGetID( img1 )

number MySearchID

if ( !GetNumber( "Select image with ID:", MyFrontID, MySearchID ) )

 Throw( "User pressed cancel." )

img2 := FindImageByID( MySearchID )

if ( !ImageIsValid( img2 ) )
 Throw( "No image of ID '" + MysearchID + "' found." )

SetName(img1, "The front most image")
SetName(img2, "Found image with the selected ID")

