Sign in to follow this  
Followers 0
Braese

Child Process other Environment Variable

6 posts in this topic

Hi,

i manipulate a Programm to write there Settings not to normal %userprofile%. I did this with

EnvSet("USERPROFILE", @ScriptDir & "\" & $profil)
and after that a Run(prog.exe). It works, but when i start, for example firefox from within this Process, firefox will create a new user profile while firefox takes the manipulated %userprofile%. How can i tell Child Processes that they take the normal Environment Variable? Any Help? Thank You.

Share this post


Link to post
Share on other sites



Hi,

i manipulate a Programm to write there Settings not to normal %userprofile%. I did this with

EnvSet("USERPROFILE", @ScriptDir & "\" & $profil)
and after that a Run(prog.exe). It works, but when i start, for example firefox from within this Process, firefox will create a new user profile while firefox takes the manipulated %userprofile%. How can i tell Child Processes that they take the normal Environment Variable? Any Help? Thank You.
I don't really understand you question.

The child will inherit copies of the environmental variables. Do you mean that the child process modifies the environmental variable but that change is not seen in the parent environment? If that is what you mean then you could have the child program saves the environmental variable value in an ini file say, then a script in the parent environment could read that and set it.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I don't really understand you question.

The child will inherit copies of the environmental variables. Do you mean that the child process modifies the environmental variable but that change is not seen in the parent environment? If that is what you mean then you could have the child program saves the environmental variable value in an ini file say, then a script in the parent environment could read that and set it.

The other way. The Parent Process (Run(my.exe)) should use my manipulated Environment Variable and if the Parent Process spawns a child process the child process should use the System Environment Variables. Edited by Braese

Share this post


Link to post
Share on other sites

The other way. The Parent Process (Run(my.exe)) should use my manipulated Environment Variable and if the Parent Process spawns a child process the child process should use the System Environment Variables.

I would need to understand a bit more about what prog.exe is and does.

Instead of manipulating the variable, pas the modified version as a parameter to prog.exe. Prog can then use that instead of the modified value, or, if it is going to start another process, it could change the variable to the parameter first then change it back afterwards.

Or have a new Env. variable to be used by prog.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I would need to understand a bit more about what prog.exe is and does.

Instead of manipulating the variable, pas the modified version as a parameter to prog.exe. Prog can then use that instead of the modified value, or, if it is going to start another process, it could change the variable to the parameter first then change it back afterwards.

Or have a new Env. variable to be used by prog.

The Executable is Digsby.exe, a Instant Messenger. It doesnt accept any commandline arguments. Normally it saves Logs, Settings and so in %userprofile%\appdata, %userprofile%\mydocuments and so on. I manipulated the Environment Variable %userprofile% so Digsby thinks, %userprofile% is in Folder ( in example Profile ) and i created all the neccesary Folders ( My Documents, Application Data etc) in it. Digsby now saves all Settings in the manipulated Path. But if you get an Message with an Link for example and click on it, Digsby starts a Child Process with your Standard Browser ( in example Firefox ). But now Firefox ( if it doesnt run!) takes the manipulated %userprofile% Path now too, because it is a child process of Digsby.exe and want to make a new Profile, because nothing from firefox is found in the new %userprofile% Path. Thats the same for all Child Processes that Digsby starts if you click on something within Digsby that take Infos from %userprofile% .

That is normally i know. But perhaps, i can say to every new Child Process that comes from Digsby.exe, that they must use the normal %userprofile% Variable instead. That is my Question.

Share this post


Link to post
Share on other sites

You would need to make a "wrapper" exe that Digsby would run like

c:\Wrapper.exe firefox.exe

Then Wrapper.exe would

Set the Env Var back and

Run($cmdline[1])

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0