sachin_a_pawar
Level 4

How to genereate Compressed GUID using InstallScript

Hello,

Following is script to generate compressed guid id from the original guid.

///
/// Converts original GUI to Compressed guid.
///

/// StrReplace(szCompressed,"-","",0);
StrReplace(szCompressed,"}","",0);
StrSub(szSub, szCompressed,0,8);
szReturn = ReverseString(szSub);


StrSub(szSub, szCompressed,8,4);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,12,4);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,16,2);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,18,2);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,20,2);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,22,2);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,24,2);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,26,2);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,28,2);
szReturn = szReturn + ReverseString(szSub);

StrSub(szSub, szCompressed,30,2);
szReturn = szReturn + ReverseString(szSub);

return szReturn;
end;

///
/// Reverse string.
///

/// for nvIndex = 0 to StrLength(szOriginal) - 1
StrSub(szValue, szOriginal, nvIndex, 1);
szReversed = szValue + szReversed;
endfor;
return szReversed;
end;


Hope It helps somebody.

Thanks
Sachin Pawar
Labels (1)
0 Kudos
1 Reply
RobertDickau
Flexera Alumni

As an aside, I believe there's another example at www.installsite.org > Windows Installer > Custom Actions > Darwin Transform and Its Application in Windows Installer Custom Actions.

(Standard caution about using undocumented registry keys instead of MSI API functions.)
0 Kudos