//ṩº
//v1.34 : SubStrPosһbug
//        ɽ/߳̿ƺ
//        עд
//v1.33 : HTMLToTXT, StrDuplicate
//v1.32 : űʦ7.1һ𷢲ĳʼ汾


::Min
function Min(n1:float; n2:float; n3:float; ....): float;
n1,n2,n3,...һϵҳСһ
set x=min(1,2,3,4,5)  -> x=1

::Max
function Max(n1:float; n2:float; n3:float; ....): float;
n1,n2,n3,...һϵҳһ
set x=max(1,2,3,4,5)  -> x=5

::GetTickCount
function GetTickCount() : integer;
ȡϵͳĺ
set x=GetTickCount()

::GetTime
function GetTime() : string;
ȡǰϵͳʱ䣬Ϊʱַ
set x=GetTime()

::GetYear
function GetYear() : integer;
ȡڵ
set x=GetYear()

::GetMonth
function GetMonth() : integer;
ȡڵ·
set x=GetMonth()

::GetDay
function GetDay() : integer;
ȡ
set x=GetDay()

::GetHour
function GetHour() : integer;
ȡڵСʱ
set x=GetHour()

::GetMinute
function GetMinute() : integer;
ȡڵķ
set x=GetMinute()

::GetSec
function GetSec() : integer;
ȡڵ
set x=GetSec()

::GetMSec
function GetMSec() : integer;
ȡڵĺ
set x=GetMSec()

::AsciiToChar
function AsciiToChar(AsciiCode:integer) : string;
ָAsciiתɶӦַ
set c=AsciiToChar(65)  -> c="A"

::CharToAscii
function CharToAscii(Char:string) : integer;
ַָתɶӦAscii
set x=CharToAscii("A")  -> x=65

::UpperCase
function UpperCase(str:string) : string;
ַָתȫд
set s=UpperCase("AbcdEfgHijK") -> s="ABCDEFGHIJK"

::LowerCase
function LowerCase(str:string) : string;
ַָתȫСд
set s=LowerCase("AbcdEFGHIJk") -> s="abcdefghijk"

::ShowMsg
function ShowMsg(msg:string; [Id:string]) : string;
ԻʾָϢĶԻϵİťݿѡIdȷIdĿȡֵ£
"OK": ʾĶԻֻһȷť
"OKCancel": ʾĶԻ2ťֱΪȷ͡ȡ(OK/Cancel)
"YesNo": ʾĶԻ2ťֱΪǡ͡(Yes/No)
"YesNoCancel": ʾĶԻ3ťֱΪǡ񡱡ȡ(Yes/No/Cancel)
ֵΪһַʶûĸťȡֵ£(עⶼΪд)
"OK": ûˡȷť
"CANCEL": ûˡȡť
"YES": ûˡǡť
"NO": ûˡ񡱰ť

do ShowMsg("Test Message")
set x=ShowMsg("Test Message","OKCancel")
set x=ShowMsg("Test Message","YesNO")
set x=ShowMsg("Test Message","YesNoCancel")

::IntToStr
function IntToStr(int:integer) : string;
ֵָתַ
set s=IntToStr(123)  -> s="123"

::IntToHex
function IntToHex(int:integer; Digits:integer) : string;
ֵָתɶӦ16ַ
set s=IntToHex(765,8)  -> s="000002FD"

::StrToInt
function StrToInt(str:string) : integer;
ַָתֵַ޷תΪ֣򷵻0
set i=StrToInt("1234") -> i=1234

::FloatToStr
function FloatToStr(f:Float) : string;
ָתΪַ
set s=FloatToStr(3.1415926)  -> s="3.1415926"

::StrToFloat
function StrToFloat(str:string) : Float;
ַָתΪַ޷תΪ򷵻0
Set f=StrToFloat("3.1415926")  -> f=3.1415926

::GetSubStr
function GetSubStr(str:string; Index:integer; Count:integer): string;
strIndexʼCountַӴ
: set s=GetSubStr("123456789",2,3)  -> ֵΪַ"234"

