Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 8th August 2008, 22:12   #1
zorg117
Junior Member
 
Join Date: Aug 2008
Posts: 6
Question Calling a 'to be' installed script before extracting the files to output folder

Hi All,

I am fairly new to NSIS and am trying to figure out a way to run a VBScript on the target system and obtain certain information from it before modifying the target system in any way (including extracting the files). This is the business requirement. I need to make sure that I gather all the input from the user and then verify that it is valid (using the VBScript that is to be run on the target system) and then finally install the files.

Below is my page flow, I am using MUI2 with custom pages:
.....
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.rtf"
Page custom SetUpConfiguration CheckConfiguration
Page custom ConfigurationErrorHandling
!insertmacro MUI_PAGE_INSTFILES
....

The CheckConfiguration function is trying to execute the VBScript but it is not working right now.
zorg117 is offline   Reply With Quote
Old 8th August 2008, 23:19   #2
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 644
This way you can run a VBScript and capture the output:

code:
SetOutPath $INSTDIR
File "C:\My Scripts\Foobar.vbs"

nsExec:execToStack '"$SYSTEM\CScript.exe" "$INSTDIR\Foobar.vbs"'
Pop $0
Pop $1

StrCmp $0 "error" +2
MessageBox MB_OK "Result: $1"



But why not do it directly in NSIS ???

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI

Last edited by LoRd_MuldeR; 8th August 2008 at 23:39.
LoRd_MuldeR is offline   Reply With Quote
Old 8th August 2008, 23:30   #3
zorg117
Junior Member
 
Join Date: Aug 2008
Posts: 6
Thank you for the response. I need to check and see if the solution you suggested works inside a function. I am looking for something that goes inside a function. I am trying to avoid writing the code in NSIS as the VBScript code I have is huge!
zorg117 is offline   Reply With Quote
Old 8th August 2008, 23:36   #4
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 644
Yes, this will work perfectly fine in a function

But you will depend on Windows Scripting Host, which is *NOT* installed on all Windows systems and which is *DISABLED* on many system...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 8th August 2008, 23:51   #5
zorg117
Junior Member
 
Join Date: Aug 2008
Posts: 6
Thanks man, I am going to check it out now. I have a check for the WSH. I made the code in such a way that the installer aborts if WSH is missing or disabled. The product will be installed in a lhighly restricted environment with limited users so as long as it works well in that environment I am happy
zorg117 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump