The following code does not seem to do what I expect. Could anyone help me out?
It's intended to install the same source files into multiple destinations. Instead, only the final directory in the sTargetList has files placed into it.
Set Variable sTargetList to c:\Target1\|c:\Target2 for each Element sTargetItem in | delimited Collection of $sTargetList$ do
MessageBox: Install List, $sTargetItem$subdir$NEWLINE$$NEWLINE$$sTargetList$
Install Files C:\source file path\*.* to $sTargetItem$subdir, include subfolders
next
Am I missing something? I put the message box in there to see each directory its supposed to be installing to, and that's correct, so the Install Files function is being called multiple times.
Install Files inside loop
Re: Install Files inside loop
As I remember it, so-called "purple" commands don't run until the Apply Install is executed. If you do ten calls to Install Files only the last one will be retained and executed. This was covered somewhere before and I think it's in one of the sticky threads, possibly this one viewtopic.php?f=2&t=4338 but I haven't the time to read through it. If you're using one of the later IA versions with the native engine you could certainly think of using that and let them execute on demand when they're called. This would seem to explain why your message boxes are correct as they are executed when called and not deferred to later which Install Files would do.
Edit: I had a quick read through the linked thread above. Michael Nesmith who did forum support a while back wrote this:
"One last important point is the following. Even though it is legal to construct an MSIcode loop in your installer which loops purple commands, you have to realize that only the last iteration of your loop will have any effect. This is because the MSI database contains only one set of entries for each purple command, and these entries are updated by the MSIcode engine at runtime so the scripting magic works - but if you loop over purple commands, you are updating the same entries over and over again. "
Edit: I had a quick read through the linked thread above. Michael Nesmith who did forum support a while back wrote this:
"One last important point is the following. Even though it is legal to construct an MSIcode loop in your installer which loops purple commands, you have to realize that only the last iteration of your loop will have any effect. This is because the MSI database contains only one set of entries for each purple command, and these entries are updated by the MSIcode engine at runtime so the scripting magic works - but if you loop over purple commands, you are updating the same entries over and over again. "
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Install Files inside loop
...I can only confirm what reported by Peter.
Regards
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Who is online
Users browsing this forum: No registered users and 125 guests