/[cvs]/joko/ToolBox/Windows/w2hfax-installer/w2hfax.nsi
ViewVC logotype

Diff of /joko/ToolBox/Windows/w2hfax-installer/w2hfax.nsi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Wed Mar 23 01:56:03 2005 UTC revision 1.3 by joko, Wed Mar 23 11:30:19 2005 UTC
# Line 38  Page instfiles Line 38  Page instfiles
38  UninstPage uninstConfirm  UninstPage uninstConfirm
39  UninstPage instfiles  UninstPage instfiles
40    
   
   
 ; --------------------------------  
 ;   The stuff to install  
 ; --------------------------------  
   
   
41  Var python_path  Var python_path
42  Var python_version  Var python_version
43  Var python_url  Var python_url
44  Var python_msi  Var python_msi
45    
46    Var ghostscript_version
47    Var ghostscript_version_required
48    Var ghostview_version
49    Var ghostview_exe
50    
51    
52    ; --------------------------------
53    ;   The stuff to install
54    ; --------------------------------
55    
56  Section "Python" IDX_PYTHON  Section "Python" IDX_PYTHON
57    Call install_python    Call install_python
# Line 61  Section "Python for Win32 Extensions" ID Line 63  Section "Python for Win32 Extensions" ID
63    Call check_pythonwin    Call check_pythonwin
64  SectionEnd  SectionEnd
65    
66    Section "AFPL Ghostscript 8.50" IDX_GHOSTSCRIPT
67      Call install_ghostscript
68      Call check_ghostscript
69    SectionEnd
70    
71    Section "GSview 4.6" IDX_GHOSTVIEW
72      Call install_ghostview
73      Call check_ghostview
74    SectionEnd
75    
76    
77  Section "w2hfax" IDX_W2HFAX  Section "w2hfax" IDX_W2HFAX
78    
# Line 76  Section "w2hfax" IDX_W2HFAX Line 88  Section "w2hfax" IDX_W2HFAX
88    File "C:\tmp\w2hfax-make\w2hfax\*.*"    File "C:\tmp\w2hfax-make\w2hfax\*.*"
89        
90    ; Write the installation path into the registry    ; Write the installation path into the registry
91    WriteRegStr HKLM SOFTWARE\NSIS_w2hfax "Install_Dir" "$INSTDIR"    WriteRegStr HKLM Software\NSIS_w2hfax "Install_Dir" "$INSTDIR"
92        
93    ; Write the uninstall keys for Windows    ; Write the uninstall keys for Windows
94    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\w2hfax" "DisplayName" "w2hfax"    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\w2hfax" "DisplayName" "w2hfax"
# Line 88  Section "w2hfax" IDX_W2HFAX Line 100  Section "w2hfax" IDX_W2HFAX
100    DetailPrint "Registering w2hfax COM-Server..."    DetailPrint "Registering w2hfax COM-Server..."
101    
102    ; register "w2hfax COM-Server" (a python class) using the PyWin library    ; register "w2hfax COM-Server" (a python class) using the PyWin library
103    ;nsExec::Exec "$INSTDIR\hfaxcom.py"    nsExec::Exec "$python_path\python $INSTDIR\hfaxcom.py"
   ; TODO: Use $pythonInstDir here!  
   nsExec::Exec "python $INSTDIR\hfaxcom.py"  
