2013年1月6日 星期日

[AHK] How to create pop message and log file


[AHK] How to create pop message and log file



MsgBox, 0, demo, Press Esc to abort this script, 2.0  ; pop up message





/*************************************************

  2. SET UP A LOG FILE

*/



SetWorkingDir, %A_ScriptDir%  ;Set default directory to where this script file is located

LogFile := "1234.txt"

LogMsg(";--------------------------------------------------------------`n`nBEGIN EXAMPLE OF NAVIGATING WEBSITE:")



/****************************************

  and now, some functions...

*/

;------------------------------------------------------------------------------

LogMsg( msg )

{

  global LogFile   

  FormatTime, TimeString, , yyyy-MM-dd hh:mm:ss tt

  FileAppend, `n%TimeString% : %msg%, %LogFile%

  ;Note: I've had problems with heavy use of FileAppend. Sometimes it fails.

  ;You can check ErrorLevel, but can't get any further info on why it failed.

  ;FileAppend closes the file each time. That can be a lot of opening/closing.

}



Reference :



Related Posts:

0 意見:

張貼留言