::SubStrPos
function SubStrPos(SubStr:string; Str:string; [instance_num:integer]): Integer;
SubStrStrַеλ
SubStrΪҪѰҵַ
StrΪҪѰSubStrַ
instance_numΪѡָΧStrеڼƥSubStrλãδָΪ0򷵻StrеһƥSubStrλ
set i=SubStrPos(".","abc.efg.hijk",2)  -> i=8 صڶ"."ַеλΪ8

::SubStrCount
function SubStrCount(Str:string; SubStr:string): integer;
StrSubStrĸ
set i=SubStrCount("abcdefabcijk","abc") -> i=2

::Trim
function Trim(Str:string): string;
ַָǰոȥ
set s=Trim("  abc  ")  -> s="abc"

::TrimLeft
function TrimLeft(str:string): string;
ַָǰĿոȥ
set s=TrimLeft("  abc  ") -> s="abc  "

::LTrim
function LTrim(str:string): string;
ַָǰĿոȥ, ͬTrimLeft
set s=LTrim("  abc  ") -> s="abc  "

::TrimRight
function TrimRight(str:string): string;
ַָĺĿոȥ
set s=TrimRight("  abc  ")  -> s="  abc"

::RTrim
function RTrim(str:string): string;
ַָĺĿոȥ, ͬTrimRight
set s=RTrim("  abc  ")  -> s="  abc"

::Left
function Left(str:string; Count:integer): string;
Strַȡǰ1򼸸ַCountΪҪȡַ
set s=Left("abcdef",3)  -> s="abc"

::Right
function Right(str:string; Count:integer): string;
Strַȡ1򼸸ַCountΪҪȡַ
set s=Right("abcdef",3)  -> s="def"

::StrReplace
function StrReplace(str:string; OldStr:string; NewStr:string; [Instance_Num:integer]): string;
StrнOldStr滻ΪNewStr
StrΪҪ滻ַַ
OldStrΪҪ滻ľı
NewStrΪ滻OldStrı
Instance_Num ΪһѡֵָNewStr滻ڼγֵOldStrInstance_NumδָΪ0StrгֵеOldStrȫ滻ΪNewStr

set s=StrReplace("abcdefghiabc","abc","XXX") -> s="XXXdefghiXXX"
set s=StrReplace("abcdefghiabc","abc","XXX",2) -> s="abcdefghiXXX"

::StrInsert
function StrInsert(SrcStr:string; DstStr:string; Index:integer): string;
SrcStrַ뵽DstStrַIndexλ
set s=StrInsert("abc","01234567",3)  -> s="01abc234567"

::HTMLToTXT
function HTMLToTXT(HTMLStr:string): string;
ָHTMLıתΪıȥHTMLıеHTMLϢ
set s=HTMLToTXT(HTMLStr)

::StrDuplicate
function StrDuplicate(s:string; DupTimes:integer): string;
ַָɷ
s: ҪƵԭʼַ
DupTimes: ƴ
set s=StrDuplicate("s",5) -> s="sssss"

::GetInputStr
function GetInputStr(str:string): string;
ԻҪûַȻ󷵻ظSE
set s=GetInputStr("ַ")

::GetClipBoardText
function GetClipBoardText(): string;
ȡı
set s=GetClipBoardText()

::SetClipBoardText
procedure SetClipBoardText(str:string);
ַָд
do SetClipBoardText("test")

::SwitchToWindow
procedure SwitchToWindow(WndTitle:string);
ΪWndTitleĴлɻ
do SwitchToWindow("Game Name")

::SetWindow
procedure SetWindow(hWnd: integer; IDStr:string);
趨ָڵ״̬IDStrΪҪõĴ״ַ̬(Сд)ȡֵΪ:
"TopMost": ôϷ
"NoTopMost": ȡϷ
"Bottom": ôڴд·
"Max": ô
"Min": ôС
"Restore": ָ״̬Max/min
"Hide": ش
"Show": ʾڣҲȡ״̬
do SetWindow(GetForeGroundWindow(),"TopMost")

