当在WinHex中使用数学表达式的时候,可以引用数学表达式,但是必须用括号括起来。在数学表达式中不能有空格。同样可以在数学表达式中应用数字变量。支持的操作有,加法(+),减法(-),乘法(*),整除(/),模除(%),逻辑运算符AND(&),OR(|),以及XOR(^)。以下是有效的数学表达式:(5*2+1), (MyVar1/(MyVar2+4)), or (-MyVar)。
Write2
和“Write”的功能类似,当时当到达文件结尾的时候,不会在文件添加空字节。So it is
not safe to assume that Write2 always moves the current position forward by the number of bytes
written.
Find “John” [MatchCase MatchWord Down Up BlockOnly SaveAllPos Unicode Wildcards]
Find 0x1234 [Down Up BlockOnly SaveAllPos Wildcards]
分别搜索当前活动窗口中名为“john”的字符串或16进制值数0x1234,并且在第一个搜索到的地方停下来。其他的参数是可选的。默认的WinHex搜索整个文件或磁盘。其他的可选参数功能和通常的WinHex搜索选项相同。
ReplaceAll “Jon” “Don” [MatchCase MatchWord Down Up BlockOnly Unicode Wildcards]
ReplaceAll 0x0A 0x0D0A [Down Up BlockOnly Wildcards]
在当前活动窗口中使用其他的值替换所有存在上述字符串或16进制数值的地方。在“in-place”模式下只能应用与磁盘。
IfFound
A boolean value that depends on whether or not the last Find or ReplaceAll command was
successful. Place commands that shall be executed if something was found after the IfFound
command.
SetVarSize MyVariable 1
SetVarSize MyVariable 4
明确的定义了变量的长度。在限制数值长度方面比较有用,比如数值和计算结果的二进制以一个固定的长度被写入文件中。如果没有servarsize,那么变量的大小就无法确定。比如
Explicitly sets the allocated memory size of a variable at a given time, in bytes. This can be
useful e.g. for variables that hold integer values and that are the result of a calculation, if this
value is to be written to a binary file with a fixed-length structure. Without SetVarSize, no
assumption must be made about the size of the variable. For instance, the number 300 could be
stored in any number of bytes larger than 1. If the new size set by SetVarSize is smaller than the
old size, the allocated memory is truncated. If the new size is larger, the allocated memory is
expanded. At any rate, the value of the persisting bytes is retained.
GetUserInput MyVariable “Please enter your name:”
在脚本运行期间,保存用户指定的ASCII文本或二进制数据(0x…)到变量“MyVariable”中。第二个参数给除了用户提示。如果变量不存在,它将重新创建一个。其他创建变量的方式:Assign,Read。
GetUserInputI MyIntegerVariable “Please enter your age:”
与GetUserInput功能相同,但是只允许整数型变量。
Turbo On
Turbo Off
In turbo mode, most screen elements are not updated during script execution and you are not able
to abort (e.g. by pressing Esc) or pause. This may accelerate script execution if a lot of simple
commands such as Move and NextObj are executed in a loop.