PDA

View Full Version : IS: Please provide sample code for SdStartCopy



neal007
04-26-2004, 11:30 PM
InstallShield: Please provide the most commonly used code for populating the text box in the SdStartCopy dialog. I really wish you all would at least include the most common scripts and we can then edit/remove rather than struggle to find what's required to populate these dialogs.

I would assume for most the following information would be useful in the SdStartCopy:

Customer Name, Company

Installation Directory

Selected Components/Features

If you could provide this basic "easy" code to you that know InstallScript, that would be a great help. I really only need MSI, but I want the skin feature, so I chose InstallScript MSI to have a more unique look.

Thanks for any help you can assist us happy customers!

sogilvie
04-28-2004, 02:02 PM
Neal,
here is what I do to populate sdstartcopy, my project is an InstallScript MSI Project...

#define STR_DEFTAB " "


function OnFirstUIBefore()
NUMBER nResult, nPathSize, nReserved;
NUMBER nLevel, nvSize, nId, nDataSize, nString;
INT nReqSpace;
STRING szTitle, szMsg, szReqSpace, szFeatures, szId, szOldPath;
STRING szOpt1, szOpt2, szLicenseFile, svComponent, svSubComponent;
STRING szString, szData, szFeatureSet;
BOOL bLicenseAccepted;
LIST listStartCopy, listCompList, listSubCompList, listID;

blah...
blah...
blah...


Dlg_SdStartCopy2:
szTitle = "";
szMsg = @PNL_STARTCPY_MSG;
/* I have placed all of my strings to the resource string.. this one is
"Setup has enough information to start copying %P files. If you want to review or
change any settings, click Back. If you are satisfied with the settings,
click Next to begin copying files." */

listStartCopy = ListCreate( STRINGLIST );

/* Username and Password */
ListAddString( listStartCopy, @PNL_STARTCPY_USERINFO, AFTER ); /* this string is "User Information:" etc... */
ListAddString( listStartCopy, STR_DEFTAB + svName, AFTER );
ListAddString( listStartCopy, STR_DEFTAB + svCompany, AFTER );

/* List Features and subfeatures that have been selected to install */
ListAddString( listStartCopy, "", AFTER );
ListAddString( listStartCopy, @PNL_STARTCPY_FEATURES, AFTER );

/* Now list the component\subcomponent */
listCompList = ListCreate( STRINGLIST );
listSubCompList = ListCreate (STRINGLIST);
FeatureListItems (MEDIA, "", listCompList);
nResult = ListGetFirstString ( listCompList, svComponent );
if FeatureIsItemSelected(MEDIA, svComponent) then
ListAddString( listStartCopy, STR_DEFTAB + svComponent, AFTER );
endif;
FeatureListItems (MEDIA, svComponent, listSubCompList);
nResult = ListGetFirstString (listSubCompList, svSubComponent);
while ( nResult != END_OF_LIST )
if FeatureIsItemSelected(MEDIA, svSubComponent) then
ListAddString( listStartCopy, STR_DEFTAB + STR_DEFTAB + svSubComponent, AFTER );
endif;
nResult = ListGetNextString (listSubCompList, svSubComponent);
endwhile;

/* List the required diskspace the install is going to take btw the bloody function doesn't return the correct value it is always a few meg off */
nReqSpace = FeatureTotalSize( MEDIA, "", TRUE, TRUE );
nReqSpace = (nReqSpace / 1024) /1024;
Sprintf(szReqSpace, "%3.2ld", nReqSpace);
ListAddString( listStartCopy, "", AFTER );
ListAddString( listStartCopy, @PNL_STARTCPY_DISKSPACE, AFTER );
ListAddString( listStartCopy, STR_DEFTAB + szReqSpace + "MB", AFTER );

/* Target path of install */
ListAddString( listStartCopy, "", AFTER );
ListAddString( listStartCopy, @PNL_STARTCPY_DIR, AFTER );
ListAddString( listStartCopy, STR_DEFTAB + szTargetPath, AFTER );

/* Program folder for shortcuts */
ListAddString( listStartCopy, "", AFTER );
ListAddString( listStartCopy, @PNL_STARTCPY_FOLDER, AFTER );
ListAddString( listStartCopy, STR_DEFTAB + szFolder, AFTER );

nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
ListDestroy(listStartCopy);
ListDestroy(listCompList);
ListDestroy(listSubCompList);

if (nResult = BACK) goto Dlg_ObjDialogs;

Good Luck...

neal007
04-28-2004, 08:24 PM
Thanks Steve. I'd like to see what IS has to offer as there should be a default and I'm sure a gazillion people ask this question and by posting a sample or KB article on this, would be nice.

Mark at IS
04-29-2004, 07:40 AM
Originally posted by neal007
I'd like to see what IS has to offer as there should be a defaultThe only detailed documentation InstallShield currently provides is the SdStartCopy help topic's example script link, which is less comprehensive than Steve's code. I have entered InstallShield work order 1-MTZFP to expand this example script.