Monday, September 23, 2013

Set default installation directory for Dynamics GP in installscript

Installscript function
prototype setINSTALLDIR();
function setINSTALLDIR()   
string result;
string key1, key2;
string value;
number size;
number type;
string version;
    //Change version to whatever version the installer is for  
    version = "v11.0";        

//this finds it in a 32-bit environment
    key1 = "SOFTWARE\\Microsoft\\Business Solutions\\Great Plains\\" + version + "\\1033\\DEFAULT\\SETUP";

//this finds it in a 64-bit environment
    key2 = "SOFTWARE\\Wow6432Node\\Microsoft\\Business Solutions\\Great Plains\\" + version + "\\1033\\DEFAULT\\SETUP";
    value = "AppPath";  
    if(RegDBGetKeyValueEx(key1, value, type,result,size) = 0)then
        INSTALLDIR = result;
    elseif(RegDBGetKeyValueEx(key2, value, type,result,size) = 0)then
        INSTALLDIR = result;

Call it from OnFirstUIBefore, for example:
function OnFirstUIBefore( )

    NUMBER nResult, nSetupType;
    STRING szTitle, szMsg, svName, svCompany, svSerial;
    STRING szDir, strNum;
    BOOL bLicenseAccepted;


    nSetupType = TYPICAL;  
    szDir = INSTALLDIR;
    svName    = "";
    svCompany = "";

No comments:

Post a Comment

There was an error in this gadget