Autoit 格式错误的变量或宏
Autoit Badly formated variable or macro
我是 Autoit 的新手并尝试这样做:
Local $stest = "C:\Program Files (x86)\test\test.exe";
Local $sPath;
runS($stest);
Func runS(String $sPath) {
this.$sPath = $sPath;
If FileExists($stest) {
Run($stest , "", @SW_SHOWMAXIMIZED)
}
}
并得到这个错误:
(6) : ==> Badly formated variable or macro.:
我只是想在函数中写一个参数作为路径...
- AutoIt 中没有以“;”结尾的行。这 ”;”用于评论
AutoIt.
- If 语句必须有一个“then”语句。
- AutoIt 中没有任何内容是用大括号“{}”打开或关闭的。
- 大多数语句以 EndIf、EndFunc 和
温.
您的代码应如下所示:
;$g_sTest is global variable because it is being declared outside of a function.
Global $g_sTest = "C:\Program Files (x86)\test\test.exe"
runS($stest)
;$sPath will be a local variable because it is being declared inside of the fuction.
Func runS($sPath)
If FileExists($sPath) Then
Run($sPath, "", @SW_SHOWMAXIMIZED)
EndIf
EndFunc
我是 Autoit 的新手并尝试这样做:
Local $stest = "C:\Program Files (x86)\test\test.exe";
Local $sPath;
runS($stest);
Func runS(String $sPath) {
this.$sPath = $sPath;
If FileExists($stest) {
Run($stest , "", @SW_SHOWMAXIMIZED)
}
}
并得到这个错误:
(6) : ==> Badly formated variable or macro.:
我只是想在函数中写一个参数作为路径...
- AutoIt 中没有以“;”结尾的行。这 ”;”用于评论 AutoIt.
- If 语句必须有一个“then”语句。
- AutoIt 中没有任何内容是用大括号“{}”打开或关闭的。
- 大多数语句以 EndIf、EndFunc 和 温.
您的代码应如下所示:
;$g_sTest is global variable because it is being declared outside of a function.
Global $g_sTest = "C:\Program Files (x86)\test\test.exe"
runS($stest)
;$sPath will be a local variable because it is being declared inside of the fuction.
Func runS($sPath)
If FileExists($sPath) Then
Run($sPath, "", @SW_SHOWMAXIMIZED)
EndIf
EndFunc