autohotkey - RegWrite 不写入注册表
问题描述
ValueType := A_Args[1]
KeyName := A_Args[2]
ValueName := A_Args[3]
ValueData := A_Args[4]
Loop, %0%
params .= A_Space %A_Index%
; https://autohotkey.com/docs/Run#RunAs
full_command_line := DllCall("GetCommandLine", "str")
if !(A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")) {
try {
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" "%params%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%" "%params%"
}
ExitApp
}
RegWrite, % ValueType, % KeyName, % ValueName, % ValueData
当我将参数传递给脚本时,为什么 RegWrite 不写入注册表?
解决方案
代码 87 表示无效参数。你传递给RegWrite
什么?
这是我用于调试的一个函数。如果isCondition
为真,则显示自定义错误消息并停止一切。
fAbort(isCondition, sFuncName, sNote, dVars:="") {
If isCondition {
sAbortMessage := % sFuncName ": " sNote
. "`n`nA_LineNumber: """ A_LineNumber """`nErrorLevel: """ ErrorLevel """`nA_LastError: """ A_LastError """`n"
For sName, sValue in dVars
sAbortMessage .= "`n" sName ": """ sValue """"
MsgBox, 16,, % sAbortMessage
ExitApp
}
}
之后RegWrite
它可以像这样使用:
fAbort(ErrorLevel ; 1, if RegWrite unsuccessful.
, "Script or function name here" ; Could use A_ThisFunc for current function name.
, "Registry write unsuccessful." ; Your custom message here.
, { x: "blabla", y: 13 } ; Additional vars you want to see in the msgbox.
)
推荐阅读
- sql-server - SQL Server:关系
- ios - 在tableview swift中根据用户选择传递Json对象
- regex - 正则表达式匹配错误的可选组
- javascript - Get value from a TextInput component in react native
- python - geopandas 从给定点找到所有可能的相邻/最近的几何点
- c# - 在 Blazor 中切换按钮标题的正确方法是什么?
- isabelle - Isabelle/ZF nat 不等式
- javascript - 如何添加这些(数组)?
- python - 升级到 Python 3.5 但 uWSGI 使用 Python 2.7
- google-cloud-firestore - 从 Firestore 公开项目 ID 是否是一个安全漏洞?