Code: Alles auswählen
DefFunc getDateTime(val $NONE$ : string) : stringlist
DefVar $output$
Set $output$ = takeString(0, getOutStreamFromSection("DosBatch_getDate"))
Set $result$ = addlisttolist($result$, splitString($output$, "."))
Set $output$ = takeString(0, getOutStreamFromSection("DosBatch_getTime"))
Set $result$ = addlisttolist($result$, splitString($output$, ":"))
[DosBatch_getDate]
date /t
[DosBatch_getTime]
time /t
endfunc
Code: Alles auswählen
[Actions]
encoding=utf8
requiredWinstVersion >= "4.12.0.0"
SetLogLevel=8
importLib "library.opsiscript"
DefStringlist $datetime$
Set $datetime$ = getDateTime("")
Code: Alles auswählen
[6] [Apr 25 10:47:10:018] Added defined function:: getdatetime to the known functions
[7] [Apr 25 10:47:10:020]
[7] [Apr 25 10:47:10:024] (created string list $datetime$)
[6] [Apr 25 10:47:10:027] Set $datetime$ = getDateTime("")
[8] [Apr 25 10:47:10:030] We are coming from function with index: -1 (-1 = base)
[8] [Apr 25 10:47:10:032] We enter the defined function: getdatetime with 13 lines. inDefFuncLevel: 1
[8] [Apr 25 10:47:10:034] Paramnr: 0 is : ""
[8] [Apr 25 10:47:10:036] Paramnr: 0 is the string:
[8] [Apr 25 10:47:10:040] Defined local string var: $output$ in local function: getdatetime
[6] [Apr 25 10:47:10:043] Set $output$ = takeString(0, getOutStreamFromSection("DosBatch_getDate"))
[2] [Apr 25 10:47:10:047] Syntax Error in Section: (Command in line 3 origin: C:\...\Desktop\template\CLIENT_DATA\test.opsiscript line: 4): $output$ = takeString(0, getOutStreamFromSection("DosBatch_getDate")) -> Section "DosBatch_getDate" not found
[8] [Apr 25 10:47:10:049] We leave the defined function: getdatetime ; inDefFuncLevel: 0
[8] [Apr 25 10:47:10:052] retrieving strings from getDateTime
[8] [Apr 25 10:47:10:055]
[7] [Apr 25 10:47:10:058] The value of the variable "$datetime$" is now:[
Interessanter weise passiert außerdem folgendes:
Wenn ich nur die Zeile
Code: Alles auswählen
Set $datetime$ = getDateTime("")
Code: Alles auswählen
DefStringlist $datetime$
Code: Alles auswählen
[2] [Apr 25 10:58:25:690] Found DefFunc without EndFunc
[2] [Apr 25 10:58:25:692] Syntax Error in Section: Actions (Command in line 22 origin: library.opsiscript Line: 16): time -> Found DefFunc without EndFunc