Tải bản đầy đủ (.pdf) (7 trang)

Giáo Trình How To Use AutoIt A Professional Manner part 94 ppt

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (62.29 KB, 7 trang )

Round
làm tròn.
Round ( expression [, decimalplaces] )
Parameters
expression giá trị
decimalplaces

số số lấy sau dấu phẩy

Return Value
số đã đc làm tròn
Remarks
The decimalplaces parameter can be negative which allows you to round to the
ones, tens, hundred, etc. place. Note that up to fifteen digits of a number are
displayed, and note that decimalplaces will never pad a number with trailing zeros.
Related
Int, Number
Example

$x = Round(-1.582, 1) ;returns -1.6
$y = Round(3.1415, 9) ;no change
$z = Round(123.5, -1) ;returns 120




Function Reference
Sin
Calculates the sine of a number.
Sin ( expression )
Parameters


expression Value in radians.

Return Value
Returns the trigonometric sine of number.
Remarks
1° = pi / 180 radians.
Related
Cos, Tan, ASin, ACos, ATan
Example

$pi = 3.14159265358979
$x = sin($pi / 4) ;returns 0.707106781186547 which you should recognize as
sqrt(2)/2

$degToRad = $pi / 180
$y = Sin(90 * $degToRad) ;sine of 90°




Function Reference
Sqrt
Calculates the square-root of a number.
Sqrt ( expression )
Parameters
expression Any nonnegative expression to get the square-root of.

Return Value
Success:


Returns the square-root.
Failure:

Returns 0 and sets @error to 1 if parameter is negative.

Remarks
To compute an nth root, use the power operator: x ^ (1/n)
MsgBox(0,"The cube root of 27 is", 27 ^ (1/3) )
Related
Exp, Log
Example

$x = Sqrt(2) ;returns 1.4142135623731
$y = sqrt(9) ;returns 3




Function Reference
SRandom
Set Seed for random number generation.
SRandom ( Seed )
Parameters
Seed
Seed value for random number generation. Number between -2^31
and 2^31-1

Return Value
None.
Remarks

None.
Related
Random
Example

SRandom(12)
$rand=Random()




Function Reference
Tan
Calculates the tangent of a number.
Tan ( expression )
Parameters
expression Value in radians.

Return Value
Returns the trigonometric tangent of number.
Remarks
1° = pi / 180 radians.
Note that Tan is "infinite" for -3PI/2, -PI/2, PI/2, 3PI/2, 5PI/2, and tends to
return 1.63317787283838e+016 for such multiples of Pi-halves.
Related
Sin, Cos, ASin, ACos, ATan
Example

$pi = 3.14159265358979
$x = tan($pi / 4)


$degToRad = $pi / 180
$y = Tan(90 * $degToRad) ;tangent of 90°




Function Reference
InputBox
Displays an input box to ask the user to enter a string.
InputBox ( "title", "Prompt" [, "Default" [, "password char" [, width, height [, left,
top [, timeOut [, hwnd]]]]]] )
Parameters
title The title of the input box.
prompt A message to the user indicating what kind of input is expected.
default The value that the input box starts with.
password
char
[optional] The character to replace all typed characters with. If you
want the actual typed character to appear, define with an empty string
("") (default) or a space for the first character. If you provide a
multiple-char string, only the first char is used for character masking.
There are special meanings for the second and subsequent characters.
See Remarks.
width
[optional] The width of the window. If defined, height must also be
defined. Use -1 or the keyword Default for default width.
height
[optional] The height of the window. If defined, width must also be
defined. Use -1 or the keyword Default for default height.

left
[optional] The left side of the input box. By default, the box is
centered. If defined, top must also be defined. Use the keyword
Default for this parameter to center the InputBox horizontally.
top
[optional] The top of the input box. By default, the box is centered. If
defined, left must also be defined. Use the keyword Default for this
parameter to center the InputBox vertically.
timeout
[optional] How many seconds to wait before automatically cancelling
the InputBox.
hwnd [optional] The window handle to use as the parent for this dialog.

Return Value
Success:

Returns the string that was entered.
Failure:

Returns "" (blank string) and sets @error as follows:
@Error

0 = The string returned is valid.
1 = The Cancel button was pushed.

×