You are here

Help required with custom.nsh

3 posts / 0 new
Last post
Mamun786
Offline
Last seen: 1 year 7 months ago
Joined: 2019-03-05 02:18
Help required with custom.nsh

Can anyone help me to combine the following two custom.nsh files. Separately Both codes work fine for me for registering dll, ocx, and font support . As I don't understand how to code custom.nsh , I can not combine both codes to support font and dll or ocx file together. Can anyone combine it in One custom.nsh file for me please.

Font Support

${SegmentFile}

!include WinMessages.nsh

${SegmentPrePrimary}
	;Load app ttf Fonts
	FindFirst $0 $1 "$EXEDIR\App\Fonts\*.ttf"
	${DoWhile} $1 != ""
		System::Call "gdi32::AddFontResource(t'$EXEDIR\App\Fonts\$1')i .r2"
		FindNext $0 $1
	${Loop}
	FindClose $0
	;Let all running apps know
	SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=1
!macroend

${SegmentPostPrimary}
	;Remove app ttf Fonts
	FindFirst $0 $1 "$EXEDIR\App\Fonts\*.ttf"
	${DoWhile} $1 != ""
		System::Call "gdi32::RemoveFontResource(t'$EXEDIR\App\Fonts\$1')i .r2"
		FindNext $0 $1
	${Loop}
	FindClose $0
	;Let all running apps know
	SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=1
!macroend

DLL or OCX file Registering

${SegmentFile}

${SegmentPrePrimary}
    ExecWait 'RegSvr32 /S "$AppDirectory\Subtitler\COMCTL32.OCX"'
    ExecWait 'RegSvr32 /S "$AppDirectory\Subtitler\divx.dll"'
!macroend

${SegmentPostPrimary}
    ExecWait 'RegSvr32 /U /S "$AppDirectory\Subtitler\COMCTL32.OCX"'
	ExecWait 'RegSvr32 /U /S "$AppDirectory\Subtitler\divx.dll"'
!macroend
John T. Haller
John T. Haller's picture
Offline
Last seen: 1 hour 20 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Combine

For something like this, you just combine the segment contents:

${SegmentFile}

!include WinMessages.nsh

${SegmentPrePrimary}
	;Load app ttf Fonts
	FindFirst $0 $1 "$EXEDIR\App\Fonts\*.ttf"
	${DoWhile} $1 != ""
		System::Call "gdi32::AddFontResource(t'$EXEDIR\App\Fonts\$1')i .r2"
		FindNext $0 $1
	${Loop}
	FindClose $0
	;Let all running apps know
	SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=1

    ExecWait 'RegSvr32 /S "$AppDirectory\DivXLandMediaSubtitler\COMCTL32.OCX"'
    ExecWait 'RegSvr32 /S "$AppDirectory\DivXLandMediaSubtitler\MSFLXGRD.OCX"'
!macroend

${SegmentPostPrimary}
	;Remove app ttf Fonts
	FindFirst $0 $1 "$EXEDIR\App\Fonts\*.ttf"
	${DoWhile} $1 != ""
		System::Call "gdi32::RemoveFontResource(t'$EXEDIR\App\Fonts\$1')i .r2"
		FindNext $0 $1
	${Loop}
	FindClose $0
	;Let all running apps know
	SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=1

    ExecWait 'RegSvr32 /U /S "$AppDirectory\DivXLandMediaSubtitler\COMCTL32.OCX"'
	ExecWait 'RegSvr32 /U /S "$AppDirectory\DivXLandMediaSubtitler\MSFLXGRD.OCX"'
!macroend

Sometimes, the impossible can become possible, if you're awesome!

Mamun786
Offline
Last seen: 1 year 7 months ago
Joined: 2019-03-05 02:18
Thanks for the reply.

I have already tried that. And PAL Creator successfully compiled it. But for some reason neither fonts not dll or ocx registering when using both codes together like you wrote above. I had used separate codes in many apps like a app called DivxMedia Subtitler which requires ocx registering, all worked well. But combining code isn't working.

Log in or register to post comments