@TOC
使用NSIS制作revit插件安装包 下载 NSIS DOWNLOAD HM NSIS
Addin文件 ==我们需要将addin文件进行单独存放 == 位置放在读取文件的section后就可
修改脚本文件
增加对addin文件的路径自动修改
1 2 3 4 5 6 7 8 9 10 11 Section change StrCpy $1 "<Assembly>" StrCpy $1 "$1 $INSTDIR " StrCpy $1 "$1 \bin\De··bug\Panel.dll</Assembly>" Push <Assembly>name .dll</Assembly> Push $1 Push all Push all Push C:\ProgramData\Autodesk\Revit\Addins\2016 \name .addin Call AdvReplaceInFile SectionEnd
在NSIS 中 $1 代表字符串,其中上面三行是组装目标路径,Push <Assembly>name.dll</Assembly>push语句将目标语句找出替换 2. 添加funcation
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 Function AdvReplaceInFile Exch $0 Exch Exch $1 Exch Exch 2 Exch $2 Exch 2 Exch 3 Exch $3 Exch 3 Exch 4 Exch $4 Exch 4 Push $5 Push $6 Push $7 Push $8 Push $9 Push $R0 Push $R1 Push $R2 Push $R3 Push $R4 Push $R5 Push $R6 GetTempFileName $R6 FileOpen $R1 $0 r FileOpen $R0 $R6 w StrLen $R3 $4 StrCpy $R4 -1 StrCpy $R5 -1 loop_read: ClearErrors FileRead $R1 $R2 IfErrors exit StrCpy $5 0 StrCpy $7 $R2 loop_filter: IntOp $5 $5 - 1 StrCpy $6 $7 $R3 $5 StrCmp $6 "" file_write1 StrCmp $6 $4 0 loop_filter StrCpy $8 $7 $5 IntOp $6 $5 + $R3 IntCmp $6 0 is0 not0is0: StrCpy $9 "" Goto donenot0: StrCpy $9 $7 "" $6 done: StrCpy $7 $8 $3 $9 IntOp $R4 $R4 + 1 StrCmp $2 all loop_filterStrCmp $R4 $2 0 file_write2IntOp $R4 $R4 - 1 IntOp $R5 $R5 + 1 StrCmp $1 all loop_filterStrCmp $R5 $1 0 file_write1IntOp $R5 $R5 - 1 Goto file_write2file_write1: FileWrite $R0 $7 Goto loop_readfile_write2: FileWrite $R0 $R2 Goto loop_readexit: FileClose $R0 FileClose $R1 SetDetailsPrint none Delete $0 Rename $R6 $0 Delete $R6 SetDetailsPrint both Pop $R6 Pop $R5 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Pop $R0 Pop $9 Pop $8 Pop $7 Pop $6 Pop $5 Pop $0 Pop $1 Pop $2 Pop $3 Pop $4 FunctionEnd