WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > CONTRIB: Pre-Compile Prompt Dialog
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
Zinthose
Member

Registered: May 2009
From:

CONTRIB: Pre-Compile Prompt Dialog

Prompt Before Compilation

Description
With a simple VBScript dropped on the system path, you can allow your NSIS scripts to prompt prior to compilation. I've found this useful to alert me to packages that require a significant amount of time to compile.

Usage

quote:
!system 'MsgBox.vbs "Package will take a long time to compile.\n\nAverage Compilation Time: 54 min 35 sec\n\n\tContinue?" "NSIS Compilation"' = 1

VB Script
Save the following VBScript as "MsgBox.vbs" in a location that is listed in the %PATH%.

quote:
'vbscript
'MsgBox.vbs


Dim Caption 'As String
Dim Prompt 'As String

'** Defaults
Caption = "What do you want to do?"
Prompt = "Proceed?"

'** Apply CmdLine Arguments
If WScript.Arguments.Count => 1 Then _
Prompt = WScript.Arguments.Item(0)

If WScript.Arguments.Count => 2 Then _
Caption = WScript.Arguments.Item(1)

'** Allow Meta characters
Prompt = Replace(Prompt, "\r", vbCr)
Prompt = Replace(Prompt, "\n", vbLf)
Prompt = Replace(Prompt, "\t", vbTab)

'** Display Prompt
WScript.Quit [COLOR=blue]MsgBox(Prompt, 289, Caption)

Quick Link | Report this post to a moderator | IP: Logged

Zinthose is offline Old Post 11-09-2009 06:59 PM
Click Here to See the Profile for Zinthose Click here to Send Zinthose a Private Message Find more posts by Zinthose Add Zinthose to your buddy list Edit/Delete Message Reply w/Quote
MSG
Senior Member

Registered: Oct 2006
From:

A smart way of handling stuff outside the compiler without the need for an extra open window. Thanks for sharing.

Quick Link | Report this post to a moderator | IP: Logged

MSG is offline Old Post 11-09-2009 08:30 PM
Click Here to See the Profile for MSG Click here to Send MSG a Private Message Find more posts by MSG Add MSG to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

you could also create this script at run time with !appendfile and !delfile in $%temp%

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 11-09-2009 11:02 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
Zinthose
Member

Registered: May 2009
From:

Good Idea Anders!

Prompt Before Compilation

Description

Using a dynamic vbscript created at compile time, you can allow your NSIS scripts to prompt prior to compilation. I've found this useful to alert me to packages that require a significant amount of time to compile.
Usage

quote:
${!MsgBox} "WARNING: Package can take a long time to compile.\nAverage Compilation Time: 54 min 35 sec" "NSIS Compilation"

NSIS Macro
quote:
!define !MsgBox `!insertmacro _!MsgBox`
!macro _!MsgBox _Message _Caption
    !verbose push
    !verbose 0
    !tempfile MsgBox
    !appendfile "${MsgBox}" `WScript.Quit MsgBox(Replace(Replace(Replace("${_Message}","\t",vbTab),"\n",vbLf),"\r",vbCr),289,"${_Caption}")`
    !system `wscript.exe "${MsgBox}" //E:vbscript` = 1
    !delfile "${MsgBox}"
    !undef MsgBox
    !verbose pop
!macroend


Source: NSIS Wiki: Prompt Before Compilation

Quick Link | Report this post to a moderator | IP: Logged

Zinthose is offline Old Post 11-10-2009 08:54 PM
Click Here to See the Profile for Zinthose Click here to Send Zinthose a Private Message Find more posts by Zinthose Add Zinthose to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 09:20 PM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > CONTRIB: Pre-Compile Prompt Dialog
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON