Funktionen mit lokal definierten Variablen lassen sich nur 1-mal aufrufen

larsg
Beiträge: 203
Registriert: 16 Dez 2014, 18:06

Funktionen mit lokal definierten Variablen lassen sich nur 1-mal aufrufen

Beitragvon larsg » 09 Mai 2018, 10:03

Wie im Betreff beschrieben.
Versucht man eine solche Funktion mehrfach aufzurufen, beschwert sich WINST das die lokale Variable bereits definiert sei,
was doch dem Prinzip einer lokalen Variable völlig widerspricht.

Beispiel:

test.opsiscript

Code: Alles auswählen

[Actions]
SetLogLevel=9
ImportLib "lib"

ShowProgress('','','','Test1','preparing')
ShowProgress('','','','Test2','preparing')


lib.opsiscript

Code: Alles auswählen

DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void
   DefVar $Message$
   DefStringList $MessageList$
   
   Set $MessageList$ = CreateStringList()
   If Not ($Name$='')
      Set $MessageList$ = AddToList($MessageList$,$Name$)
      If Not ($Version$='')
         Set $MessageList$ = AddToList($MessageList$,$Version$)
      EndIf
      If Not ($Architecture$='') And Not ($Architecture$='SysNative')
         Set $MessageList$ = AddToList($MessageList$,$Architecture$)
      EndIf
   EndIf
   Set $Message$ = $ActionMessage$
   If (Count($MessageList$)INT>"0")
      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')
   EndIf
   Message $Message$
   ;SetActionProgress $ActionProgress$
EndFunc


log

Code: Alles auswählen

