

// Script function: Setup a password for a DM script


// 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



string EMString = "EMScripts:GlobalSinoPC"
string EMPassword = "123"     // Setup a default, correct password              

string GlobalSinoPassword = ""
GetPersistentStringNote( EMString, GlobalSinoPassword )
if ( GlobalSinoPassword != EMPassword )
{
    string EMEnteredPassword
    if ( !GetString( "Forbidden.\n Enter password:", EMEnteredPassword, EMEnteredPassword ) )
        exit(0)

    if ( EMEnteredPassword != EMPassword )
        Throw( "Invalid password." )

    SetPersistentStringNote( EMString, EMEnteredPassword )  
}

showalert("The entered password is correct, you can continue the calculation!", 2)
