MortScript 的 commands.txt 文件 语法参考,不要说英文不懂,我也只是高中毕业而已
This is a quick overview. Please read the manual (readme.txt) for details!
Syntax
------
Allowed parameter formats:
- "string"
quoted string: contained whitespaces remain unmodified, use double quotes
to include quotes (e.g. "This is ""quoted"""), ^CR^=carriage return,
^LF^=line feed, ^NL^=new line (Windows/DOS = ^CR^^LF^), ^TAB^=tabulator.
- variable
contents of the variable
- expression
result of the expression, e.g. "Variable = "&variable
For assignments (variable = expression), array indexes, and in expressions,
percent signs around variables are optional (i.e., %x% = %y[%z%]% is the
same as x = y[z]), strings must be quoted.
For boolean parameters (yes/no, true/false), 1 is yes/true, 0 is no/false.
There are also these predefined variables:
ON, YES, TRUE = 1
OFF, NO, FALSE = 0
CANCEL = 2
Lines can be continued by using "\" as last character. Example:
Message message, \
"Title"
Comments must start with "#" (trailing whitespaces are allowed). Example:
# This is a comment
If "x =" is used, it is a function. This means, it returns a value and must be
used in an expression (command parameter or condition). For example:
var = Input( "Enter value" )
If( wndExists( "Explorer" ) )
...
EndIf
Message( "Your input: " & Input( "Value:" ) )
Error handling
--------------
ErrorLevel( "off"|"critical"|"syntax"|"error"|"warn" )
Set variables
-------------
Set( <variable>,<expression> ) (better use <variable> = <expression>)
<variable> = <expression>
String operations
-----------------
x = Split( <string>,<seperator>,<trim?>,<variable>{,<variable>} ) (if only one variable, it's used as array)
x = Part( <string>,<seperator>,<index>[,<trim?>] )
x = Length( <string> )
x = SubStr( <string>,<start>,<length> )
x = Find( <string>,<search string> )
x = ReverseFind( <string>,<search character> )
x = ToUpper( <string> )
x = ToLower( <string> )
Evaluate expressions in strings
-------------------------------
x = Eval( <expression as string> ) (e.g. res = Eval("var" & index & " & ""...""") )
Execution
---------
Run( <application> [, <parameter>] )
RunWait( <application> [, <parameter>] )
New( <menu entry> ) (Windows Mobile only)
RunAt( <unix timestamp>, <application> [, <parameter>] )
RunAt( <year>, <month>, <day>, <hour>, <minute>, <application> [, <parameter>] )
RunOnPowerOn( <application> [, <parameter>] )
RemoveNotifications( <application> [, <parameter>] )
Window control
--------------
Show( <window title> )
Minimize( <window title> )
Close( <window title> )
x = ActiveWindow()
x = WndActive( <window title> )
x = WndExists( <window title> )
WaitFor( <window title>,<seconds> )
WaitForActive( <window title>,<seconds> )
x = WindowText( <x>, <y> )
SendOK [ ( <window title> ) ]
SendCancel [ ( <window title> ) ]
SendYes [ ( <window title> ) ]
SendNo [ ( <window title> ) ]
Sending keys
------------
SendKeys( [<window title>,]<string> )
Send<special character> [ ( <window title>,<ctrl>,<shift> ) ]
Special charaters: CR, Tab, Esc, Space, Backspace, Delete, Insert
Up, Down, Left, Right, Home, End, PageUp, PageDown,
LeftSoft, RightSoft, Win, Context
Snapshot [ ( <window title> ) ]
SendCtrlKey( [<window title>,]<key> )
Sending taps ("mouse events")
-----------------------------
MouseClick( [<window title>,]<x>,<y> )
MouseDblClick( [<window title>,]<x>,<y> )
MouseDown( [<window title>,]<x>,<y> )
MouseUp( [<window title>,]<x>,<y> )
PC version only: Prefix with "Middle" or "Right" for those buttons, e.g. RightMouseClick(...)
Waiting
-------
Sleep( <milliseconds> )
SleepMessage( <seconds>,<message>[,<title>[,<allowOK>[,<condition]]] )
WaitFor( <window title>,<seconds> )
WaitForActive( <window title>,<seconds> )
Time
----
x = Time() (Unix timestamp)
x = FormatTime( <format> [, <timestamp> ] ) (formatted)
GetTime( <variable>,<variable>,<variable> ) (hour, minute, seconds)
GetTime( <variable>,<variable>,<variable>,<variable>,<variable>,<variable> )
(hour, minute, seconds, day, month, year)
Copy, rename, move, delete files
--------------------------------
Copy( <source file>,<target file>[,<overwrite?>] )
XCopy( <source files>,<target directory>[,<overwrite?>] )
Rename( <source file>,<target file>[,<overwrite?>] )
Move( <source files>,<target directory>[,<overwrite?>] )
Delete( <files> )
DelTree( <files> )
CreateShortcut( <shortcut file>,<target file> )
Read and write text files
-------------------------
x = IniRead( <file/url>,<section>,<key>,<variable> )
x = ReadFile( <file/url> )
WriteFile( <file>,<contents>,<append?> )
COM access
----------
SetComInfo( <port>, <timeout> [, <baud rate> [, <parity> [, <bits>
[, <stop bits> [, <control> ]]]]] )
port: "COM1:" to "COM9:"
baud rate: usually one of 4800, 9600, 19200, 38400, 57600, 76800, 115200
parity: "none", "even", "odd", "mark", "space"
bits: 4-8, usually 8
stop bits: 1, "1.5", 2
control: "none", "RTS/CTS", "XON/XOFF"
File system informations
------------------------
x = FileExists( <file> )
x = DirExists( <directory> )
x = FileCreateTime( <file> )
x = FileModifyTime( <file> )
x = FileSize( <file> )
x = FreeDiskSpace( <directory> )
x = FileAttribute( <file>, <attribute> )
SetFileAttribute( <file>, <attribute>, <set?> )
Allowed values for 揳ttribute?
directory (cannot be set), hidden, readonly, system, archive
SetFileAttribs( <file>,<readonly>[,<hidden>[,<archive>]] ) (1=set,0=remove,""/omit=keep)
x = FileVersion( <file> )
GetVersion( <file>,<variable>,<variable>,<variable>,<variable> )
Zip files
---------
Please note: ZIP doesn't support Unicode for filenames.
MortScript uses the old DOS encoding 437, like most popular ZIP progrograms.
I.e., you might get troubles with (un)zipping files with non-ASCII characters.
Rate: 0=no compression, 9=highest
ZipFile( <source file>,<zip file>,<filename in archive>[,<rate>] )
ZipFiles( <source files>,<zip file>[,<subdirectories?>[,<path in zip>[,<rate>]]] )
UnzipFile( <zip file>,<filename in archive>,<target file> )
UnzipAll( <zip file>,<target directory> )
UnzipPath( <zip file>,<path in archive>,<target directory> )
Connections
-----------
Connect( <connection name> ) for fixed connection name
Connect( <title>, <message> ) for selection of connections
Connect for default http connection
CloseConnection closes only connection established by "Connect"
Disconnect closes all connections (GPRS, ActiveSync, ...)
x = Connected()
x = InternetConnected( [<url>] )
SetProxy( <proxy> ) not necessary if Connect was used
Download( <url>,<target file> )
Directory operations
--------------------
MkDir( <directory> )
RmDir( <directory> )
ChDir( <directory> ) PC version only!
SystemPath( <path> )
valid values for path: ProgramsMenu, StartMenu, Startup, Documents, ProgramFiles,
ScriptExe, ScriptPath, ScriptName, ScriptExt
Registry
--------
RegWriteString( <root>,<path>,<key>,<value> )
RegWriteDWord( <root>,<path>,<key>,<value> )
RegWriteBinary( <root>,<path>,<key>,<value> )
x = RegRead( <root>,<path>,<key> )
RegDelete( <root>,<path>,<key> )
RegDeleteKey( <root>,<path>,<values?>,<recursive?> )
x = RegKeyExists( <root>,<path> )
x = RegValueExists( <root>,<path>,<value> )
"root" values: HKCU (HKEY_CURRENT_USER), HKLM (HKEY_LOCAL_MACHINE),
HKCR (HKEY_CLASSES_ROOT), HKUS (HKEY_USERS)
Binary values are handled as strings whith the hex dump, e.g. "01020A".
Dialog
------
x = Input( <message> [,<title> [,<numeric?> [, <multiline?> [, <default> ]]]] )
Message <text>[,<title>]
BigMessage <text>[,<title>]
SleepMessage( <seconds>,<message>[,<title>[,<allowOK>[,<condition]]] )
x = Question( <message> [,<title> [,<type>]] ) (Type=OkCancel,YesNo,YesNoCancel; Yes/OK=1,No=0,Cancel=2)
x = Choice( <title>,<message>,<default>,<timeout>,<array> ) (if only one text is given, it's assumed to be a array variable)
x = Choice( <title>,<message>,<default>,<timeout>,<text1>,<text2>{,<text3>} ) (if only one text is given, it's assumed to be a array variable)
Processes
---------
x = ProcExists( <process name> )
x = ScriptProcExists( <script name> )
x = ActiveProcess()
Kill( <process name> )
KillScript( <script name> )
Signals
-------
SetVolume( <value> ) (Windows Mobile only)
PlaySound( <wav file> )
Vibrate( <milliseconds> )
Display/screen
--------------
x = ColorAt( <x>,<y> )
x = RGB( <red>,<green>,<blue> )
Rotate( 0|90|180|270 ) (only Windows Mobile 2003 SE or higher)
SetBacklight( <battery>,<external> ) (PPC only)
ToggleDisplay( <on/off> ) (PPC only)
x = Screen( "landscape"|"portrait"|"vga"|"qvga" )
RedrawToday
ShowWaitCursor
HideWaitCursor
Clipboard
---------
SetClipText( <text> )
x = GetClipText()
======================
太长截去。。。
附件: 您所在的用户组无法下载或查看附件