Seite 1 von 1
for %s% in $list$ do ...
Verfasst: 25 Apr 2012, 10:18
von kniggisiggi
halli hallo,
ich möchte eine schleife nach folgendem beispiel erstellen:
einziger haken dabei, ich möchte in der schleife eine mehzeilige anzeisung durchführen lassen.
dieses klappt leider nicht:
winst-handbuch sagt auch nicht wirklich viel.
mein versuch mit sub-sections zu arbeiten scheitert leider daran, dass ich innerhalb dieser sub-section noch eine winbatch-anweisung aufrufen möchte, welche aber
vom winst als leer oder nicht vorhanden erkannt wird.
laut dr. oertel ist dieses problem bekannt bei zu tief verschachtelten anweisungen.
jetzt suche ich einen weg die sub-section einzusparen.
Re: for %s% in $list$ do ...
Verfasst: 25 Apr 2012, 10:59
von ueluekmen
Hi,
ein Weg es ohne die Subsektion zu machen ist mir nicht bekannt. Eine Frage: Wenn man die Subsektion schreibt, ist diese in der selben Datei wie der Winbatch-Aufruf? Wie tief wird verschachtelt? Also wird sub von sub von sub aufgerufen oder einfach die for-schleife in der primären Sektion aufgerufen und dann eine sub und von der eine Winbatch? Ein Beispiel-Skript wäre von Vorteil.
Re: for %s% in $list$ do ...
Verfasst: 06 Nov 2012, 17:00
von seteqsystems
Ich habe damit ebenfalls Probleme...
Ich habe insgesamt folgende Files:
uninstall.ins
Code: Alles auswählen
Message = Removing software, please wait...
setLogLevel = 6
ExitOnError = false
ScriptErrorMessages = on
TraceMode = off
StayOnTop = false
[Actions]
sub "%ScriptPath%\product.ins"
sub "%ScriptPath%\subuninstall.ins"
product.ins
Code: Alles auswählen
DefVar $OS$
DefVar $NTVersion$
DefVar $ProductName$
DefVar $ProductGUID$
DefVar $ProductSize$
DefVar $ExitCode$
DefStringList $ProductGUIDlist$
set $OS$ = GetOS
set $NTVersion$ = GetNTVersion
Set $ProductName$ = "ArcGIS 9.3"
Set $ProductGUID$ = "{5033400B-0977-45AB-94CE-CC135A8E1BBB}"
Set $ProductGUIDlist$ = loadTextFile("%scriptpath%\guid.ini")
Set $ProductSize$ = "2GB"
ShowBitmap /3 "%scriptpath%\product.png" $ProductName$
subuninstall.ins
Code: Alles auswählen
DefVar $UninstallCommand$
DefVar $DisplayName$
for %guid% in $ProductGUIDlist$ do Sub_uninstmsi
[Sub_uninstmsi]
Set $DisplayName$ = GetRegistryStringValue32("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%guid%] DisplayName")
if $DisplayName$ = ""
Set $DisplayName$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%guid%] DisplayName")
endif
if not ($DisplayName$ = "")
Message "Removing "+$DisplayName$
set $UninstallCommand$ = "MsiExec.exe /x %guid% /qb-! REBOOT=ReallySuppress MSIRESTARTMANAGERCONTROL=Disable"
Winbatch_Uninstall
sub "%ScriptDrive%\_scripts\check_msi-exitcode.ins"
endif
[Winbatch_Uninstall]
$UninstallCommand$
Die Iteration funktioniert auch problemlos, nur habe ich das selbe Problem, dass die Winbatch-Section als leer erkannt wird (siehe nachfolgendes Log...)
Gibt es eine Möglichkeit, das anders zu lösen bzw. kennt jemand einen Trick wie ich die selbe Funktionalität anders realisieren könnte?
Ach zur Info: Das Konstrukt funktioniert ohne die for-Schleife problemlos