::ScreenToClient
procedure ScreenToClient(hWnd:integer; ScreenX:integer; ScreenY:integer; var ClientX:integer; var ClientY:integer);
Ļ(ScreenX,ScreenY)תΪ(ClientX,ClientY), hWndΪھ
do ScreenToClient(GetForeGroundWindow(),10,10,cx,cy)

::ClientToScreen
procedure ClientToScreen(hWnd:integer; ClientX:integer; ClientY:integer; var ScreenX:integer; var ScreenY:integer);
(ClientX,ClientY)תΪĻ(ScreenX,ScreenY), hWndΪھ
do ClientToScreen(GetForeGroundWindow(),10,10,sx,sy)

::GetWindowText
function GetWindowText(hWnd:integer):string;
ȡָڵı, hWndΪھ
set s=GetWindowText(GetForeGroundWindow()) ȡǰڵı

::SetWindowText
function SetWindowText(hWnd:integer; NewCaption:string): integer;
޸ָڵı⣬hWndΪھNewCaptionΪҪ޸ĵı
do SetWindowText(GetForeGroundWindow(),"Window title modified by script expert")

::GetSerialNumber
function GetSerialNumber(): integer;
Ӳк
set x=GetSerialNumber()

::LocalComputerName
function LocalComputerName(): string;
ȡ
set s=LocalComputerName()

::LocalIP
function LocalIP(): string;
ȡIPַ
set s=LocalIP()

::InternetConnected
function InternetConnected(): integer;
жϵǰǷǵĻ1򷵻0
set i=InternetConnected()

::GetMousePos
procedure GetMousePos(var x:integer; var y:integer);
ȡǰ(xy)ֵڱxy
do GetMousePos(x,y)

::ParamCount
function ParamCount(): integer;
ȡǰвĸ
 set x=ParamCount()

::ParamStr
function ParamStr(ParamIndex:integer): string;
ȡǰвַParamindexΪҪȡڼ
set s=ParamStr(1)  -> ȡһв

::GetCurrentThread
function GetCurrentThread(): integer;
ȡǰ̵߳ľ
set h=GetCurrentThread()

::GetCurrentThreadID
function GetCurrentThreadID(): integer;
ȡǰ̱߳ʶID
set h=GetCurrentThreadID()

::GetCurrentProcess
function GetCurrentProcess(): integer;
ȡǰ̵ľ
set h=GetCurrentProcess()

::GetCurrentProcessID
function GetCurrentProcessID(): integer;
ȡǰ̵ıʶID
set ID=GetCurrentProcessID()

::OpenProcess
function OpenProcess(ProcessID:integer): integer;
ݽ̱ʶIḌָؽ̾
set h=OpenProcess(ID)

::SetThreadPriority
function SetThreadPriority(h:integer; nPriority:integer): integer;
̵߳ȼóɹ1򷵻0
h: ߳̾
nPriority: ȼ룬ȡֵ
  -15:  THREAD_PRIORITY_IDLE
  -2 :  THREAD_PRIORITY_LOWEST
  -1 :  THREAD_PRIORITY_BELOW_NORMAL
  0  :  THREAD_PRIORITY_NORMAL
  1  :  THREAD_PRIORITY_ABOVE_NORMAL
  2  :  THREAD_PRIORITY_HIGHEST
  15 :  THREAD_PRIORITY_TIME_CRITICAL
do SetThreadPriority(h,15)  ->  ߳ȼΪ

::GetThreadPriority
function GetThreadPriority(h:integer): integer;
ȡ̵߳ȼ
set x=GetThreadPriority(h)

