argoran Posted November 13, 2007 Share Posted November 13, 2007 I have created a VBScript to set an environment variable and launch it from an AutoIt Script with ExpandEnvVars = 1 - for some reason the Variable is not read unless I either create the environment variable outside the Autoit script or re-run the autoit script after the env var. has been created it won't be read and I only get back the %Trigram% ... any ideas?This is the VBScriptOption ExplicitDim ObjShell, strComputerName, strExpCompName, strTriGramSet ObjShell = CreateObject("WScript.Shell")strComputerName = "%COMPUTERNAME%"strExpCompName = ObjShell.ExpandEnvironmentStrings(strComputerName)strTriGram = Left(strExpCompName, 3)ObjShell.Environment.Item("TRIGRAM") = strTriGramand this is the Autoit Script ( the part that I need anyway ) I have highlited where the Entries are failing - Opt("ExpandEnvStrings", 1)Run('D:\Packeteer\ReportCenter\bin\launch.exe -w "D:\Packeteer\ReportCenter" console')Run('C:\Windows\System32\cscript.exe C:\Windows\logs\ca.vbs')sleep(10000)WinWaitActive("Create New Collection Agent","")Send("%TRIGRAM%PKC001{ENTER}")WinWait("Modify %TRIGRAM%PKC001","")If Not WinActive("Modify %TRIGRAM%PKC001","") Then WinActivate("Modify %TRIGRAM%PKC001","")WinWaitActive("Modify %TRIGRAM%PKC001","")Send("{TAB}%TRIGRAM%PKC001{ENTER}") Link to comment Share on other sites More sharing options...
Blue_Drache Posted November 13, 2007 Share Posted November 13, 2007 I believe that when the Au3 is launched it creates something akin to a sandbox of the environment variables. It copies in the pointers where the existing ones reside. Why not use the Shell("programname.exe") method to launch your script instead of watching for an Environ()? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now