Danke & lg
LOG:
Code: Alles auswählen
[6] [06.11.2012 16:49:41] ~~~~~~~ Start Sub ~~~~~~~ sub "P:\arcgis93\subuninstall.ins"
[6] [06.11.2012 16:49:41] retrieving strings from $ProductGUIDlist$ [switch to loglevel 7 for debugging]
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~ Looping through: '{5033400B-0977-45AB-94CE-CC135A8E1BBB}', '{6D35038C-8A9F-4783-9A3C-BC778D3DD4EE}
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~~ Start Sub ~~~~~~~ Sub_uninstmsi
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] Set $DisplayName$ = GetRegistryStringValue32("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5033400B-0977-45AB-94CE-CC135A8E1BBB}] DisplayName")
[6] [06.11.2012 16:49:41] Info: Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5033400B-0977-45AB-94CE-CC135A8E1BBB}] could not be opened by RegOpenKeyEx, Errorno 2 "Das System kann die angegebene Datei nicht finden.
"
[6] [06.11.2012 16:49:41] The value of the variable "$DisplayName$" is now: ""
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] If
[5] [06.11.2012 16:49:41] $DisplayName$ = "" <<< result true
[5] [06.11.2012 16:49:41] Then
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] Set $DisplayName$ = GetRegistryStringValue64("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5033400B-0977-45AB-94CE-CC135A8E1BBB}] DisplayName")
[6] [06.11.2012 16:49:41] Info: Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5033400B-0977-45AB-94CE-CC135A8E1BBB}] could not be opened by RegOpenKeyEx, Errorno 2 "Das System kann die angegebene Datei nicht finden.
"
[6] [06.11.2012 16:49:41] The value of the variable "$DisplayName$" is now: ""
[5] [06.11.2012 16:49:41] EndIf
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] If
[5] [06.11.2012 16:49:41] $DisplayName$ = "" <<< result true
[5] [06.11.2012 16:49:41] not ($DisplayName$ = "") <<< result false
[5] [06.11.2012 16:49:41] Then
[5] [06.11.2012 16:49:41] EndIf
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~~ End Sub ~~~~~~~ Sub_uninstmsi
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~~ Start Sub ~~~~~~~ Sub_uninstmsi
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] Set $DisplayName$ = GetRegistryStringValue32("[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6D35038C-8A9F-4783-9A3C-BC778D3DD4EE}] DisplayName")
[6] [06.11.2012 16:49:41] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6D35038C-8A9F-4783-9A3C-BC778D3DD4EE}] opened
[6] [06.11.2012 16:49:41] Key closed
[6] [06.11.2012 16:49:41] The value of the variable "$DisplayName$" is now: "ArcGIS Desktop 9.3 - Deutsches Supplement"
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] If
[5] [06.11.2012 16:49:41] $DisplayName$ = "" <<< result false
[5] [06.11.2012 16:49:41] Then
[5] [06.11.2012 16:49:41] EndIf
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] If
[5] [06.11.2012 16:49:41] $DisplayName$ = "" <<< result false
[5] [06.11.2012 16:49:41] not ($DisplayName$ = "") <<< result true
[5] [06.11.2012 16:49:41] Then
[5] [06.11.2012 16:49:41] message Removing ArcGIS Desktop 9.3 - Deutsches Supplement
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] Set $UninstallCommand$ = "MsiExec.exe /x {6D35038C-8A9F-4783-9A3C-BC778D3DD4EE} /qb-! REBOOT=ReallySuppress MSIRESTARTMANAGERCONTROL=Disable"
[6] [06.11.2012 16:49:41] The value of the variable "$UninstallCommand$" is now: "MsiExec.exe /x {6D35038C-8A9F-4783-9A3C-BC778D3DD4EE} /qb-! REBOOT=ReallySuppress MSIRESTARTMANAGERCONTROL=Disable"
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] Warning: The section "Winbatch_Uninstall" (called in line 8 of the calling section) does not exist or is empty
[5] [06.11.2012 16:49:41]
[4] [06.11.2012 16:49:41] Warning: Section "Winbatch_Uninstall" does not exist or is empty
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~~ Start Sub ~~~~~~~ sub "P:\_scripts\check_msi-exitcode.ins"
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] Set $ExitCode$ = getLastExitCode
[6] [06.11.2012 16:49:41] The value of the variable "$ExitCode$" is now: "0"
[5] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] If
[5] [06.11.2012 16:49:41] "arcgis93"="acad2010" <<< result false
[5] [06.11.2012 16:49:41] $ExitCode$="259" <<< result false
[5] [06.11.2012 16:49:41] ($ExitCode$="259") <<< result false
[5] [06.11.2012 16:49:41] ("arcgis93"="acad2010") AND ($ExitCode$="259") <<< result false
[5] [06.11.2012 16:49:41] Then
[5] [06.11.2012 16:49:41] EndIf
[1] [06.11.2012 16:49:41] LogLevel was 6
[1] [06.11.2012 16:49:41] LogLevel set to 4
[1] [06.11.2012 16:49:41] LogLevel was 4
[1] [06.11.2012 16:49:41] LogLevel set to 5
[5] [06.11.2012 16:49:41] comment: ExitCode = 0 Action completed successfully.
[1] [06.11.2012 16:49:41] LogLevel was 5
[1] [06.11.2012 16:49:41] LogLevel set to 4
[1] [06.11.2012 16:49:41] LogLevel was 4
[1] [06.11.2012 16:49:41] LogLevel set to 6
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~~ End Sub ~~~~~~~ sub "P:\_scripts\check_msi-exitcode.ins"
[6] [06.11.2012 16:49:41]
[5] [06.11.2012 16:49:41] EndIf
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~~ End Sub ~~~~~~~ Sub_uninstmsi
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~ End Loop
[6] [06.11.2012 16:49:41] Section ending since next line is starting with "["
[6] [06.11.2012 16:49:41]
[6] [06.11.2012 16:49:41] ~~~~~~~ End Sub ~~~~~~~ sub "P:\arcgis93\subuninstall.ins"
Re: for %s% in $list$ do ...
Verfasst: 06 Nov 2012, 17:54
von othiman
Hallo,
es gibt da einen schon länger bekannten Bug von Subsektionen in Subsektionen. Umgehen kann man das nur indem man die Subsektion aus der Subsektion eine Ebene höher schiebt. Also in Deinem Fall das [Sub_uninstmsi] je in product.ins und uninstall.ins einfügt. Dann sollte es gehen.
Ich hoffe einfach mal, das uib durch die vielen Anfragen in der Richtung in letzter Zeit die Priorität diesen Bug zu fixen etwas erhöht.
Viele Grüße
Thomas
Re: for %s% in $list$ do ...
Verfasst: 07 Nov 2012, 11:47
von seteqsystems
Hi,
Ich habe heute vormittags noch ein wenig experimentiert.
Gute Nachricht: Man muss nicht mal die Subsektion verschieben!
Es reicht, wenn ich folgende Codepassage in jedes Script packe, das die subuninstall.ins aufruft.
In meinem Fall hab ich das in der install.ins und in der uninstall.ins eingebaut und schon funktionierts

Ist sicher ein lästiger Bug, aber wenn man den Workaround kennt ists ja kein Problem.
Danke & lg
Florian