::SetPriorityClass
function SetPriorityClass(h:integer; dwPriorityClass:integer): integer;
ý̵ȼóɹ1򷵻0
h: ̾
dwPriorityClass: ȼ룬ȡֵ
  $80  :  HIGH_PRIORITY_CLASS
  $40  :  IDLE_PRIORITY_CLASS
  $20  :  NORMAL_PRIORITY_CLASS
  $100 :  REALTIME_PRIORITY_CLASS
do SetPriorityClass(h, $100)

::GetPriorityClass
function GetPriorityClass(h:integer): integer;
ȡ̵ȼ
set x=GetPriorityClass(h)

::GetWindowThreadProcessID
function GetWindowThreadProcessID(h:integer; var ProcessID): integer;
ȡָصĽ̺̱߳ʶIDProcessIDؽIDֵΪ߳ID
h: ھ
ProcessID: ؽID
set x=GetWindowThreadProcessID(h,ProcessID)

::TerminateThread
function TerminateThread(h:integer; [ExitCode:integer]): integer;
̵ָ߳Уɹ1򷵻0
h: ߳̾
ExitCode: ѡ̷ָ߳ش룬ĬΪ0
 do TerminateThread(h)

::TerminateProcess
function TerminateProcess(h:integer; [ExitCode:integer]): integer;
̵ָУɹ1򷵻0
h: ̾
ExitCode: ѡ̵ָķش룬ĬΪ0
do TerminateProcess(h)

::RegWriteInteger
function RegWriteInteger(RootKey:string; Key:string; Name:string; Value:integer): integer;
дעֵּɹ򷵻1򷵻0
RootKey: עֵܵΪ
  "HKEY_CLASSES_ROOT"
  "HKEY_CURRENT_USER"
  "HKEY_LOCAL_MACHINE"
  "HKEY_USERS"
  "HKEY_CURRENT_CONFIG"
Key: ע·
Name: ע
Value: Ҫдעֵ
do RegWriteInteger("HKEY_CURRENT_USER","\Software\Microsoft\Windows\CurrentVersion\RunOnce","MyAPP",0)

::RegReadInteger
function RegReadInteger(RootKey:string; Key:string; Name:string; DefaultValue:integer): integer;
ȡעֵּɹ򷵻ضȡֵ򷵻DefaultValue
RootKey: עֵܵΪ
  "HKEY_CLASSES_ROOT"
  "HKEY_CURRENT_USER"
  "HKEY_LOCAL_MACHINE"
  "HKEY_USERS"
  "HKEY_CURRENT_CONFIG"
Key: ע·
Name: ע
DefaultValue: ȡʧܣصĬֵ
set x=RegReadInteger("HKEY_CURRENT_USER","\Software\Microsoft\Windows\CurrentVersion\RunOnce","MyAPP",-1)

::RegWriteString
function RegWriteString(RootKey:string; Key:string; Name:string; Value:String): integer;
дעֵּɹ򷵻1򷵻0
RootKey: עֵܵΪ
  "HKEY_CLASSES_ROOT"
  "HKEY_CURRENT_USER"
  "HKEY_LOCAL_MACHINE"
  "HKEY_USERS"
  "HKEY_CURRENT_CONFIG"
Key: ע·
Name: ע
Value: Ҫдעַ
do RegWriteString("HKEY_CURRENT_USER","\Software\Microsoft\Windows\CurrentVersion\RunOnce","MyAPP","TEST")

::RegReadString
function RegReadString(RootKey:string; Key:string; Name:string; DefaultValue:integer): integer;
ȡעֵּɹ򷵻ضȡֵ򷵻DefaultValue
RootKey: עֵܵΪ
  "HKEY_CLASSES_ROOT"
  "HKEY_CURRENT_USER"
  "HKEY_LOCAL_MACHINE"
  "HKEY_USERS"
  "HKEY_CURRENT_CONFIG"
Key: ע·
Name: ע
DefaultValue: ȡʧܣصĬַ
set s=RegReadString("HKEY_CURRENT_USER","\Software\Microsoft\Windows\CurrentVersion\RunOnce","MyAPP","")
