我正在研究一些AutoIt代码来帮助我处理办公室恶作剧和东西。第一个字符串的作用是将字符串“shutdown pc00xxx”重写为shutdown /r /m pc00xxx /t 0
,但我无法获得第二个字符串。在AutoIt中重写一个字符串一次,但不是第二次
我有以下代码:
func RunProc($string)
Local $command = StringLower($string)
Local $subs = StringMid($command, 1, 4)
Local $computer = StringInStr($command, "pc")
if $subs == "shut" Then
Run("shutdown /r /m " & StringMid($command, $computer) & " /t 0")
ElseIf $subs == "clos" Then
Local $prleft = StringTrimLeft($command, 6)
Local $extend = StringInStr($command, "on")
Local $pright = StringTrimRight($prleft, $extend)
Local $strclose = StringMid($string, $prleft, $pright)
Run("taskkill.exe /S "& StringMid($command, $computer) & " /im " & $strclose & ".exe")
EndIf
的问题是,我试图改写短语“CLOSE “东西” ON “pc00xxx” 是taskkill.exe/S pc00xxx/IM SOMETHING.exe ,我正在尝试获取“CLOSE”和“ON pc00xxx之间的子串”。
因此,举例来说,我会键入关闭Outlook ON PC00xxx和有$ a的值strclose是:
$strclose = outlook