Search the Community
Showing results for tags 'envset envupdate envget'.
-
I'm trying to use environment variables to store a checkbox setting between program runs. The use of EnvGet and EnvSet seems clear enough, but they don't seem to actually do anything. Adding EnvUpdate() to the code seems to make the program permanently hang (in the full version) or take 25 seconds (in the test version below), but still, the environment variable isn't set so the next time I run it it comes up blank, and running SET from a command prompt doesn't show it as existing. This happens whether I run the script from SciTE or as a compiled executable. In the full program when I ran the compiled executable including EnvUpdate, the program hung, and after killing it I was unable to delete the .exe because Windows said it's still open in Windows Error Reporting, had to restart the computer. Actually, in the full version, though I said it permanently hung it might have come back eventually, I didn't retry that as the autoit script is in turn called by another program and all of that takes a long time to set up. $printopt = EnvGet("KC2ST_PRINTOPT") MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$printopt' & @CRLF & @CRLF & 'Return:' & @CRLF & $printopt) ;### Debug MSGBOX $printopt = MsgBox(4097, "choose option", "ok to print, cancel to skip") If ($printopt = 2) Then $printopt = 0 MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$printopt' & @CRLF & @CRLF & 'Return:' & @CRLF & $printopt) ;### Debug MSGBOX EnvSet("KC2ST_PRINTOPT", $printopt) EnvUpdate() MsgBox(4096, "result", EnvGet("KC2ST_PRINTOPT") & @crlf & "@error = " & @error)