for example I want to pass ANY ahk command text like "Click, 50, 50" or "MsgBox test",,, into a function and execute that command. Is it possible?
例如,我希望将任何ahk命令文本(如“Click,50,50”或“MsgBox test”、、)传递到一个函数中并执行该命令。有可能吗?
更多回答
优秀答案推荐
This may help you.
这可能对你有帮助。
#SingleInstance, Force
var := "example"
new_instance( "msgbox " var " 1`nexitapp" )
new_instance( "msgbox % ""another " var " 2"""
. "`nexitapp" )
new_instance( "msgbox another example 3`nexitapp" )
new_instance( "msgbox passing var`n"
. "var := """ var " 4""`n"
. "Msgbox % var `n"
. "exitapp" )
ExitApp, 0
new_instance( Script ) {
OutputDebug, % script ; for debug purpose
shell := ComObjCreate( "WScript.Shell" )
exec := shell.Exec( A_AhkPath " /ErrorStdOut *")
exec.StdIn.Write( script )
exec.StdIn.Close()
}
更多回答
It goes well. I thought this was an impossible feature. I appreciate it.
一切都很顺利。我认为这是一个不可能的功能。我很感激。
But shouldn't it be the case of "MouseMove, 10, 10, Relative"? I'm getting an error. Isn't that code applicable to all other AHK commands?
但这不应该是“鼠标移动,10,10,亲戚”的情况吗?我收到一个错误。该代码难道不适用于所有其他AHK命令吗?
new_instance( "MouseMove, 10, 10, Relative`nexitapp" ) It's working quite well for me on 1.1.36.02 V1.It's applicable to any code, but it's important to note that each code sent to this function is treated as a new instance. Therefore, it's advisable to review the output code carefully. Can you post your function call?
NEW_INSTANCE(“MouseMove,10,10,Relative`nexitapp”)它在1.1.36.02 V1上运行得很好,它适用于任何代码,但重要的是要注意,发送到该函数的每个代码都被视为新的实例。因此,建议仔细检查输出代码。你能发布你的函数调用吗?
I must have done something wrong. Now that's great. I appreciate it
我一定是做错了什么。这太好了。我很感激
Can this script be run in an environment where autohotkey is not installed?That's because there seems to be an error in the A_AhkPath part in an environment where autohotkey is not installed. Is all I need is the autohotkey.exe file?
此脚本可以在未安装自动热键的环境中运行吗?这是因为在未安装自动热键的环境中,A_AhkPath部分似乎存在错误。我只需要Autohotkey.exe文件吗?
我是一名优秀的程序员,十分优秀!