global gSX
----------------------------------------
-- This demo shows how to use TCC/LE instead of CMD,
-- if CMD access is locked via group policy
----------------------------------------
on startMovie
-- load and init Shell xtra
if _player.runmode="author" then
gSX = xtra("Shell").new()
else
openXlib(_movie.path & "lib\Shell.x32")
gSX = xtra("Shell").new()
checkCmd()
end if
-- now CMD/TCC works anyway!
member("result").text = gSX.shell_cmd("dir /b C:\", ["eol":RETURN])
end
----------------------------------------
-- if CMD is locked, silently extract TCC/LE to TMP, then overwrite
-- env var "ComSpec" and reload Shell xtra
----------------------------------------
on checkCmd
res = gSX.shell_cmd("echo ABC")
if not (res starts "ABC") then
-- extract tccle to TMP
tmp = getEnvVar("TMP")
props = [:]
props["show_cmd"] = 0
props["wait"] = 1
props["parameters"] = "/extract:" & QUOTE & tmp & QUOTE
exitCode = gSX.shell_execex(_movie.path & "setup\tccle.exe", props)
-- note: if exitCode<>0, something went wrong
-- overwrite ComSpec
setEnvVar("ComSpec", tmp & "\EB23922\tcc.exe")
-- reload Shell xtra
gSX = VOID
closeXLib(_movie.path & "lib\Shell.x32")
openXlib(_movie.path & "lib\Shell.x32")
gSX = xtra("Shell").new()
end if
end