Name "Play Radio Station"
OutFile "Play Radio Station.exe"
InstallDir $EXEDIR
RequestExecutionLevel User
SetCompressor /SOLID lzma
SetCompressorDictSize 32
!include MUI.nsh
!include nsDialogs.nsh
!include FileFunc.nsh
!include WinMessages.nsh
!include nsisbass.nsh
BrandingText " "
Page custom Play.Radio.Station /ENABLECANCEL
Page instfiles
!insertmacro MUI_LANGUAGE "ENGLISH"
Function .onInit
${NSISBASS_Init}
FunctionEnd
Function Play.Radio.Station
Var /GLOBAL Dialog
Var /GLOBAL ComboBox
var /GLOBAL Btn_Play
var /GLOBAL Btn_Stop
var /GLOBAL HTTP
nsDialogs::Create /NOUNLOAD 1044
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
SetCtlColors $Dialog 0xCDCDCD 0x2A2A2A
nsDialogs::CreateControl /NOUNLOAD STATIC 0x40000000|0x10000000|0x04000000|0x00000100 0x00000020 14u 30u 165u 10u "Play Radio Station: "
Pop $0
SetCtlColors $0 0xCDCDCD 0x2A2A2A
Strcpy $HTTP "http://live.radiointens.ro:8010/"
nsDialogs::CreateControl /NOUNLOAD COMBOBOX 0x40000000|0x10000000|0x04000000|0x00010000|0x00200000|0x02000000|0x0040|0x0200|0x0002 0 15u 50u 235u 15u ""
Pop $ComboBox
StrCpy $1 $ComboBox
GetFunctionAddress $3 "on.ComboBox.Change"
nsDialogs::OnChange $1 $3
SendMessage $ComboBox 0x0143 0 "STR:-- Radio Station"
SendMessage $ComboBox 0x0143 0 "STR:$HTTP"
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $1 $0 1017
Strcpy $1 $ComboBox
SetCtlColors $1 0xCDCDCD 0x2A2A2A
System::Call '*(i 52, i, i, i, i, i, i, i, i, i, i, i, i 0) i .r0'
System::Call 'user32::GetComboBoxInfo(i r1, i r0)'
System::Call '*$0(i, i, i, i, i, i, i, i, i, i, i, i, i .r1)'
System::Free $0
SetCtlColors $1 0xCDCDCD 0x2A2A2A
nsDialogs::CreateControl /NOUNLOAD BUTTON 0x40000000|0x10000000|0x04000000|0x00010000 0 15u 70u 60u 15u "&Play..."
Pop $Btn_Play
StrCpy $1 $Btn_Play
GetFunctionAddress $0 "BassRadioPlayNet"
nsDialogs::OnClick $1 $0
SetCtlColors $Btn_Play 0xCDCDCD 0x2A2A2A
nsDialogs::CreateControl /NOUNLOAD BUTTON 0x40000000|0x10000000|0x04000000|0x00010000 0 90u 70u 60u 15u "&Stop..."
Pop $Btn_Stop
StrCpy $1 $Btn_Stop
GetFunctionAddress $0 "BassRadioPStop"
nsDialogs::OnClick $1 $0
SetCtlColors $Btn_Stop 0xCDCDCD 0x2A2A2A
nsDialogs::Show
FunctionEnd
Function "on.ComboBox.Change"
Var /GLOBAL txtComboBox
Pop $Combobox
${NSD_GetText} $ComboBox $txtComboBox
${If} $txtComboBox == "$HTTP"
${If} $HTTP != ""
${Switch} $txtComboBox
${Case} '$HTTP'
Strcpy $1 1
Call BassRadioComboBoxAdd
${Break}
${EndSwitch}
${Else}
MessageBox MB_OK|MB_USERICON 'Please add your valid radio station!'
Abort
${EndIf}
${EndIf}
FunctionEnd
Function "BassRadioComboBoxAdd"
${NSISBASS_ErrorGetCode}
${If} $0 = 0
SendMessage $ComboBox ${CB_FINDSTRING} 0 "STR:$txtComboBox" $0
${If} $0 = -1
SendMessage $ComboBox ${CB_ADDSTRING} 0 "STR:$txtComboBox"
${EndIf}
${EndIf}
FunctionEnd
Function "BassRadioPlayNet"
${NSISBASS_PlayNet} $txtComboBox 0 0 0 0
FunctionEnd
Function "BassRadioPStop"
${NSISBASS_Stop}
FunctionEnd
Section
SectionEnd
Function .onGUIEnd
${NSISBASS_Free}
FunctionEnd Play Radio Station
3 posts
Play Winamp Pls File
Name "Play Winamp Pls"
OutFile "Play Winamp Pls.exe"
InstallDir $EXEDIR
RequestExecutionLevel User
SetCompressor /SOLID lzma
SetCompressorDictSize 32
!include MUI.nsh
!include nsDialogs.nsh
!include FileFunc.nsh
!include WinMessages.nsh
!include nsisbass.nsh
BrandingText " "
Page custom Play.Winamp.Pls /ENABLECANCEL
Page instfiles
!insertmacro MUI_LANGUAGE "ENGLISH"
Function .onInit
${NSISBASS_Init}
FunctionEnd
Function Play.Winamp.Pls
Var /GLOBAL Dialog
Var /GLOBAL PATHURL
var /GLOBAL Btn_Add
var /GLOBAL Btn_Play
var /GLOBAL Btn_Stop
nsDialogs::Create /NOUNLOAD 1044
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
SetCtlColors $Dialog 0xFFD99F 0x382F2D
nsDialogs::CreateControl /NOUNLOAD STATIC 0x40000000|0x10000000|0x04000000|0x00000100 0x00000020 14u 30u 165u 10u "Play Radio Station: "
Pop $0
SetCtlColors $0 0xFFD99F 0x382F2D
# Path Url
nsDialogs::CreateControl EDIT 0x40000000|0x10000000|0x04000000|0x00010000|0x00000080 0 15u 50u 160u 15u ""
Pop $PATHURL
SetCtlColors $PATHURL 0xFFD99F 0x5f5857
# Btn Add
nsDialogs::CreateControl BUTTON 0x40000000|0x10000000|0x04000000|0x00010000 0 185u 50u 50u 15u "Add..."
Pop $Btn_Add
Strcpy $1 $Btn_Add
GetFunctionAddress $3 "on.Click.Add"
nsDialogs::onClick $1 $3
SetCtlColors $Btn_Add 0xFFD99F 0x382F2D
nsDialogs::CreateControl /NOUNLOAD BUTTON 0x40000000|0x10000000|0x04000000|0x00010000 0 15u 70u 60u 15u "&Play..."
Pop $Btn_Play
StrCpy $1 $Btn_Play
GetFunctionAddress $0 "BassRadioPlayNet"
nsDialogs::OnClick $1 $0
SetCtlColors $Btn_Play 0xFFD99F 0x382F2D
nsDialogs::CreateControl /NOUNLOAD BUTTON 0x40000000|0x10000000|0x04000000|0x00010000 0 90u 70u 60u 15u "&Stop..."
Pop $Btn_Stop
StrCpy $1 $Btn_Stop
GetFunctionAddress $0 "BassRadioPStop"
nsDialogs::OnClick $1 $0
SetCtlColors $Btn_Stop 0xFFD99F 0x382F2D
nsDialogs::Show
FunctionEnd
var /global MYFILESTYPE
var /GLOBAL URLSTATION
Function on.Click.Add
nsDialogs::SelectFileDialog "open" "C:\" "Open Winamp Pls|*.pls"
Pop $0
StrCpy $MYFILESTYPE "$0"
${If} $MYFILESTYPE != ""
ReadINIStr $URLSTATION "$MYFILESTYPE" "Playlist" "File1"
${NSD_SetText} $PATHURL "$URLSTATION"
${EndIf}
FunctionEnd
Function "BassRadioPlayNet"
${NSISBASS_PlayNet} $URLSTATION 0 0 0 0
FunctionEnd
Function "BassRadioPStop"
${NSISBASS_Stop}
FunctionEnd
Section
SectionEnd
Function .onGUIEnd
${NSISBASS_Free}
FunctionEnd Nice examples, can you post them to wiki?
Forum is not a best place for this.
Forum is not a best place for this.