[45a06a]: vs2008 / tesseract.nsi Maximize Restore History

Download this file

tesseract.nsi    613 lines (533 with data), 23.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
; (C) Copyright 2010, Sergey Bronnikov
; Contrib: Zdenko PodobnĂ˝ (C) 2010, 2011
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
; http://www.apache.org/licenses/LICENSE-2.0
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
; TODO:
; - insert sexy tesseract logos and artwork in installer instead default pictures ;)
; - add installation of language files
; - improve localization
; - add logging functions
; - "is user admin" detection
; - replace hardcoded program name to variables (NAME and LONGNAME)
; - place shortcuts in program files for all users
!define VERSION 3.01
!define PRODUCT_NAME "Tesseract-OCR"
!define PRODUCT_VERSION "${VERSION}"
!define PRODUCT_PUBLISHER "Tesseract-OCR community"
!define PRODUCT_WEB_SITE "http://code.google.com/p/tesseract-ocr"
;!define PRODUCT_DIR_REGKEY "Software/Microsoft"
;!define PRODUCT_UNINST_KEY "Software/Microsoft"
;!define PRODUCT_UNINST_ROOT_KEY "Software/Microsoft"
SetCompressor /FINAL /SOLID lzma
;SetCompressor lzma
SetCompressorDictSize 32
Name "Tesseract-OCR ${VERSION}"
Caption "Tesseract-OCR ${VERSION}"
;Icon "icon_1.ico"
;UninstallIcon "install_icon.ico"
BrandingText /TRIMCENTER "(c) 2010 Tesseract-OCR "
InstallDir "$PROGRAMFILES\Tesseract-OCR"
InstallDirRegKey HKCU "Software\Tesseract-OCR" ""
ShowInstDetails show
XPStyle on
SpaceTexts
CRCCheck on
InstProgressFlags smooth colored
;Name of program and file
!ifdef VERSION
OutFile tesseract-ocr-setup-${VERSION}.exe
!else
OutFile tesseract-ocr-setup.exe
!endif
!include "MUI.nsh"
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-blue-full.ico"
!include "EnvVarUpdate.nsh"
!include Sections.nsh
!macro AddToPath
; set variable
; append bin path to user PATH environment variable
ReadRegStr $0 HKCU "Environment" "PATH"
WriteRegExpandStr HKCU "Environment" "PATH" "$INSTDIR;$0"
#${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$0;$INSTDIR" # this command destroys long variables like path...
; make sure windows knows about the change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
!macroend
!macro SetTESSDATA
${EnvVarUpdate} $0 "TESSDATA_PREFIX" "A" "HKCU" "$INSTDIR\"
; make sure windows knows about the change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
!macroend
!macro Download_Lang_Data Lang
StrCpy $1 ${Lang}
StrCpy $2 "$INSTDIR\tessdata\$1"
inetc::get /caption "Downloading $1" /popup "" "http://tesseract-ocr.googlecode.com/files/$1" $2 /end
Pop $0 # return value = exit code, "OK" if OK
StrCmp $0 "OK" dlok
MessageBox MB_OK|MB_ICONEXCLAMATION "http download error. Download Status of $1: $0. Click OK to continue." /SD IDOK
Goto error
dlok:
untgz::extract "-j" $2
Delete $2
error:
!macroend
;MUI Settings
!define MUI_ABORTWARNING
;!define MUI_ICON "install_icon.ico"
;!define MUI_UNICON "uninstall_icon.ico"
;Welcome page
!define MUI_HEADERIMAGE
;
;!define MUI_HEADERIMAGE_BITMAP "452.bmp"
;!define MUI_HEADERIMAGE_UNBITMAP "452.bmp"
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
;;!define MUI_HEADERIMAGE_RIGHT
;!define MUI_WELCOMEFINISHPAGE_BITMAP "logo.bmp"
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_COMPONENTSPAGE_SMALLDESC
;--------------------------------
;Pages
;License page
!define MUI_LICENSEPAGE_CHECKBOX
;!define MUI_LICENSEPAGE_TEXT "$(License)"
;!insertmacro MUI_PAGE_LICENSE "${MUI_LICENSEPAGE_TEXT}"
!insertmacro MUI_PAGE_LICENSE "..\COPYING"
!ifdef VERSION
Page custom PageReinstall PageLeaveReinstall
!endif
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_LINK "http://code.google.com/p/tesseract-ocr/"
!define MUI_FINISHPAGE_LINK_LOCATION "http://code.google.com/p/tesseract-ocr/"
;!define MUI_FINISHPAGE_RUN "$INSTDIR\tesseract.exe"
;!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_SHOWREADME "notepad $INSTDIR\doc\README"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadme
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "SpanishInternational"
;--------------------------------
;Installer Sections
ShowInstDetails show
InstProgressFlags smooth colored
Section "Tesseract-OCR" SecDummy
; mark as read only component
SectionIn RO
SetOutPath "$INSTDIR"
;files inclided in distribution
;File leptonlib.dll
File bin\tesseract.exe
File bin\cntraining.exe
File bin\combine_tessdata.exe
File bin\mftraining.exe
File bin\unicharset_extractor.exe
File bin\wordlist2dawg.exe
CreateDirectory "$INSTDIR\tessdata"
CreateDirectory "$INSTDIR\tessdata\configs"
SetOutPath "$INSTDIR\tessdata\configs"
File ..\tessdata\configs\ambigs.train
File ..\tessdata\configs\api_config
File ..\tessdata\configs\box.train
File ..\tessdata\configs\box.train.stderr
File ..\tessdata\configs\digits
File ..\tessdata\configs\hocr
File ..\tessdata\configs\inter
File ..\tessdata\configs\kannada
File ..\tessdata\configs\linebox
File ..\tessdata\configs\logfile
File ..\tessdata\configs\makebox
File ..\tessdata\configs\rebox
File ..\tessdata\configs\strokewidth
File ..\tessdata\configs\unlv
CreateDirectory "$INSTDIR\tessdata\tessconfigs"
SetOutPath "$INSTDIR\tessdata\tessconfigs"
File ..\tessdata\tessconfigs\batch
File ..\tessdata\tessconfigs\batch.nochop
File ..\tessdata\tessconfigs\matdemo
File ..\tessdata\tessconfigs\msdemo
File ..\tessdata\tessconfigs\nobatch
File ..\tessdata\tessconfigs\segdemo
CreateDirectory "$INSTDIR\doc"
SetOutPath "$INSTDIR\doc"
File ..\AUTHORS
File ..\COPYING
File ..\eurotext.tif
File ..\phototest.tif
File ..\README
File ..\ReleaseNotes
;Store installation folder
WriteRegStr HKCU "Software\Tesseract-OCR" "InstallDir" $INSTDIR
WriteRegStr HKCU "Software\Tesseract-OCR" "CurrentVersion" "${VERSION}"
;WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Tesseract-OCR" "$INSTDIR\tesseract.exe"
; include for some of the windows messages defines
!include "winmessages.nsh"
; HKLM (all users) vs HKCU (current user) defines
!define env_hkcu 'HKCU "Environment"'
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;ExecShell "open" "http://code.google.com/p/tesseract-ocr/"
;ExecShell "open" '"$INSTDIR"'
;BringToFront
; Register to Add/Remove program in control panel
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION} - open source OCR engine"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "QuietUninstallString" '"$INSTDIR\uninstall.exe" /S'
SectionEnd
;Section "Help" SecHelp
;CreateDirectory "$INSTDIR\Help"
;SetOutPath "$INSTDIR\Help"
;File "README"
;File "COPYING"
;SectionEnd
Section "Shortcuts creation" SecCS
CreateDirectory "$SMPROGRAMS\Tesseract-OCR"
;TODO create a simple GUI for 3.01 release
;CreateShortCut "$SMPROGRAMS\Tesseract-OCR\Tesseract-OCR.lnk" "$INSTDIR\tesseract.exe" "" "$INSTDIR\tesseract.exe" 0
CreateShortCut "$SMPROGRAMS\Tesseract-OCR\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
;CreateShortCut "$DESKTOP\Tesseract-OCR.lnk" "$INSTDIR\tesseract.exe" "" "$INSTDIR\tesseract.exe" 0
;CreateShortCut "$QUICKLAUNCH\.lnk" "$INSTDIR\tesseract.exe" "" "$INSTDIR\tesseract.exe" 0
SectionEnd
SectionGroup "Registry setttings" SecRS
Section "Add to Path" SecRS_path
!insertmacro AddToPath
SectionEnd
Section "Set TESSDATA_PREFIX variable" SecRS_tessdata
!insertmacro SetTESSDATA
SectionEnd
SectionGroupEnd
; Download language files
SectionGroup "Language data" SecGrp_LD
Section "English language data" SecLang_eng
SectionIn RO
SetOutPath "$INSTDIR\tessdata"
File ..\tessdata\eng.*
SectionEnd
Section /o "Download and install Bulgarian language data" SecLang_bul
!insertmacro Download_Lang_Data tesseract-ocr-3.01.bul.tar.gz
SectionEnd
Section /o "Download and install Catalan language data" SecLang_cat
!insertmacro Download_Lang_Data tesseract-ocr-3.01.cat.tar.gz
SectionEnd
Section /o "Download and install Czech language data" SecLang_ces
!insertmacro Download_Lang_Data tesseract-ocr-3.01.ces.tar.gz
SectionEnd
Section /o "Download and install Chinese (Traditional) language data" SecLang_chi_tra
!insertmacro Download_Lang_Data tesseract-ocr-3.01.chi_tra.tar.gz
SectionEnd
Section /o "Download and install Chinese (Simplified) language data" SecLang_chi_sim
!insertmacro Download_Lang_Data tesseract-ocr-3.01.chi_sim.tar.gz
SectionEnd
Section /o "Download and install Danish language data" SecLang_dan
!insertmacro Download_Lang_Data tesseract-ocr-3.01.dan.tar.gz
SectionEnd
Section /o "Download and install Danish (Fraktur) language data" SecLang_dan_frak
!insertmacro Download_Lang_Data tesseract-ocr-3.01.dan-frak.tar.gz
SectionEnd
Section /o "Download and install Dutch language data" SecLang_nld
!insertmacro Download_Lang_Data tesseract-ocr-3.01.nld.tar.gz
SectionEnd
Section /o "Download and install German language data" SecLang_deu
!insertmacro Download_Lang_Data tesseract-ocr-3.01.deu.tar.gz
SectionEnd
Section /o "Download and install Greek language data" SecLang_ell
!insertmacro Download_Lang_Data tesseract-ocr-3.01.ell.tar.gz
SectionEnd
Section /o "Download and install Finnish language data" SecLang_fin
!insertmacro Download_Lang_Data tesseract-ocr-3.01.fin.tar.gz
SectionEnd
Section /o "Download and install French language data" SecLang_fra
!insertmacro Download_Lang_Data tesseract-ocr-3.01.fra.tar.gz
SectionEnd
Section /o "Download and install Hungarian language data" SecLang_hun
!insertmacro Download_Lang_Data tesseract-ocr-3.01.hun.tar.gz
SectionEnd
Section /o "Download and install Indonesian language data" SecLang_ind
!insertmacro Download_Lang_Data tesseract-ocr-3.01.ind.tar.gz
SectionEnd
Section /o "Download and install Italian language data" SecLang_ita
!insertmacro Download_Lang_Data tesseract-ocr-3.01.ita.tar.gz
SectionEnd
Section /o "Download and install Japanese language data" SecLang_jpn
!insertmacro Download_Lang_Data tesseract-ocr-3.01.jpn.tar.gz
SectionEnd
Section /o "Download and install Korean language data" SecLang_kor
!insertmacro Download_Lang_Data tesseract-ocr-3.01.kor.tar.gz
SectionEnd
Section /o "Download and install Latvian language data" SecLang_lav
!insertmacro Download_Lang_Data tesseract-ocr-3.01.lav.tar.gz
SectionEnd
Section /o "Download and install Lithuanian language data" SecLang_lit
!insertmacro Download_Lang_Data tesseract-ocr-3.01.lit.tar.gz
SectionEnd
Section /o "Download and install Norwegian language data" SecLang_nor
!insertmacro Download_Lang_Data tesseract-ocr-3.01.nor.tar.gz
SectionEnd
Section /o "Download and install Polish language data" SecLang_pol
!insertmacro Download_Lang_Data tesseract-ocr-3.01.pol.tar.gz
SectionEnd
Section /o "Download and install Portuguese language data" SecLang_por
!insertmacro Download_Lang_Data tesseract-ocr-3.01.por.tar.gz
SectionEnd
Section /o "Download and install Romanian language data" SecLang_ron
!insertmacro Download_Lang_Data tesseract-ocr-3.01.ron.tar.gz
SectionEnd
Section /o "Download and install Russian language data" SecLang_rus
!insertmacro Download_Lang_Data tesseract-ocr-3.01.rus.tar.gz
SectionEnd
Section /o "Download and install Slovak language data" SecLang_slk
!insertmacro Download_Lang_Data tesseract-ocr-3.01.slk.tar.gz
SectionEnd
Section /o "Download and install Slovak (Fraktur) language data" SecLang_slk_frak
!insertmacro Download_Lang_Data tesseract-ocr-3.01.slk-frak.tar.gz
SectionEnd
Section /o "Download and install Slovenian language data" SecLang_slv
!insertmacro Download_Lang_Data tesseract-ocr-3.01.slv.tar.gz
SectionEnd
Section /o "Download and install Spanish language data" SecLang_spa
!insertmacro Download_Lang_Data tesseract-ocr-3.01.spa.tar.gz
SectionEnd
Section /o "Download and install Serbian language data" SecLang_srp
!insertmacro Download_Lang_Data tesseract-ocr-3.01.srp.tar.gz
SectionEnd
Section /o "Download and install Swedish language data" SecLang_swe
!insertmacro Download_Lang_Data tesseract-ocr-3.01.swe.tar.gz
SectionEnd
Section /o "Download and install Tagalog language data" SecLang_tgl
!insertmacro Download_Lang_Data tesseract-ocr-3.01.tgl.tar.gz
SectionEnd
Section /o "Download and install Turkish language data" SecLang_tur
!insertmacro Download_Lang_Data tesseract-ocr-3.01.tur.tar.gz
SectionEnd
Section /o "Download and install Ukrainian language data" SecLang_ukr
!insertmacro Download_Lang_Data tesseract-ocr-3.01.ukr.tar.gz
SectionEnd
Section /o "Download and install Vietnamese language data" SecLang_vie
!insertmacro Download_Lang_Data tesseract-ocr-3.01.vie.tar.gz
SectionEnd
SectionGroupEnd
;--------------------------------
;Descriptions
; At first we need to localize installer for languages which supports well in tesseract: Eng, Spa, Ger, Ita, Dutch + Russian (it is authors native language)
;Language strings
LangString DESC_SecDummy ${LANG_RUSSIAN} "Установочные файлы."
;LangString DESC_SecHelp ${LANG_RUSSIAN} "Справочная информация."
LangString DESC_SecCS ${LANG_RUSSIAN} "Добавить ярлыки в меню Пуск"
LangString DESC_SecDummy ${LANG_ENGLISH} "Installation files."
;LangString DESC_SecHelp ${LANG_ENGLISH} "Help information."
LangString DESC_SecCS ${LANG_ENGLISH} "Add shortcuts to Start menu."
LangString DESC_SecDummy ${LANG_ITALIAN} "File di installazione."
;LangString DESC_SecHelp ${LANG_ITALIAN} "Guida di informazioni."
LangString DESC_SecCS ${LANG_ITALIAN} "Aggiungere collegamenti al menu Start."
LangString DESC_SecDummy ${LANG_SLOVAK} "SĂşbory inĹĄtalĂĄcie."
;LangString DESC_SecHelp ${LANG_ENGLISH} "PomocnĂŠ informĂĄcie."
LangString DESC_SecCS ${LANG_SLOVAK} "PridaĹĽ odkaz do Start menu."
LangString DESC_SecDummy ${LANG_SPANISH} "Los archivos de instalaciĂłn."
;LangString DESC_SecHelp ${LANG_SPANISH} "InformaciĂłn de ayuda."
LangString DESC_SecCS ${LANG_SPANISH} "Ańadir accesos directos al menú Inicio."
LangString DESC_SecDummy ${LANG_SPANISHINTERNATIONAL} "Los archivos de instalaciĂłn."
;LangString DESC_SecHelp ${LANG_SPANISHINTERNATIONAL} "InformaciĂłn de ayuda."
LangString DESC_SecCS ${LANG_SPANISHINTERNATIONAL} "Ańadir accesos directos al menú Inicio."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_DESCRIPTION_TEXT ${SecCS} $(DESC_SecCS)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create desktop shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDeskShortcut
Delete "$INSTDIR\*.*"
Delete "$SMPROGRAMS\Tesseract-OCR\*.*"
Delete "$INSTDIR\training\*.*"
Delete "$INSTDIR\doc\*.*"
Delete "$INSTDIR\tessdata\*.*"
Delete "$INSTDIR\tessdata\configs\*.*"
Delete "$INSTDIR\tessdata\tessconfigs\*.*"
RMDir "$INSTDIR\training"
RMDir "$INSTDIR\doc"
RMDir "$INSTDIR\tessdata\configs"
RMDir "$INSTDIR\tessdata\tessconfigs"
RMDir "$INSTDIR\tessdata"
;Delete "$DESKTOP\Tesseract-OCR.lnk"
;Delete "$QUICKLAUNCH\Tesseract-OCR.lnk"
RMDir "$SMPROGRAMS\Tesseract-OCR"
;MessageBox MB_YESNO "Delete all configuration data? This will save a lot of space, but at the expense of reconfiguring..." IDNO skip_cfg
;RMDir /r $APPDATA\Tesseract-OCR
;skip_cfg:
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
; remove the Add/Remove information
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
;DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Run\Tesseract-OCR"
;DeleteRegKey /ifempty HKCU "Software\Tesseract-OCR"
DeleteRegKey HKCU "Software\Tesseract-OCR"
; delete variable
${un.EnvVarUpdate} $0 "PATH" "R" "HKCU" $INSTDIR
;DeleteRegValue ${env_hkcu} "TESSDATA_PREFIX"
!define env_user 'HKCU "Environment"'
DeleteRegValue ${env_user} "TESSDATA_PREFIX"
; make sure windows knows about the change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
Function PageReinstall
FunctionEnd
Function PageLeaveReinstall
FunctionEnd
Function .onInit
; is tesseract already installed?
readRegStr $R0 HKCU "Software\Tesseract-OCR" "CurrentVersion"
StrCmp $R0 "" SkipUnInstall
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Tesseract-ocr version $R0 is installed! Do you want to uninstall it first?$\nUninstall will delete all files in '$INSTDIR'!" \
/SD IDYES IDNO SkipUnInstall IDYES UnInstall
UnInstall:
readRegStr $R1 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString"
ClearErrors
ExecWait '$R1 _?=$INSTDIR'
SkipUnInstall:
MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install ${PRODUCT_NAME} ${VERSION}?" \
/SD IDYES IDNO no IDYES yes
no:
SetSilent silent
Goto done
yes:
SetSilent normal
;InitPluginsDir
;File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp"
;File /oname=$PLUGINSDIR\splash.bmp "new.bmp"
;advsplash::show 1000 600 400 -1 $PLUGINSDIR\splash
;Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normal, and '-1' if some error occured.
;IfFileExists $INSTDIR\loadmain.exe PathGood
done:
; Make selection based on System language ID
System::Call 'kernel32::GetSystemDefaultLangID() i .r0'
;http://msdn.microsoft.com/en-us/library/dd318693%28v=VS.85%29.aspx
StrCmp $0 "1026" Bulgarian
StrCmp $0 "1027" Catalan
StrCmp $0 "1029" Czech
StrCmp $0 "31748" Chinese_tra
StrCmp $0 "4" Chinese_sim
StrCmp $0 "1030" Danish
StrCmp $0 "2067" Dutch
StrCmp $0 "3079" German
StrCmp $0 "1032" Greek
StrCmp $0 "1035" Finnish
StrCmp $0 "2060" French
StrCmp $0 "1038" Hungarian
StrCmp $0 "1057" Indonesian
StrCmp $0 "1040" Italian
StrCmp $0 "1041" Japanese
StrCmp $0 "1042" Korean
StrCmp $0 "1062" Latvian
StrCmp $0 "1063" Lithuanian
StrCmp $0 "1044" Norwegian
StrCmp $0 "1045" Polish
StrCmp $0 "1046" Portuguese
StrCmp $0 "1048" Romanian
StrCmp $0 "1049" Russian
StrCmp $0 "1051" Slovak
StrCmp $0 "1060" Slovenian
StrCmp $0 "11274" Spanish
StrCmp $0 "2074" Serbian
StrCmp $0 "2077" Swedish
;StrCmp $0 "0000" Tagalog
StrCmp $0 "1055" Turkish
StrCmp $0 "1058" Ukrainian
StrCmp $0 "1066" Vietnamese
Goto lang_end
Bulgarian: !insertmacro SelectSection ${SecLang_bul}
Goto lang_end
Catalan: !insertmacro SelectSection ${SecLang_cat}
Goto lang_end
Czech: !insertmacro SelectSection ${SecLang_ces}
Goto lang_end
Chinese_tra: !insertmacro SelectSection ${SecLang_chi_tra}
Goto lang_end
Chinese_sim: !insertmacro SelectSection ${SecLang_chi_sim}
Goto lang_end
Danish: !insertmacro SelectSection ${SecLang_dan}
!insertmacro SelectSection ${SecLang_dan_frak}
Goto lang_end
Dutch: !insertmacro SelectSection ${SecLang_nld}
Goto lang_end
German: !insertmacro SelectSection ${SecLang_deu}
Goto lang_end
Greek: !insertmacro SelectSection ${SecLang_ell}
Goto lang_end
Finnish: !insertmacro SelectSection ${SecLang_fin}
Goto lang_end
French: !insertmacro SelectSection ${SecLang_fra}
Goto lang_end
Hungarian: !insertmacro SelectSection ${SecLang_hun}
Goto lang_end
Indonesian: !insertmacro SelectSection ${SecLang_ind}
Goto lang_end
Italian: !insertmacro SelectSection ${SecLang_ita}
Goto lang_end
Japanese: !insertmacro SelectSection ${SecLang_jpn}
Goto lang_end
Korean: !insertmacro SelectSection ${SecLang_kor}
Goto lang_end
Latvian: !insertmacro SelectSection ${SecLang_lav}
Goto lang_end
Lithuanian: !insertmacro SelectSection ${SecLang_lit}
Goto lang_end
Norwegian: !insertmacro SelectSection ${SecLang_nor}
Goto lang_end
Polish: !insertmacro SelectSection ${SecLang_pol}
Goto lang_end
Portuguese: !insertmacro SelectSection ${SecLang_por}
Goto lang_end
Romanian: !insertmacro SelectSection ${SecLang_ron}
Goto lang_end
Russian: !insertmacro SelectSection ${SecLang_rus}
Goto lang_end
Slovak: !insertmacro SelectSection ${SecLang_slk}
!insertmacro SelectSection ${SecLang_slk_frak}
Goto lang_end
Slovenian: !insertmacro SelectSection ${SecLang_slv}
Goto lang_end
Spanish: !insertmacro SelectSection ${SecLang_spa}
Goto lang_end
Serbian: !insertmacro SelectSection ${SecLang_srp}
Goto lang_end
Swedish: !insertmacro SelectSection ${SecLang_swe}
Goto lang_end
;Tagalog: !insertmacro SelectSection ${SecLang_tgl}
; Goto lang_end
Turkish: !insertmacro SelectSection ${SecLang_tur}
Goto lang_end
Ukrainian: !insertmacro SelectSection ${SecLang_ukr}
Goto lang_end
Vietnamese: !insertmacro SelectSection ${SecLang_vie}
lang_end:
FunctionEnd
Function un.onInit
;!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
Function .onInstFailed
MessageBox MB_OK "Installation failed."
FunctionEnd
Function ShowReadme
Exec "explorer.exe $INSTDIR\doc\README"
BringToFront
FunctionEnd