Konstanten (z.B. %ScriptPath%) werden nicht aufgelöst wenn die Funktion über importLib eingebunden wird. Wenn die Funktion direkt in der gleichen Datei definiert wird (oder per include_insert eingebunden), klappt es. Hier ein kleiner Testcase:
setup.opsiscript:
Code: Alles auswählen
[Actions]
SetLogLevel = 5
importLib "testFunc_external.opsiscript"
DefFunc testFunc_inline($arg1$: string): string
comment "testFunc_inline: %ScriptPath%"
EndFunc
comment "Main script: %ScriptPath%"
DefVar $tmp$
Set $tmp$ = testFunc_inline("test")
Set $tmp$ = testFunc_external("test")
Code: Alles auswählen
DefFunc testFunc_external($arg1$: string): string
comment "testFunc_external: %ScriptPath%"
EndFunc
Code: Alles auswählen
comment: Main script: \\opsiserver\opsi_workbench\testFunc
comment: testFunc_inline: \\opsiserver\opsi_workbench\testFunc
comment: testFunc_external: %ScriptPath%
Gruß,
Martin