NSIs -- macro usage (! Macro and! Insertmacro)

Source: Internet
Author: User

[Case 1]
OUTFILE "test_maroc.exe"
! Macro Add a B c; a macro that implements (a + B) * (a-B)
Intop $ R0 $ {A}-$ {B}
Intop $ R1 $ {A} + $ {B}
Intop $ {c} $ R0 * $ r1
! Macroend
/*
Note :! Macro and! Insertmacro usage:
! Macro Add a B c ;! Macro macro name parameter 1 parameter 2 parameter 3...
! Insertmacro add 10 20 $0 ;! Insertmacro macro name parameter 1 parameter 2 parameter 3...
In use! Insertmacro parameters will be substituted! Use in macro
Is like! Insertmacro add 10 20 $0
Substitute! Macro Add a B c
. In! Macro add is equivalent to executing
Intop $ R0 10-20
Intop $ R1 10 + 20
Intop $0 $ R0 * $ r1
*/
Section
! Insertmacro add 10 20 $0; macro call
Detailprint '$0'
Sectionend

Case 2]
Deletes a process with the specified name.
! Macro killprocess filename
$ {For} $ R1 0 2
Findprocdll: findproc $ {filename}
Intcmp $ R0 1 _ isexisted _ isnotexisted
_ Isexisted:
Killprocdll: killproc $ {filename}
Intcmp $ R0 0 _ is0 _ lessthan0 _ morethan0
_ Is0:
Goto _ end_of_kill_zhezi
_ Lessthan0:
_ Morethan0:
$ {Next}
_ Isnotexisted:
_ End_of_kill_zhezi:
! Macroend

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.