Calling Sub section from Sub section [Solved]

Antworten
darpakiss
Beiträge: 2
Registriert: 27 Sep 2012, 12:12

Calling Sub section from Sub section [Solved]

Beitrag von darpakiss »

Hi all,

I would like to run a similar winst script:

Code: Alles auswählen

...
DefStringList $result1$
DefStringList $result2$

Set $result1$ = createStringList ('ProgDir1','ProgDir2', 'Progdir3', 'ProgDir4')

for $dirString$ in $result1$ do Sub_searchCycle

[Sub_searchCycle]
Set $result2$ = getRegistryKeyList32("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
for $app$ in $result2$ do Sub_searchApp32

[Sub_searchApp32]
set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] UninstallString
if contains($appKey$,$dirString$)
...
endif
f I try to run it, this error message is the result

Code: Alles auswählen

[5] [Jan 22 15:44:59:847]         Warning: The section "Sub_searchApp32" (called in line 2 of the calling section) does not exist or is empty
[6] [Jan 22 15:44:59:847]         
[6] [Jan 22 15:44:59:847]         ~~~~~~~ Start Sub ~~~~~~~  Sub_searchApp32
[6] [Jan 22 15:44:59:847]         
[6] [Jan 22 15:44:59:847]         ~~~~~~~ End Sub   ~~~~~~~  Sub_searchApp32
[6] [Jan 22 15:44:59:847]         
My questions:
1. Can I call Sub_ section from Sub_ section?
- If yes, how?
- If not, Is there any plan to implement this into any later revision, and when?

2. Is there any other method to use nested loop in winst scripts?

3. If I can solve this problem, Can I use in the second loop the first loop variable (here is: $dirString$) ?

Thank you for your answers,
--
Arpad Kiss
Zuletzt geändert von darpakiss am 18 Feb 2013, 10:36, insgesamt 1-mal geändert.
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3319
Registriert: 04 Jun 2008, 14:27

Re: Calling Sub section from Sub section

Beitrag von d.oertel »

Hi,
1. Can I call Sub_ section from Sub_ section?
- If yes, how?
- If not, Is there any plan to implement this into any later revision, and when?

2. Is there any other method to use nested loop in winst scripts?
The code you have posted should normally work.
Please send the complete code and a complete log to me by mail (d.oertel(at)uib.de), so
that I have a chance to check what is going wrong.
3. If I can solve this problem, Can I use in the second loop the first loop variable (here is: $dirString$) ?
As you can read:
http://download.uib.de/opsi_stable/doc/ ... -iteration
"Please note: The note variable is only valid in the directly called procedure. If it is needed in sub programs of it its value must be transferred to a global variable."

regards

d.oertel
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.
http://www.uib.de
http://www.opsi.org
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3319
Registriert: 04 Jun 2008, 14:27

Re: Calling Sub section from Sub section

Beitrag von d.oertel »

Hi,

thank you for your mail.

There is a problem by calling a sub_section in an external file (eg. delsub.ins) which calls nested sub_sections inside these file.
In this situation opsi-winst is puzzeld where to find the sub_section that called by the sub_section.
This is a bug.
The workaround is, to place the code of the sub_section not only in the file where it is called (delsub.ins) but also in the main script (e.g. setup.ins / uninstall.ins).

regards
d.oertel
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.
http://www.uib.de
http://www.opsi.org
darpakiss
Beiträge: 2
Registriert: 27 Sep 2012, 12:12

Re: Calling Sub section from Sub section [Solved]

Beitrag von darpakiss »

I changed the scripts as you suggested me.
At now it works.
Thank you for your help.
Antworten