![]() |
#1 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
NSIS CopyFiles
Hi,
I am doing one istaller with NSIS and i need to copy a file from previously installed program. I managed to do that and the file destination is desktop. But the question is that, is it possible that installer will ask where to paste that copyed file? Please help me if possible. Russell |
![]() |
![]() |
![]() |
#2 |
Forum King
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
|
Yea it's possible, you'd need to build and add a custom dialog (page), before the InstFiles page.
Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
Hello there,
Anybody has time to say more details!! Thanks for the reply. |
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
Or it possible to send the copied file to usb memory stick?
CopyFiles "$Source" "$Destination" So i did like this: CopyFiles "$C:\...." "$DESKTOP" But I want that it will promt that where to save the file. or go to usb memory stick. Please help. |
![]() |
![]() |
![]() |
#5 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
You must get the desired location into $Destination somehow before calling CopyFiles. I guess you'd better do this before proceeding to the "instfiles" page. You should use a "custom" page as suggested by Red Wine. First of all have a look at section "2.3.2 Pages" and "4.5.4 Page" in the NSIS manual! Then you must learn how to actually create a custom page, either via InstallOptions(Ex) or via nsDialogs. Have a look at "NSIS\Docs\InstallOptions\Readme.html", "NSIS\Docs\InstallOptionsEx\Readme.html" or "NSIS\Docs\nsDialogs\Readme.html". On your custom page you simply put a "DirRequest" control, which allows the user to choose the desired folder...
There are also examples in the "NSIS\Examples" folder ![]() My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#6 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
Thanks for reply. But seems to be so difficult to do.
|
![]() |
![]() |
![]() |
#7 | |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Quote:
![]() Look at the docs or simply adapt one of the example files... My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
|
![]() |
![]() |
![]() |
#8 | |
Senior Member
Join Date: Jul 2008
Posts: 157
|
Quote:
Which means that, instead of a "DirRequest" control inside a custom dialog, I am using NSIS's pre-made nsDialogs::SelectFolderDialog. However, I am having some weird problems, as described in this post. Apparently it's not that simple - or it is simple but I am missing something really fundamental. Any suggestion as to how to proceed from here? Perhaps I should have taken the DirRequest approach? |
|
![]() |
![]() |
![]() |
#9 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
What is the "nsDialogs::Show" at the end of your "PageDirSelect" function supposed to do?
Is it needed with nsDialogs::SelectFolderDialog ??? ![]() (I'm not at home right now, so I cannot test it from here - no NSIS) My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#10 | |
Senior Member
Join Date: Jul 2008
Posts: 157
|
Quote:
![]() ![]() Thank you so much, LoRd_MuldeR! I will now post the solution in the other thread as well, so that it may help others in the future. |
|
![]() |
![]() |
![]() |
#11 | |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Quote:
- Ken Thompson My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
|
![]() |
![]() |
![]() |
#12 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
I have a code that is making an installer with some normal pages such as:WELCOME,COMPONETNS,DIRECTORY,INSTFILES AND FINISH. So what i am trying to do is that after WELCOME page i need to copy a file from previous installed SW and save it somewhere. And wishing that installer will copy it and ask the user where to save. After saving that file in desired place the COMPONENTS page will appear and go forward. So do i need to do i need to make a totally separate page and call it somehow for saving file or i can make a custom page between WELCOME and COMPONENTS page? I am so out of my knowledge. Help......
|
![]() |
![]() |
![]() |
#13 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Since you mention "Welcome" and "Finish" pages, I have to assume you user MUI or MUI2. So simply put an addtional "custom" page between the MUI_WELCOME_PAGE and MUI_COMPONENTS_PAGE macros, just like:
code: Then let your custom page show the dialog box: code: My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#14 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
Thanks for the details and helpful reply. I am glad you loan me some knowledge from you.
So I make this custom page and need to use this custom page for saving a file which is copied by command "CopyFiles". So the idea is that i wish to use this custom page for saving that copied file to my desired destination. CopyFiles "$Source" "$Destination". Do you suggest me that i can use this custom page as a destination somehow. |
![]() |
![]() |
![]() |
#15 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
In fact you only use the "custom" page to display the SelectFolder dialog and let the user choose the desired destination folder. That folder will be stored in $varSelectedFolder and can be used at a later time. For example you can call CopyFiles in one of your install sections and use the target folder obtained before (it's still stored in $varSelectedFolder, unless you overwrote it ^^).
My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#16 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
Do u think, it is possible to choose "USB Memory stick" as a destination folder? For example if i choose the memory stick from the custom window and use that as a destination when i call CopyFiles.
|
![]() |
![]() |
![]() |
#17 | |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
Quote:
![]() My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
|
![]() |
![]() |
![]() |
#18 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
So what i will right on the desttination?
CopyFiles "$Source" "$?????" if i like to choose memory stick? Sorry for bothering you. |
![]() |
![]() |
![]() |
#19 |
Major Dude
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
|
If you use the code above, the folder selected by the user (via "Browse for Folder" dialog on the "custom" page) will be stored in $varSelectedFolder. That folder may or may not be located on an USB Memory Stick, depending on the user's choice. Anyways you can copy the files to the selected folder like this:
code: (Given that the correct source folder is stored in $Source already) My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc My source of inspiration: http://youtu.be/lCwY4_0W1YI |
![]() |
![]() |
![]() |
#20 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
Thanks for the guide. I am so glad. I am quite new in this field that's why i am always bothering you.
|
![]() |
![]() |
![]() |
#21 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
Is there any way to check how many processor in pc by NSIS script?
|
![]() |
![]() |
![]() |
#22 | |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,548
|
Quote:
IntOp $PostCount $PostCount + 1 |
|
![]() |
![]() |
![]() |
#23 |
Junior Member
Join Date: Nov 2008
Posts: 30
|
Really?
|
![]() |
![]() |
![]() |
#24 |
Junior Member
Join Date: Feb 2016
Posts: 48
|
Another way to copy files or folders
#Copy Files
PHP Code:
PHP Code:
|
![]() |
![]() |
![]() |
#25 |
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 923
|
This is pointless having an 'if' statement because both branches have the same code.
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|