1. global gSX
  2.  
  3. ----------------------------------------
  4. -- This demo shows how to use TCC/LE instead of CMD,
  5. -- if CMD access is locked via group policy
  6. ----------------------------------------
  7. on startMovie
  8.  
  9.   -- load and init Shell xtra
  10.   if _player.runmode="author" then
  11.     gSX = xtra("Shell").new()
  12.   else
  13.     openXlib(_movie.path & "lib\Shell.x32")
  14.     gSX = xtra("Shell").new()    
  15.     checkCmd()
  16.   end if
  17.  
  18.   -- now CMD/TCC works anyway!
  19.   member("result").text = gSX.shell_cmd("dir /b C:\", ["eol":RETURN])
  20. end
  21.  
  22. ----------------------------------------
  23. -- if CMD is locked, silently extract TCC/LE to TMP, then overwrite
  24. -- env var "ComSpec" and reload Shell xtra
  25. ----------------------------------------
  26. on checkCmd
  27.   res = gSX.shell_cmd("echo ABC")
  28.   if not (res starts "ABC") then
  29.    
  30.     -- extract tccle to TMP
  31.     tmp = getEnvVar("TMP")
  32.     props = [:]
  33.     props["show_cmd"] = 0
  34.     props["wait"] = 1
  35.     props["parameters"] = "/extract:" & QUOTE & tmp & QUOTE
  36.     exitCode = gSX.shell_execex(_movie.path & "setup\tccle.exe", props)
  37.     -- note: if exitCode<>0, something went wrong
  38.    
  39.     -- overwrite ComSpec
  40.     setEnvVar("ComSpec", tmp & "\EB23922\tcc.exe")
  41.    
  42.     -- reload Shell xtra
  43.     gSX = VOID
  44.     closeXLib(_movie.path & "lib\Shell.x32")
  45.     openXlib(_movie.path & "lib\Shell.x32")
  46.     gSX = xtra("Shell").new()        
  47.   end if
  48. end
  49.  
[raw code]