Cmds:="关屏|注销|重启|关机"
MsgBox % getCmd(3,Cmds) ;重启
MsgBox % getCmd(2) ;注销
MsgBox % getCmdIdx("重启") ;3
MsgBox % getCmdIdx1("关屏") ;1
return
getCmd(idx,Cmds:="关屏|注销|重启|关机")
{
Return SubStr(Cmds,idx*3-2,2)
}
getCmdIdx(thisCmd,Cmds:="关屏|注销|重启|关机") {
Return (InStr(Cmds,thisCmd)+2)//3
}
getCmd1(idx,Cmds:="关屏|注销|重启|关机")
{
arrCmds:=StrSplit(Cmds,"|")
return arrCmds[idx]
}
getCmdIdx1(thisCmd,Cmds:="关屏|注销|重启|关机") {
arrCmds:=StrSplit(Cmds,"|")
ret:=-1
for k,v in arrCmds
{
if (v=thisCmd)
ret:=k
}
return ret
}