Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

script-based component selection


3 replies to this topic

Peter Prinzen

Peter Prinzen
  • Members
  • 2 posts

Posted 03 February 2003 - 18:50

Hi,

I have an Installation for a Toolkit. It should be installed in every "Toolkit" Folder of a given Program.
Up to now, I have a Component Set, like
Comp1
-SubComp1
Comp2
-SubComp2
and so on.
During installation process, I will read from the registry the ProgVersions where I want to install, say C:\App7 and D:\app8. And then will display these Versions found in a temporaly created Component set. After the user makes his selections, I go over my List of "ProgVersions found" and apply their Settings (and Paths and SubComponent Selection) to the Original Component Set. But this will fail! I can't install using this way for more than 1 ProgVersion (only the first), and if select SubComp1 in ProgVers2, but not selected within ProgVers1, I get an error. Error is based on invalid Target Path (a variable), but the Component is not even selected (ComponentSelectItem is false within the Script).

What can I do? Or what's my mistake?

Thx for any help, if necessary, I will post the Code as well.

Peter

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 03 February 2003 - 19:40

Wow, that was some tough reading.

First off, I think you meant to say ComponentIsItemSelected, but if not, then that's definitely a major cause of your trouble.  Otherwise, yes, please do post a copy of this section of code.

Either way though, and I know you're not going to like this, but you really should be making use of a common folder for this Toolkit (i.e. C:\Program Files\Common\...) which all versions then make use of.

Otherwise, you'll need to reply upon some manual XCopyFile calls from your InstallScript since you essentially have multiple TARGETDIRs.


user posted image

Peter Prinzen

Peter Prinzen
  • Members
  • 2 posts

Posted 04 February 2003 - 09:00

Sorry for the long posting, but that's my Code ...

BTW: I can't use a common Folder for this Toolkit, 'cause the program for which I install this AddOn only searches special directoríes. If I use XCopy, want about the Maintenace or Uninstallation? Can I uninstall the Main Installation and keep one of the "xcopied" versions?

Thx again for your help

Peter

-----------------------------------------------------------

function ApplyCompSelection(listInfo)

NUMBER N, nResult, nResult2;
STRING szLV, szLVnSubComp, szLVn, szSubComp, szTarget, szLVPath, szTargetPath;
BOOL LLB, SAMPLE, HELPS;
STRING svComponentSource, svComponent, svFileGroup, svFile;
NUMBER nvError, nvSize;
STRING szTopInfo, svTarget, svDir;

begin

MEDIA = szTempComp;
szTempComp = "TEMPMEDIA";    
   N=0;
   ListAddString (listInfo,"Will install for the following LabVIEW-Versions...", AFTER);
   nResult = ListGetFirstString(listLV, szLVPath);
   nResult2 = ListGetFirstString(listLVVersions, szLV);
   StrRemoveLastSlash(szLVPath);
//----------------------------------------------------------------------------    
   while (nResult != END_OF_LIST && nResult2 != END_OF_LIST)
//----------------------------------------------------------------------------    
       if (ComponentIsItemSelected ("TEMPMEDIA", szLV)==TRUE) then N=N+1;
        Sprintf(szLVn, "LV%i", N);
        switch (N)
    case 1: nResult = ComponentSelectItem (MEDIA, "LV1", TRUE);
       case 2: nResult = ComponentSelectItem (MEDIA, "LV2", TRUE);
       case 3: nResult = ComponentSelectItem (MEDIA, "LV3", TRUE);
       case 4: nResult = ComponentSelectItem (MEDIA, "LV4", TRUE);
    endswitch;
        nResult = ComponentSelectItem (MEDIA, szLVn, TRUE);
           //nResult = ComponentSetData (MEDIA, szLVn, COMPONENT_FIELD_VISIBLE, TRUE, "");
        Sprintf (szTopInfo, "LabVIEW-Version %s (locatetd at %s)", szLV, szLVPath);
        ListAddString (listInfo, "", AFTER);
        ListAddString (listInfo, szTopInfo, AFTER);
