Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !include "MUI2.nsh"
- ;-------------------------------------------
- ; Set install information for files
- !define commonname "PUMA_2100SY"
- !define machinetype "lathe" ;VALID SETTING - MILL LATHE ROUTER WIRE
- !define installdirectory "shared mcamx5"
- !define /date DATE "%m%d%y"
- ;-------------------------------------------
- ;assign file extension based on machinetype
- !if ${machinetype} == "mill"
- !define machineext "mmd-5"
- !else
- !if ${machinetype} == "lathe"
- !define machineext "lmd-5"
- !else
- !if ${machinetype} == "router"
- !define machineext "rmd-5"
- !else
- !if ${machinetype} == "wire"
- !define machineext "wmd-5"
- !else
- !error "**** ${machinetype} IS INVALID ****"
- !endif
- !endif
- !endif
- !endif
- ; This script will copy machine definition files from the
- ; current directory. All files will be copied into the
- ; "installdirectory" location. *.*md-5 and *.control-5 files
- ; are set to copy to the CNC_MACHINES folder and the
- ; *.pst and *.psb files are set to copy to the machinetype\posts
- ; folder.
- ; The name of the installer
- Name "Mastercam Machine Definition"
- OutFile "${commonname}_Installer-${DATE}.exe"
- ;Interface Configuration
- !define MUI_ICON "C:\Users\JohnM\My Customize\NSIS SETTINGS\standard.ico"
- !define MUI_HEADERIMAGE
- !define MUI_HEADERIMAGE_BITMAP "C:\Users\JohnM\My Customize\NSIS SETTINGS\header.bmp"
- !define MUI_HEADERIMAGE_RIGHT
- ;!define MUI_ABORTWARNING ;for now do not abort warning
- !insertmacro MUI_LANGUAGE "English"
- ;!insertmacro MUI_LICENSEPAGE_TEXT_TOP "Please read license"
- ;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
- ;!insertmacro MUI_PAGE_COMPONENTS
- ;!insertmacro MUI_PAGE_DIRECTORY
- !insertmacro MUI_PAGE_INSTFILES
- Function .onInit
- ;set default install directory
- ;use all users documents????need to check privleges
- SetShellVarContext all
- StrCpy $INSTDIR "$DOCUMENTS\${installdirectory}"
- FunctionEnd
- Section
- ;create and remove file to check for privileges
- ClearErrors
- FileOpen $R0 $INSTDIR\tmp.dat w
- FileClose $R0
- Delete $INSTDIR\tmp.dat
- ${If} ${Errors}
- MessageBox MB_OK "Permissions error: Can't write to $INSTDIR"
- quit
- ${EndIf}
- SectionEnd
- Section "File"
- ; Copy machine files
- SetOutPath "$INSTDIR\CNC_MACHINES"
- ${If} ${FileExists} "$INSTDIR\CNC_MACHINES\${commonname}.${machineext}"
- ${OrIf} ${FileExists} "$INSTDIR\CNC_MACHINES\${commonname}.control-5"
- ${OrIf} ${FileExists} "$INSTDIR\${machineType}\Posts\${ commonname}.pst"
- MessageBox MB_YESNO "Overwrite existing post files?" IDYES overwrite
- Quit
- overwrite:
- ${EndIf}
- File "${commonname}.${machineext}"
- File "${commonname}.control-5"
- ; Copy post files
- SetOutPath "$INSTDIR\${machineType}\Posts"
- File "${commonname}.pst"
- File /nonfatal "${commonname}.psb"
- SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment