Guest User

Untitled

a guest
Nov 18th, 2011
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. !include "MUI2.nsh"
  2. ;-------------------------------------------
  3. ; Set install information for files
  4. !define commonname "PUMA_2100SY"
  5. !define machinetype "lathe" ;VALID SETTING - MILL LATHE ROUTER WIRE
  6. !define installdirectory "shared mcamx5"
  7. !define /date DATE "%m%d%y"
  8. ;-------------------------------------------
  9.  
  10.  
  11. ;assign file extension based on machinetype
  12. !if ${machinetype} == "mill"
  13. !define machineext "mmd-5"
  14. !else
  15. !if ${machinetype} == "lathe"
  16. !define machineext "lmd-5"
  17. !else
  18. !if ${machinetype} == "router"
  19. !define machineext "rmd-5"
  20. !else
  21. !if ${machinetype} == "wire"
  22. !define machineext "wmd-5"
  23. !else
  24. !error "**** ${machinetype} IS INVALID ****"
  25. !endif
  26. !endif
  27. !endif
  28. !endif
  29.  
  30. ; This script will copy machine definition files from the
  31. ; current directory. All files will be copied into the
  32. ; "installdirectory" location. *.*md-5 and *.control-5 files
  33. ; are set to copy to the CNC_MACHINES folder and the
  34. ; *.pst and *.psb files are set to copy to the machinetype\posts
  35. ; folder.
  36.  
  37. ; The name of the installer
  38. Name "Mastercam Machine Definition"
  39. OutFile "${commonname}_Installer-${DATE}.exe"
  40.  
  41. ;Interface Configuration
  42. !define MUI_ICON "C:\Users\JohnM\My Customize\NSIS SETTINGS\standard.ico"
  43. !define MUI_HEADERIMAGE
  44. !define MUI_HEADERIMAGE_BITMAP "C:\Users\JohnM\My Customize\NSIS SETTINGS\header.bmp"
  45. !define MUI_HEADERIMAGE_RIGHT
  46. ;!define MUI_ABORTWARNING ;for now do not abort warning
  47.  
  48. !insertmacro MUI_LANGUAGE "English"
  49.  
  50. ;!insertmacro MUI_LICENSEPAGE_TEXT_TOP "Please read license"
  51. ;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
  52. ;!insertmacro MUI_PAGE_COMPONENTS
  53. ;!insertmacro MUI_PAGE_DIRECTORY
  54. !insertmacro MUI_PAGE_INSTFILES
  55.  
  56. Function .onInit
  57. ;set default install directory
  58. ;use all users documents????need to check privleges
  59. SetShellVarContext all
  60. StrCpy $INSTDIR "$DOCUMENTS\${installdirectory}"
  61. FunctionEnd
  62.  
  63.  
  64. Section
  65. ;create and remove file to check for privileges
  66. ClearErrors
  67. FileOpen $R0 $INSTDIR\tmp.dat w
  68. FileClose $R0
  69. Delete $INSTDIR\tmp.dat
  70. ${If} ${Errors}
  71. MessageBox MB_OK "Permissions error: Can't write to $INSTDIR"
  72. quit
  73. ${EndIf}
  74.  
  75. SectionEnd
  76.  
  77. Section "File"
  78. ; Copy machine files
  79. SetOutPath "$INSTDIR\CNC_MACHINES"
  80.  
  81. ${If} ${FileExists} "$INSTDIR\CNC_MACHINES\${commonname}.${machineext}"
  82. ${OrIf} ${FileExists} "$INSTDIR\CNC_MACHINES\${commonname}.control-5"
  83. ${OrIf} ${FileExists} "$INSTDIR\${machineType}\Posts\${ commonname}.pst"
  84. MessageBox MB_YESNO "Overwrite existing post files?" IDYES overwrite
  85. Quit
  86. overwrite:
  87. ${EndIf}
  88.  
  89.  
  90. File "${commonname}.${machineext}"
  91. File "${commonname}.control-5"
  92. ; Copy post files
  93. SetOutPath "$INSTDIR\${machineType}\Posts"
  94. File "${commonname}.pst"
  95. File /nonfatal "${commonname}.psb"
  96. SectionEnd
  97.  
  98.  
  99.  
  100.  
Advertisement
Add Comment
Please, Sign In to add comment