//----------------------------------------------------------------------------
        Sprintf(szSubComp, "%s\\%s", szLV, "LLB");
        Sprintf(szLVnSubComp, "%s\\%s", szLVn, "LLB");
        //----------------------------------------------------------------------------
        if (ComponentIsItemSelected ("TEMPMEDIA", szSubComp)==TRUE) then
        nResult = ComponentSelectItem (MEDIA, szLVnSubComp, TRUE);
        Sprintf(szTarget, "<vilib%i>",  N);
        szTargetPath = szLVPath ^ "vi.lib\\addons\\XOnTools\\XOnMultimedia";
       
        switch (N)
        case 1: ComponentSetTarget ("LV1\\LLB", "<vilib1>", szTargetPath);
           case 2: ComponentSetTarget ("LV2\\LLB", "<vilib2>", szTargetPath);
           case 3: ComponentSetTarget ("LV3\\LLB", "<vilib3>", szTargetPath);
           case 4: ComponentSetTarget ("LV4\\LLB", "<vilib4>", szTargetPath);
        endswitch;
         
        //ComponentSetTarget (szLVnSubComp, szTarget, szTargetPath);
    LLB = TRUE;
        ListAddString (listInfo, "... vi.lib into " + szTargetPath, AFTER);
        else
        nResult = ComponentSelectItem (MEDIA, szLVnSubComp, FALSE);
        endif;
//------------------- snipped two more SubComponents -------------------------
if (nResult < 0) then
       ComponentError(svComponentSource, svComponent, svFileGroup, svFile, nvError);
       SprintfBox(INFORMATION, "ComponentTransferData Error Information",
        "ComponentTransferData had the following error:\n\n" +
        "Media Name: %s\nComponent: %s\nFile Group: %s\n" +
        "File: %s\nError Number: %ld",
        svComponentSource, svComponent, svFileGroup, svFile, nvError);
   endif;
//-----------------------------------------------------------------------------      
       endif;
    nResult = ListGetNextString(listLVVersions, szLV);
    nResult2 = ListGetNextString(listLV, szLVPath);
    StrRemoveLastSlash(szLVPath);
    LLB = HELPS = SAMPLE = FALSE;
endwhile;
//-----------------------------------------------------------------------------
if (N <= 4) then
    if (N < 2) then
    nResult = ComponentSelectItem (MEDIA, "LV2", FALSE);
    nResult = ComponentSetData (MEDIA, "LV2" ,COMPONENT_FIELD_VISIBLE, FALSE, "");
    endif;
    if (N < 3) then
    nResult = ComponentSelectItem (MEDIA, "LV3", FALSE);
    nResult = ComponentSetData (MEDIA, "LV3" ,COMPONENT_FIELD_VISIBLE, FALSE, "");
endif;
    if (N < 4) then
    nResult = ComponentSelectItem (MEDIA, "LV4", FALSE);
    nResult = ComponentSetData (MEDIA, "LV4" ,COMPONENT_FIELD_VISIBLE, FALSE, "");
    endif;
   endif;
//-----------------------------------------------------------------------------    
   
   //SdComponentDialog("What to ", "how to", svDir, "");
end;

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 04 February 2003 - 15:01

Well the idea behind Maintenance is that it will transfer previously selected components, so by default, your XCopy routines would NOT be re-applied.  You would need to put that same code and/or function calls that you'll end up having in OnFirstUIAfter also in OnMaintUIAfter.

As for uninstallation, you would want to wrap these XCopy calls with Disable(LOGGING) & [B]Enable(LOGGING)[B] because otherwise these common toolkit files would be automatically removed from ALL previously associated programs.

And no, the main installations won't know of these "xcopied" files since they weren't a part of their file sets, so they will ignore them during uninstallation.

However, in order to better manage the cleanup process, you probably should modify each main installation to delete any toolkits which are present for that particular installation.

Otherwise, you'll need to add some additional "smarts" to the toolkit's OnMaintFirstUIBefore's default uninstall instructions, so when the time is right, you manually delete the files through InstallScript code.

You're more acquainted with your system though, so it's up to you how you actually want to handle it, but hopefully now you have any idea on some of the default behavior and their associated operations.

Unfortunately, after answering all your questions, I don't have time to also look at your code, so I'll do that later unless someone else beats me to it.
user posted image