|
|
#1 |
|
Junior Member
Join Date: Jan 2003
Location: SnSn - Spain
Posts: 10
|
I have read some posts about how to write Environment Variables Permantently, but i need to write/set them on install running to test the DB Connection.
The program that connects with DataBase reads Settings from Environment Variables like DBDATE, DBTEMP, DBSERVER and others that the installer sets into installoptions 'forms'/'pages', but i need them on the environment to test the connection on the next page, but i only read about reading env. vars. and write them on the registry or the autoexec, but this option needs to reboot. Resume: How Can I write/change Env. Vars. on installer execution? Thanks |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Nov 2000
Posts: 29
|
Hi there, this is how i would write an environment variable
WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Env Name" "Env Value" |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
That only works on Windows NT. The functions I have posted above work with Windows 9x too.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jan 2003
Location: SnSn - Spain
Posts: 10
|
RePlay: sorry about my english, but maybe i said something different that i thonk (thonk? thinked? what is the past of to think?)
Example: One Install Script PAge 1 Welcome Page 2 License Page 3 Components Page 4 Custom Page With Input Text Boxes Page 5 Custom Page With DB connection test Page 6 Custon Page that shows information about connection Page 7 Install Rest of Components Page 8 Bye Bye In The Page 6 i read a file written by Program on Page 5 In The Page 5 i call an executable that read the Environment Variables to Test an DataBase Connection. In the Page 4 i do an input of the variables that i need in the Page 5. In The solutions that you give me, i need to install,reboot and test de connection, if the connection dont work the user must repeat the install!?!?! Resume: How Can I Change/SetUp/Write Variables to Environment Directly during execution, not to registry, not to autoexec.bat? |
|
|
|
|
|
#6 |
|
Major Dude
Join Date: Jun 2002
Location: Swindon, UK
Posts: 559
|
past of think is thought
|
|
|
|
|
|
#7 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
I am sorry. I haven't read your question to the end.
![]() Here is how you do it without the need to create a plug-in: PHP Code:
If you don't want to include System.dll in your installer (9KB) then you'll have to write a nice little plug-in that calls SetEnvironmentVariable. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Jan 2003
Location: SnSn - Spain
Posts: 10
|
thank you!
it works fine, at the moment i will use the system.dll, in future... maybe a new little dll. |
|
|
|
|
|
#9 |
|
NSIS Dev
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
|
Does this work with nsExec as well?
Or just for the Exec functions? --- Thanks |
|
|
|
|
|
#10 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Yes, it works for nsExec as well as both use CreateProcess.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Jan 2003
Location: SnSn - Spain
Posts: 10
|
--- La Función - The Function ---
code: --- La Función - The Function --- --- Post in Spanish --- Hola La función System::Call funcionó bien, hasta que empecé a realizar debug y control de errores, fue entonces cuando descubri que cada vez que se utiliza la función, el flag de error se activa, y pierdo el control de los errores, y se me escapa por algun lado. ¿tengo alguna otra manera de hacer lo mismo con otro dll ya existente? Muchas Gracias y Saludos Totales :P KiKoLo --- Post in Spanish --- --- Post in ... Spanglish? --- Hi The Function System::Call worked fine, but when i started to do debug and error hadler control, i discover that when i use the function, the error flag activates, and i miss the control of the error handles and it scapes anywhere. ¿Can i do the same with an existent dll? Lots of Thanks and SALUDOS TOTALES :P KiKoLo --- Post in ... Spanglish? --- --- Ejemplo - Example --- PHP Code:
Thank you for all darkboy
|
|
|
|
|
|
#12 |
|
Debian user
(Forum King) Join Date: Jan 2003
Location: Arch land
Posts: 4,896
|
!define Spanish_Post
![]() KiKoLo: Tu mensaje en el foro está bien redactado, les explicas que tienes un error al usar el plugin System al usar Debug, y que este error no lo puedes controlar. Ayuda el hecho de que hayas puesto parte de tu código. !define English_Post ![]() KiKoLo: you post in english is ok. When you use the System plugin with the debug and error handlers, you starting to recived error that you can't handle... It helps that you put part of your code. * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux w/ xfce4. * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Debian unstable w/ xfce4. |
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Jan 2003
Location: SnSn - Spain
Posts: 10
|
I made a plugin dll (SetEnv.dll) to do this.
And Works when the other way doesnot explanation... PHP Code:
code: If I replace the system call with PHP Code:
code: The file is the SetEnv Plugin, anybody knows how can i upload it to downloads section in the official page? Thanks for everybody and... ¡¡¡Saludos Totales!!!! yeah! KiKoLo NOTAS NOTA 1: No tengo ni puta idea de C, pero con los ejemplos que tenian, y el msdn, no fue dificil hacerlo. NOTA 2: Mi inglés es pésimo, está oxidado asi que si alguien no lo entiende, lo siento, es hasta donde puedo llegar NOTA 3: Descomprimir quedando SenEnv como un directorio mas del Contrib debajo del NSIS (NSIS\Contrib\SetEnv) porque coge el ..\exdll\exdll.h y despues mover el setenv.dll a NSIS\Plugins NOTES NOTE 1: I have no idea about C, but with the examples anda with the MSDN it does not be dificult to do. NOTE 2: Sorry about my english NOTE 3: Extract It on a Dir behind Contrib 'cause it take the ..\exdll\exdll.h and then move the setenv.dll to NSIS\Plugins |
|
|
|
|
|
#14 |
|
Major Dude
|
Please attach in .zip, because someone could not have the WinRAR program. (I don't have!)
|
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Jan 2003
Location: SnSn - Spain
Posts: 10
|
jeje, i don't have winzip
![]() but a serious app like winrar give you the posibility to compress to an uneficient algorithm like winzip xDDDD (dont worry, is a joke) I only have winrar 'cause it give me more flexibility and better ratios, but winzip is more... more... marketizing XD Saludos Totales |
|
|
|
|
|
#16 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
The problem is that you have quotes inside that environment variable. You can use it this way:
PHP Code:
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|