【方法一】学用AutoHotkey的可能不习惯没有print函数吧,输出都用msgbox有些怪怪的,下面我就为使用Scite4AutoHotkey的用户写个print函数,请将此函数另存到你的lib目录,命名为print.ahk即可,不用引用而直接使用了。
print(text)
{
oSciTE:= ComObjActive("SciTE4AHK.Application")
oSciTE.Output(text)
}
输出你好的效果如下

【清屏】
SciObj := ComObjActive("SciTE4AHK.Application") ;get pointer to active SciTE window SendMessage,SciObj.Message(0x111,420)
SciTE_Output("hello中国")
SciTE_Output("计算式1+1=" . 1+1,0,0)
SciTE_Output("计算式1+1=" . 1+1,0,1,1)
return
;https:///boards/viewtopic.php?f=7&t=20397
SciTE_Output(Text,Clear=1,LineBreak=1,Exit=0){
SciObj := ComObjActive("SciTE4AHK.Application") ;get pointer to active SciTE window
IfEqual,Clear,1,SendMessage,SciObj.Message(0x111,420) ;If clear=1 Clear output window
IfEqual, LineBreak,1,SetEnv,Text,`r`n%text% ;If LineBreak=1 prepend text with `r`n
SciObj.Output(Text) ;send text to SciTE output pane
IfEqual, Exit,1,MsgBox, 36, Exit App?, Exit Application? ;If Exit=1 ask if want to exit application
IfMsgBox,Yes, ExitApp ;If Msgbox=yes then Exit the appliciation
}
【方法二】网友写的调用cmd.exe来显示输出信息的:

ControlSend,,cls`r,ahk_class ConsoleWindowClass if(WinExist("ahk_class ConsoleWindowClass")=0) ControlSend,,::%内容%`r,ahk_class ConsoleWindowClass
【推荐方法】:用ahk内置命令OutputDebug来调试,需下载debugview工具:
https://github.com/CobaltFusion/DebugViewPP
DebugView 的增强版本。可以捕捉指定进程、含命令行版本。

在ahk脚本中用OutputDebug命令来输出调试信息,命令形式如下:
OutputDebug,想要输出的字符串

|