VBScript Statements Supported in Altium Designer
Altium 제품에 접근할 수 있는 레벨에 따라 사용할 수 있는 기능이 달라집니다. 다양한 레벨의 Altium Designer Software Subscription에 포함된 기능과 Altium 365 플랫폼에서 제공하는 애플리케이션을 통해 제공되는 기능을 비교해보세요.
소프트웨어에서 논의된 기능을 찾을 수 없는 경우, Altium 영업팀에 문의하여 자세한 정보를 확인해주세요.
Conditional Statements Copy Link Copied
The main conditional statements supported by VBScript are:
- If...Then
- For Next Loop
- Exit For
- For Each Next
- Do Loop
- While...WEnd
- Select Case
Care needs to be taken to code scripts that avoid infinite loops — that is, ensuring that the conditions will eventually be met.
The If...Then Statement
The syntax is:
1
If
Condition
Then
2
'code
3
Else
If
AnotherCondition
Then
4
'code
5
Else
6
'code
7
End
If
The For Loop
The For Next statement repeatedly loops through a block of code. The basic syntax is:
1
For
counter = start to end
2
' block of code here
3
Next
The Exit For
The Exit For statement exits a For loop prematurely.
1
For
counter = start to end
2
if condition then
Exit
For
3
Next
The For Each Loop
The For Each loop is a variation on the For loop which is designed to iterate through a collection of objects as well as elements in an array. The basic syntax is:
1
For
Each
ObjectVar in Collection
2
' block of code here
3
Next
The Do Loop
The Do Loop has several loop variations.
1
Do
while until condition
2
' code block
3
Loop
...and;
1
Do
2
' code block
3
Loop
while until condition
...and;
1
Do
2
' code block
3
Loop
The While...WEnd Loop
The While WEnd statement repeatedly loops through a block of code. The basic syntax is:
1
While
until condition
2
' code block
3
WEnd
The Select Case Statement
You can use the SELECT statement if you want to select one of many blocks of code to execute:
1
Select
case payment
2
case
"Cash"
3
msgbox
"pay cash"
4
case
"MasterCard"
5
msgbox
"pay by Mastercard"
6
case
Else
7
msgbox
"Unknown payment method"
8
end select
Expressions and Operators Copy Link Copied
An expression is a valid combination of constants, variables, literal values, operators, and function results. Expressions are used to determine the value to assign to a variable, to compute the parameter of a function, or to test for a condition. Expressions can include function calls.
VBScript has a number of logical, arithmetic, Boolean and relational operators. Since these operators are grouped by the order of precedence which is different from the precedence orders used by Basic, C, etc. For example, the AND and OR operators have precedence compared to the relational one.
Arithmetic Operators
|
Addition |
|
Subtraction |
|
Multiplication |
|
Division |
|
Division with an integer result |
|
Exponentiation |
|
Modulo |
Comparison Operators (Lowest Precedence)
|
Test whether equal or not. |
|
Test whether not equal or not. |
|
Test whether less than or not. |
|
Test whether greater than or not. |
|
Test whether less than or equal to or not. |
|
Test whether greater than or equal to or not. |
|
Compares two object reference variables. |
String Operators
|
Concatenation |
Logical Operators
|
Logical NOT |
|
Logical AND |
|
Logical OR |
|
|
|
|
|
|
|
|