logging - 2 VBScripts importing from the same file at the same time -
i have following function use import vbs file:
sub import(byval filename) dim fso, sh, file, code set fso = createobject("scripting.filesystemobject") set sh = createobject("wscript.shell") filename = sh.expandenvironmentstrings(filename) filename = fso.getabsolutepathname(filename) set file = fso.opentextfile(filename) code = file.readall file.close executeglobal(code) end sub
i use function 2 different scripts:
script 1: imports logger vbscript function , executes script 2 like:
dim objshell set objshell = wscript.createobject("wscript.shell") objshell.run "script2.vbs "+wscript.arguments(0)
script 2: imports logger vbscript same function.
when code gets script 2 , wants import logger following error:
line: 0
char: 1
error: permission denied
code: 800a0046
source: microsoft vbscript runtime error
i think happening script 1 locks logger vbscript when imports , script 2 can't hence generating error. how can solve this?
wiki
Comments
Post a Comment