|
【方法一】學(xué)用AutoHotkey的可能不習(xí)慣沒(méi)有print函數(shù)吧,輸出都用msgbox有些怪怪的,下面我就為使用Scite4AutoHotkey的用戶寫(xiě)個(gè)print函數(shù),請(qǐng)將此函數(shù)另存到你的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中國(guó)")
SciTE_Output("計(jì)算式1+1=" . 1+1,0,0)
SciTE_Output("計(jì)算式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
}
【方法二】網(wǎng)友寫(xiě)的調(diào)用cmd.exe來(lái)顯示輸出信息的:

ControlSend,,cls`r,ahk_class ConsoleWindowClass if(WinExist("ahk_class ConsoleWindowClass")=0) ControlSend,,::%內(nèi)容%`r,ahk_class ConsoleWindowClass
【推薦方法】:用ahk內(nèi)置命令OutputDebug來(lái)調(diào)試,需下載debugview工具:
https://github.com/CobaltFusion/DebugViewPP
DebugView 的增強(qiáng)版本。可以捕捉指定進(jìn)程、含命令行版本。

在ahk腳本中用OutputDebug命令來(lái)輸出調(diào)試信息,命令形式如下:
OutputDebug,想要輸出的字符串

|