[1] [Mai 09 09:55:33:152] --
[1] [Mai 09 09:55:33:153] --
[1] [Mai 09 09:55:33:153] c:\opsi.org\log\opsi-script-part-Cj95Gl30.log
[1] [Mai 09 09:55:33:158] opsi-script 4.12.0.17 started at 09.05.2018 09:55:32
[1] [Mai 09 09:55:33:159] opsi-script log file with encoding utf8
[3] [Mai 09 09:55:33:162] readconfig failed: Perhaps got defaults
[6] [Mai 09 09:55:33:163] Depot path from readconfig:  p:\
[6] [Mai 09 09:55:33:166] Restoring depot path from backup
[1] [Mai 09 09:55:33:167] Prog: force_min_loglevel: 4
[1] [Mai 09 09:55:33:168] Prog: default_loglevel: 7
[1] [Mai 09 09:55:33:170] Prog: debug_prog: False
[1] [Mai 09 09:55:33:171] Prog: debug_lib: False
[1] [Mai 09 09:55:33:172] Prog: ScriptErrorMessages: False
[1] [Mai 09 09:55:33:174] Prog: AutoActivityDisplay: False
[6] [Mai 09 09:55:33:175] Using new Depot path: 
[1] [Mai 09 09:55:33:180]
[1] [Mai 09 09:55:33:182] ============ Version 4.12.0.17 script "C:\Users\user\Desktop\test.opsiscript"
[1] [Mai 09 09:55:33:184]              used script encoding: cp1252
[1] [Mai 09 09:55:33:185]              used system encoding: cp1252
[1] [Mai 09 09:55:33:187]              start: 2018-05-09  09:55:33
[1] [Mai 09 09:55:33:189]              on client named    "W10-64"
[1] [Mai 09 09:55:33:191]              loggedin user    "user"
[1] [Mai 09 09:55:33:196]              opsi-script running as    "user"
[1] [Mai 09 09:55:33:198]              opsi-script running with admin privileges
[1] [Mai 09 09:55:33:200]              opsi-script running in standard script mode
[1] [Mai 09 09:55:33:201] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [Mai 09 09:55:33:203] system infos:
[1] [Mai 09 09:55:33:212] 00-80-27-02-02-03  -  PC hardware address
[1] [Mai 09 09:55:33:215] w10-64  -  IP name
[1] [Mai 09 09:55:33:217] 10.0.3.15  -  IP address
[1] [Mai 09 09:55:33:218] DEU  -  System default locale
[7] [Mai 09 09:55:33:220] Registry started without redirection (64 Bit)
[1] [Mai 09 09:55:33:221] MS Windows 10.0 64 Bit, Edition: Windows Enterprise 2015 LTSB
[1] [Mai 09 09:55:33:223]
[7] [Mai 09 09:55:33:229] Registry started readonly
[7] [Mai 09 09:55:33:231] Registry started without redirection (64 Bit)
[6] [Mai 09 09:55:33:232] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
[6] [Mai 09 09:55:33:234] Key closed
[6] [Mai 09 09:55:33:288] LogLevel was 7
[6] [Mai 09 09:55:33:290] LogLevel set to 9
[9] [Mai 09 09:55:33:292] Parsingprogress: r: ImportLib "lib" exp:
[9] [Mai 09 09:55:33:294] Parsingprogress: r: "lib" exp: ImportLib
[7] [Mai 09 09:55:33:296] Found ImportLib statement for file: lib.opsiscript and function:
[8] [Mai 09 09:55:33:298] Found File: C:\Users\user\Desktop\lib.opsiscript
[9] [Mai 09 09:55:33:300] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: UTF-8, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:304] mytext: Func ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: UTF-8BOM, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:312] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: Ansi, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:318] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1250, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:325] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1251, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:332] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1252, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:339] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1253, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:346] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1254, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:352] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1255, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:359] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1256, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:367] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1257, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:374] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP1258, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:381] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP437, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:388] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP850, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:394] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP852, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:401] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP866, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:407] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP874, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:415] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP932, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:424] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP936, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:431] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP949, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:437] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: CP950, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:444] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: ISO-8859-1, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:451] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: ISO-8859-2, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:458] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: ISO-8859-15, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:465] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: KOI-8, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:473] mytext: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void\r\n   DefVar $Message$\r\n   DefStringList $MessageList$\r\n   \r\n   Set $MessageList$ = CreateStringList()\r\n   If Not ($Name$='')\r\n      Set $MessageList$ = AddToList($MessageList$,$Name$)\r\n      If Not ($Version$='')\r\n         Set $MessageList$ = AddToList($MessageList$,$Version$)\r\n      EndIf\r\n      If Not ($Architecture$='') And Not ($Architecture$='SysNative')\r\n         Set $MessageList$ = AddToList($MessageList$,$Architecture$)\r\n      EndIf\r\n   EndIf\r\n   Set $Message$ = $ActionMessage$\r\n   If (Count($MessageList$)INT>"0")\r\n      Set $Message$ = $Message$+' - '+ComposeString($MessageList$,' - ')\r\n   EndIf\r\n   Message $Message$\r\n   ;SetActionProgress $ActionProgress$\r\nEndFunc\r\n\r\n\r\n\r\n\r\n\r\n, myencodings.Strings[i]: Macintosh, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:479] mytext: 敄䙦湵⁣桓睯牐杯敲獳敍獳条⡥慖两浡⑥区牴湩Ⱨ慖嘤牥楳湯㨤瑓楲杮嘬污␠牁档瑩捥畴敲㨤瑓楲杮嘬污␠捁楴湯敍獳条⑥区牴湩Ⱨ慖䄤瑣潩偮潲牧獥⑳区牴湩⥧嘺楯൤ऊ敄噦牡␠敍獳条⑥਍䐉晥瑓楲杮楌瑳␠敍獳条䱥獩⑴਍ഉऊ敓⁴䴤獥慳敧楌瑳․‽牃慥整瑓楲杮楌瑳⤨਍䤉⁦潎⁴␨慎敭㴤✧ഩऊ匉瑥␠敍獳条䱥獩⑴㴠䄠摤潔楌瑳␨敍獳条䱥獩⑴␬慎敭⤤਍उ晉丠瑯⠠嘤牥楳湯㴤✧ഩऊउ敓⁴䴤獥慳敧楌瑳․‽摁呤䱯獩⡴䴤獥慳敧楌瑳Ⱔ嘤牥楳湯⤤਍उ湅䥤൦ऊ䤉⁦潎⁴␨牁档瑩捥畴敲㴤✧
湁⁤潎⁴␨牁档瑩捥畴敲㴤匧獹慎楴敶⤧਍उ匉瑥␠敍獳条䱥獩⑴㴠䄠摤潔楌瑳␨敍獳条䱥獩⑴␬牁档瑩捥畴敲⤤਍उ湅䥤൦ऊ湅䥤൦ऊ敓⁴䴤獥慳敧․‽䄤瑣潩䵮獥慳敧തऊ晉⠠潃湵⡴䴤獥慳敧楌瑳⤤义㹔〢⤢਍उ敓⁴䴤獥慳敧․‽䴤獥慳敧⬤‧‭⬧潃灭獯卥牴湩⡧䴤獥慳敧楌瑳Ⱔ‧‭⤧਍䔉摮晉਍䴉獥慳敧␠敍獳条⑥਍㬉敓䅴瑣潩偮潲牧獥⁳䄤瑣潩偮潲牧獥⑳਍湅䙤湵ൣഊഊഊഊഊ, myencodings.Strings[i]: UCS-2LE, DefaultEncoding: utf8
[9] [Mai 09 09:55:33:501] mytext: 䑥晆畮挠卨潷偲潧牥獳䵥獳慧攨噡氠⑎慭攤㩓瑲楮本噡氠⑖敲獩潮␺却物湧ⱖ慬․䅲捨楴散瑵牥␺却物湧ⱖ慬․䅣瑩潮䵥獳慧攤㩓瑲楮本噡氠⑁捴楯湐牯杲敳猤㩓瑲楮朩㩖潩損ਉ䑥晖慲․䵥獳慧攤ഊॄ敦却物湧䱩獴․䵥獳慧敌楳琤ഊऍਉ卥琠⑍敳獡来䱩獴␠㴠䍲敡瑥却物湧䱩獴⠩ഊॉ映乯琠⠤乡浥␽✧⤍ਉ॓整․䵥獳慧敌楳琤‽⁁摤呯䱩獴⠤䵥獳慧敌楳琤Ⱔ乡浥␩ഊउ䥦⁎潴
⑖敲獩潮␽✧⤍ਉउ卥琠⑍敳獡来䱩獴␠㴠䅤摔潌楳琨⑍敳獡来䱩獴␬⑖敲獩潮␩ഊउ䕮摉昍ਉॉ映乯琠⠤䅲捨楴散瑵牥␽✧⤠䅮搠乯琠⠤䅲捨楴散瑵牥␽❓祳乡瑩癥✩ഊउ॓整․䵥獳慧敌楳琤‽⁁摤呯䱩獴⠤䵥獳慧敌楳琤Ⱔ䅲捨楴散瑵牥␩ഊउ䕮摉昍ਉ䕮摉昍ਉ卥琠⑍敳獡来␠㴠⑁捴楯湍敳獡来␍ਉ䥦
䍯畮琨⑍敳獡来䱩獴␩䥎吾∰∩ഊउ卥琠⑍敳獡来␠㴠⑍敳獡来␫✠ⴠ✫䍯浰潳敓瑲楮木⑍敳獡来䱩獴␬✠ⴠ✩ഊॅ湤䥦ഊ्敳獡来․䵥獳慧攤ഊऻ卥瑁捴楯湐牯杲敳猠⑁捴楯湐牯杲敳猤ഊ䕮摆畮挍਍਍਍਍਍, myencodings.Strings[i]: UCS-2BE, DefaultEncoding: utf8
[5] [Mai 09 09:55:33:525] Imported all functions from file: C:\Users\user\Desktop\lib.opsiscript
[9] [Mai 09 09:55:33:543] Parsingprogress: r: DefFunc ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void exp:
[9] [Mai 09 09:55:33:563] Parsingprogress: r: ShowProgress(Val $Name$:String,Val $Version$:String,Val $Architecture$:String,Val $ActionMessage$:String,Val $ActionProgress$:String):Void exp: DefFunc
[8] [Mai 09 09:55:33:586] Found new defined function name: ShowProgress
[8] [Mai 09 09:55:33:603] Found defined function parametername: $name$
[8] [Mai 09 09:55:33:623] Parameter has call type: val
[8] [Mai 09 09:55:33:636] Parameter has valid data type: string
[8] [Mai 09 09:55:33:648] Found defined function parametername: $version$
[8] [Mai 09 09:55:33:656] Parameter has call type: val
[8] [Mai 09 09:55:33:668] Parameter has valid data type: string
[8] [Mai 09 09:55:33:675] Found defined function parametername: $architecture$
[8] [Mai 09 09:55:33:684] Parameter has call type: val
[8] [Mai 09 09:55:33:688] Parameter has valid data type: string
[8] [Mai 09 09:55:33:691] Found defined function parametername: $actionmessage$
[8] [Mai 09 09:55:33:694] Parameter has call type: val
[8] [Mai 09 09:55:33:697] Parameter has valid data type: string
[8] [Mai 09 09:55:33:700] Found defined function parametername: $actionprogress$
[8] [Mai 09 09:55:33:701] Parameter has call type: val
[8] [Mai 09 09:55:33:703] Parameter has valid data type: string
[8] [Mai 09 09:55:33:705] Function has valid data type: void
[6] [Mai 09 09:55:33:707] Added defined function: ShowProgress to the known functions
[9] [Mai 09 09:55:33:711] Parsingprogress: r: ShowProgress('','','','Vorbereitung1','preparing') exp:
[9] [Mai 09 09:55:33:714] Parsingprogress: r: ('','','','Vorbereitung1','preparing') exp: ShowProgress
[8] [Mai 09 09:55:33:716] We are coming from function with index: -1 (-1 = base)
[8] [Mai 09 09:55:33:718] We enter the defined function: ShowProgress with 19 lines. inDefFuncLevel: 1
[8] [Mai 09 09:55:33:720] Paramnr: 0 is : ''
[8] [Mai 09 09:55:33:722] Paramnr: 0 is the string:
[8] [Mai 09 09:55:33:724] Paramnr: 1 is : ''
[8] [Mai 09 09:55:33:727] Paramnr: 1 is the string:
[8] [Mai 09 09:55:33:730] Paramnr: 2 is : ''
[8] [Mai 09 09:55:33:732] Paramnr: 2 is the string:
[8] [Mai 09 09:55:33:734] Paramnr: 3 is : 'Vorbereitung1'
[8] [Mai 09 09:55:33:736] Paramnr: 3 is the string: Vorbereitung1
[8] [Mai 09 09:55:33:737] Paramnr: 4 is : 'preparing'
[8] [Mai 09 09:55:33:740] Paramnr: 4 is the string: preparing
[8] [Mai 09 09:55:33:751] We leave the defined function: ShowProgress ; inDefFuncLevel: 0
[9] [Mai 09 09:55:33:753] Parsingprogress: r: ShowProgress('','','','Vorbereitung2','preparing') exp:
[9] [Mai 09 09:55:33:755] Parsingprogress: r: ('','','','Vorbereitung2','preparing') exp: ShowProgress
[8] [Mai 09 09:55:33:758] We are coming from function with index: -1 (-1 = base)
[8] [Mai 09 09:55:33:760] We enter the defined function: ShowProgress with 19 lines. inDefFuncLevel: 1
[8] [Mai 09 09:55:33:763] Paramnr: 0 is : ''
[8] [Mai 09 09:55:33:766] Paramnr: 0 is the string:
[8] [Mai 09 09:55:33:767] Paramnr: 1 is : ''
[8] [Mai 09 09:55:33:770] Paramnr: 1 is the string:
[8] [Mai 09 09:55:33:771] Paramnr: 2 is : ''
[8] [Mai 09 09:55:33:775] Paramnr: 2 is the string:
[8] [Mai 09 09:55:33:776] Paramnr: 3 is : 'Vorbereitung2'
[8] [Mai 09 09:55:33:778] Paramnr: 3 is the string: Vorbereitung2
[8] [Mai 09 09:55:33:781] Paramnr: 4 is : 'preparing'
[8] [Mai 09 09:55:33:784] Paramnr: 4 is the string: preparing
[2] [Mai 09 09:55:33:785] Syntax Error: Double definition of local variable: $message$
[2] [Mai 09 09:55:33:787] Syntax Error in Section:  (Command in line 1 in defined function: ShowProgress file: lib.opsiscript function start at line: 1; origin: lib.opsiscript line: 2): $Message$ -> name is already in use
[8] [Mai 09 09:55:33:790] We leave the defined function: ShowProgress ; inDefFuncLevel: 0
[1] [Mai 09 09:55:33:798] ___________________
[1] [Mai 09 09:55:33:800] script finished: failed
[1] [Mai 09 09:55:33:802] 1 error
[1] [Mai 09 09:55:33:804] 0 warnings
[1] [Mai 09 09:55:33:807]
[1] [Mai 09 09:55:33:809]
[8] [Mai 09 09:55:33:811] End of CreateAndProcessScript


An wen darf ich die Dateien schicken?

Benutzeravatar
d.oertel
Beiträge: 3257
Registriert: 04 Jun 2008, 14:27

Re: Funktionen mit lokal definierten Variablen lassen sich nur 1-mal aufrufen

Beitragvon d.oertel » 09 Mai 2018, 16:30

Hi,

damit:
https://download.uib.de/opsi4.0/experimental/opsi-v407/products/localboot/opsi-winst_4.12.0.19-1.opsi
sollte es gehen.

Das problem war genauer gesagt
Funktionen mit dem Typ void und lokalen Variablen lassen sich nur 1 mal aufrufen.
(beim löschen der lokalen Variablen wurde immer die existenz von $result$ vorausgesetzt
und so blieb im void fall die erste lokale Variable stehen).

gruß
detlef oertel
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.
http://www.uib.de
http://www.opsi.org