104        
105    ; TODO: (pre-)configure w2hfax here!    Call w2hfax_configure
106    
107  SectionEnd  SectionEnd
108    
# Line 225  Function check_python Line 235  Function check_python
235    Goto no_python    Goto no_python
236        
237    found_python:    found_python:
238    ; check if python.exe is really present      ; check if python.exe is really present
239    ClearErrors      ClearErrors
240    IfFileExists $python_path\python.exe 0 +2      IfFileExists $python_path\python.exe 0 +2
241    DetailPrint "Found Python $python_version at: $python_path."      DetailPrint "Found Python $python_version at: $python_path."
242    Return      Return
243        
244    no_python:    no_python:
245    ; error: no python      ; error: no python
246    ;MessageBox MB_OK "No Python installation found (checked HKLM\Software\Python\PythonCore\2.3 and HKLM\Software\Python\PythonCore\2.2)."      ;MessageBox MB_OK "No Python installation found (checked HKLM\Software\Python\PythonCore\2.3 and HKLM\Software\Python\PythonCore\2.2)."
247    ;Call install_python      ;Call install_python
248    SetErrors      SetErrors
249    
250  FunctionEnd  FunctionEnd
251    
# Line 299  Function install_pythonwin Line 309  Function install_pythonwin
309    ; download base    ; download base
310    StrCpy $R1 "http://mesh.dl.sourceforge.net/sourceforge/pywin32/$R0"    StrCpy $R1 "http://mesh.dl.sourceforge.net/sourceforge/pywin32/$R0"
311    
312      StrCpy $R2 ""
313    IfFileExists "$EXEDIR\$R0" 0 +2    IfFileExists "$EXEDIR\$R0" 0 +2
314      StrCpy $R2 "$EXEDIR\R0"      StrCpy $R2 "$EXEDIR\R0"
315    IfFileExists "$INSTDIR\$R0" 0 +2    IfFileExists "$INSTDIR\$R0" 0 +2
# Line 329  Function install_pythonwin Line 340  Function install_pythonwin
340  FunctionEnd  FunctionEnd
341    
342    
343    Function check_ghostscript
344    
345      SetDetailsPrint both
346      DetailPrint "Checking for Ghostscript installation..."
347      
348      ClearErrors
349      StrCpy $ghostscript_version_required 8.50
350      
351      StrCpy $0 0
352      loop:
353        EnumRegKey $1 HKLM "SOFTWARE\AFPL Ghostscript" $0
354        StrCmp $1 "" done
355        IntOp $0 $0 + 1
356        ; MessageBox MB_YESNO|MB_ICONQUESTION "$1$\n$\nMore?" IDYES loop
357      done:
358        StrCpy $ghostscript_version $1
359    
360      ReadRegStr $R0 HKLM "Software\AFPL Ghostscript\$ghostscript_version" "GS_DLL"
361      IfFileExists "$R0" 0 no_ghostscript
362    
363      StrCpy $R0 $ghostscript_version
364      StrCpy $R1 $ghostscript_version_required
365      Math::Script "R2 = #[R0 >= R1, 1, 0]"
366      StrCmp $R2 "1" 0 no_ghostscript
367        Return
368      
369      no_ghostscript:
370        SetErrors
371    
372    FunctionEnd
373    
374    
375    Function install_ghostscript
376    
377      ; installer exe
378      StrCpy $R0 "gs850w32.exe"
379    
380      ; download base
381      StrCpy $R1 "ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/gs850/$R0"
382      
383      ; package title
384      StrCpy $R9 "AFPL Ghostscript 8.50"
385    
386      StrCpy $R2 ""
387      IfFileExists "$EXEDIR\$R0" 0 +2
388        StrCpy $R2 "$EXEDIR\R0"
389      IfFileExists "$INSTDIR\$R0" 0 +2
390        StrCpy $R2 "$INSTDIR\$R0"
391      
392      StrCmp $R2 "" 0 run_setup
393    
394      SetDetailsPrint textonly
395      DetailPrint "Downloading '$R9'"
396      SetDetailsPrint listonly
397      
398      MessageBox MB_YESNO "Download '$R9' from $R1?" IDYES NoCancelAbort
399        ;Abort ; causes uninstaller to not quit.
400        Return
401        
402      NoCancelAbort:
403        NSISdl::download $R1 $INSTDIR\$R0
404        StrCpy $R2 "$INSTDIR\$R0"
405        
406      run_setup:
407        IfFileExists $R2 0 +10
408          SetDetailsPrint textonly
409          DetailPrint "Installing '$R9'..."
410          SetDetailsPrint listonly
411          ExecWait '"$R2"'
412    
413    FunctionEnd
414    
415    
416    Function check_ghostview
417    
418      SetDetailsPrint both
419      DetailPrint "Checking for GSview installation..."
420      
421      ReadRegStr $R0 HKLM Software\Ghostgum\GSview "4.3"
422      IfFileExists "$R0\gsview\gsview32.exe" 0 +3
423        StrCpy $ghostview_version "4.3"
424        Goto ok_ghostview
425    
426      ReadRegStr $R0 HKLM Software\Ghostgum\GSview "4.6"
427      IfFileExists "$R0\gsview\gsview32.exe" 0 no_ghostview
428        StrCpy $ghostview_version "4.6"
429        Goto ok_ghostview
430    
431      ok_ghostview:
432        StrCpy $ghostview_exe "$R0\gsview\gsview32.exe"
433        ClearErrors
434        Return
435    
436      no_ghostview:
437        SetErrors
438      
439    FunctionEnd
440    
441    
442    Function install_ghostview
443    
444      ClearErrors
445    
446      ; installer exe
447      StrCpy $R0 "gsv46w32.exe"
448    
449      ; download base
450      StrCpy $R1 "ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/$R0"
451      
452      ; package title
453      StrCpy $R9 "GSview 4.6"
454    
455      StrCpy $R2 ""
456      IfFileExists "$EXEDIR\$R0" 0 +2
457        StrCpy $R2 "$EXEDIR\R0"
458      IfFileExists "$INSTDIR\$R0" 0 +2
459        StrCpy $R2 "$INSTDIR\$R0"
460      
461      StrCmp $R2 "" 0 run_setup
462    
463      SetDetailsPrint textonly
464      DetailPrint "Downloading '$R9'"
465      SetDetailsPrint listonly
466      
467      MessageBox MB_YESNO "Download '$R9' from $R1?" IDYES NoCancelAbort
468        ;Abort ; causes uninstaller to not quit.
469        Return
470        
471      NoCancelAbort:
472        NSISdl::download $R1 $INSTDIR\$R0
473        StrCpy $R2 "$INSTDIR\$R0"
474        
475      run_setup:
476        IfFileExists $R2 0 +10
477          SetDetailsPrint textonly
478          DetailPrint "Installing '$R9'..."
479          SetDetailsPrint listonly
480          ExecWait '"$R2"'
481    
482    FunctionEnd
483    
484    
485  ; --------------------------------  ; --------------------------------
486  ;   Startup  ;   Startup
487  ; --------------------------------  ; --------------------------------
# Line 337  Function .onInit Line 490  Function .onInit
490    Call check_python    Call check_python
491    IfErrors 0 python_found    IfErrors 0 python_found
492      SectionSetFlags ${IDX_PYTHON} 1      SectionSetFlags ${IDX_PYTHON} 1
493      Return      ;Return
494        Goto pythonwin
495    
496    python_found:    python_found:
497      SectionSetFlags ${IDX_PYTHON} 0      SectionSetFlags ${IDX_PYTHON} 0
# Line 345  Function .onInit Line 499  Function .onInit
499      ;Return      ;Return
500    
501    
502      pythonwin:
503    Call check_pythonwin    Call check_pythonwin
504    IfErrors 0 pythonwin_found    IfErrors 0 pythonwin_found
505      SectionSetFlags ${IDX_PYTHONWIN} 1      SectionSetFlags ${IDX_PYTHONWIN} 1
506      Return      ;Return
507        Goto ghostscript
508    
509    pythonwin_found:    pythonwin_found:
510      SectionSetFlags ${IDX_PYTHONWIN} 0      SectionSetFlags ${IDX_PYTHONWIN} 0
511      SectionSetText ${IDX_PYTHONWIN} "Python for Win32 Extensions (found)"      SectionSetText ${IDX_PYTHONWIN} "Python for Win32 Extensions (found)"
512      ;Return      ;Return
513    
514    
515      ghostscript:
516      Call check_ghostscript
517      IfErrors 0 ghostscript_found
518        SectionSetFlags ${IDX_GHOSTSCRIPT} 1
519        StrCmp $ghostscript_version "" 0 +1
520        SectionSetText ${IDX_GHOSTSCRIPT} "AFPL Ghostscript 8.50 (not found)"
521        SectionSetText ${IDX_GHOSTSCRIPT} "AFPL Ghostscript 8.50 (found $ghostscript_version < $ghostscript_version_required)"
522        ;Return
523        Goto ghostview
524    
525      ghostscript_found:
526        SectionSetFlags ${IDX_GHOSTSCRIPT} 0
527        SectionSetText ${IDX_GHOSTSCRIPT} "AFPL Ghostscript 8.50 (found $ghostscript_version)"
528    
529    
530      ghostview:
531      Call check_ghostview
532      IfErrors 0 ghostview_found
533        SectionSetFlags ${IDX_GHOSTVIEW} 1
534        Return
535    
536      ghostview_found:
537        SectionSetFlags ${IDX_GHOSTVIEW} 0
538        SectionSetText ${IDX_GHOSTVIEW} "GSview 4.6 (found $ghostview_version)"
539    
540    FunctionEnd
541    
542    
543    Function w2hfax_configure
544      ; (pre-)configure w2hfax here!
545      ; e.g. set tiff-viewer dependent of operating system: use shimgvw.dll for WinXP, use Kodak Imaging for Win2000 or others
546      
547      ; set PostScript viewer
548      WriteRegStr HKCU Software\GNU\w2hfax "psviewer" "$ghostview_exe"
549    
550      ; set TIFF viewer
551      StrCpy $R1 ""
552      
553      ; if os == xp
554      StrCpy $R2 ""
555      ReadRegStr $R2 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "ProductName"
556      StrCmp $R2 "Microsoft Windows XP" 0 noWinXP
557        StrCpy $R1 "rundll32.exe shimgvw.dll,ImageView_Fullscreen"
558        Goto ok_tiffviewer
559      
560      noWinXP:
561        IfFileExists "$PROGRAMFILES\Windows NT\Zubehör\ImageVue\kodakimg.exe" 0 +2
562          StrCpy $R1 "$PROGRAMFILES\Windows NT\Zubehör\ImageVue\kodakimg.exe"
563        IfFileExists "$PROGRAMFILES\Windows NT\Accessories\ImageVue\wangimg.exe" 0 +2
564          StrCpy $R1 "$PROGRAMFILES\Windows NT\Accessories\ImageVue\wangimg.exe"
565    
566      ok_tiffviewer:
567        StrCmp $R1 "" no_tiffviewer
568          ;MessageBox MB_OK $R1
569          WriteRegStr HKCU Software\GNU\w2hfax "tifviewer" "$R1"
570        Return
571      
572      no_tiffviewer:
573      Return
574    
575  FunctionEnd  FunctionEnd

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed