![]() |
#1 |
Junior Member
Join Date: Jun 2011
Posts: 7
|
PHP and ReadCustomerData
Hi to everyone,
I want to pass a variable to the exe using ReadCustomerData. I searched online and i found something but not seems to working. http://superuser.com/questions/90515...nsis-installer code: I want the user when access the page downloads the exe and the variable have passed in the installer. Any help is appreciated Thanks |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
So, does setup.exe have the data embedded when you download it or is this a server issue?
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Jun 2011
Posts: 7
|
Hi Anders,
Thanks for the reply. I don't know how to pass the parameter to exe with php and download it. |
![]() |
![]() |
![]() |
#4 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
If this is a PHP question then this is not the right place to ask questions...
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#5 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
xliner78, not quite sure what you want
![]() PHP script is something that runs on a server. NSIS installer runs on the local computer. But if you actually want to invoke a PHP script on the server, from your local NSIS installer, then you have to send a HTTP request to the server and store/evaluate the corresponding HTTP response. Parameters may be passed in the "query string" part of the URL. Look into the Inetc plug-in! [EDIT] If you actually want the installer EXE to have the "customer data" built-in, it would be a pretty bad idea to just append this extra data to the finished EXE file. Instead, pass it to MakeNSIS via /D switch when you compile the installer! For example, if you pass /DFoo=Bar to MakeNSIS when compiling the installer, then you can get the passed value ("Bar") by using ${Foo} placeholder inside the installer script. My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#6 |
Junior Member
Join Date: Jun 2011
Posts: 7
|
Anders is not actually a php question.
Because i also don't know how to pass the parameter testvariable inside the script. I read the documentation but i still cannot make it working? |
![]() |
![]() |
![]() |
#7 | |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
Quote:
I'll ask again, when you download the .exe from the server, is your data appended to the file or not? Check with a hex editor. We cannot continue until you answer this question... IntOp $PostCount $PostCount + 1 |
|
![]() |
![]() |
![]() |
#8 |
Junior Member
Join Date: Jun 2011
Posts: 7
|
Hi Anders,
Now i understand. When the file downloaded there is nothing appended.My problem is how to append it. How to append the data manually on my computer? I already tried to open the exe with notepad (with SetCompress off) I added in the end of file mydata:testvariable and the installed destroyed Thanks for you helping me Anders |
![]() |
![]() |
![]() |
#9 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
You cannot edit .exe files in notepad, use a hex editor. If you just want to append a string you can start cmd.exe and type "echo Hello World >> MySetup.exe".
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#10 |
Junior Member
Join Date: Jun 2011
Posts: 7
|
Hi Anders.
Thanks for the help . I finally found how to also edit it with php on the fly without changing the installer.exe every time. Here is the full solution Here is the php code you will need code: Add this function to your script code: And to get the appended data use this code: Where $R1 is your appended data. |
![]() |
![]() |
![]() |
|
Tags |
nsis, php, variable |
Thread Tools | Search this Thread |
Display Modes | |
|
|