ex12_debug.zip



/*

##############################################

예제 12 debug


- 목표

  autohotkey 디버그 방법에 대해서 알아본다.

  msgbox, outputdebug,listvars,listlines

  

  msgbox : 실행을 중지하고 실행유무나 변수를 확인한다.

  outputdebug : 실행을 중지하지 않고 로그를 출력한다. 

      debugview 프로그램 필요 ( www.sysinternals.com )

      www.sysinternals.com 사이트에서 다운받은 

      debugview.exe 를 실행하고 script를 돌려본다.

      autohotkey와 관련없는 window 자체 로그도 같이 나와서 불편함.

  listvars : 변수값들을 보여준다.

  listlines : 최근 실행된 라인을 보여준다.



  

  저는 대부분 outputdebug 와 msgbox 를 이용해서 debugging 하고 있습니다.

###############################################

*/




#SingleInstance, Force ;이 스크립트는 동시에 한개만 실행되도록 한다. 이미 동작중이면 kill 하고 다시 실행한다.

#noenv ;변수가 window 환경변수값인지 체크하지 않는다. 속도 향상

SetBatchLines, -1 ;라인간 딜레이 없음. 속도향상



SetWorkingDir, %A_ScriptDir%   ;스크립트가 있는 폴더를 실행폴더로 설정합니다.

                               ;image파일 이름만 있는경우, 현재 실행 폴더에서 이미지 파일을 찾습니다.



변수:=1  ;listvars에 보이는지 확인용.

G1=kkkkk


gui, 1:+resize

Gui, 1:Add, Button,ggGui1 vvGuiB1,outputdebug 로그 보기

Gui, 1:Add, Button,ggGui1 vvGuiB2,메세지 박스로 보기

Gui, 1:Add, Button,ggGui1 vvGuiB3,변수 값 보기

Gui, 1:Add, Button,ggGui1 vvGuiB4,최근 실행줄 보기


Gui, 1:show

outputdebug DebugView.exe 파일이용 여기다.

msgbox 프로그램 시작시 기본 실행되는 영역(최초 return 만날때까지) ; msgbox 로 debugging

return

; 이다음부터 나오는 label ,hotkey, functinos 는 호출해야지 실행됩니다.


gGui1:

    if(A_GuiControl ="vGuiB1")

        gosub L_showOutputDebug

    else if(A_GuiControl ="vGuiB2")

        gosub L_showMsgBox

    else if(A_GuiControl ="vGuiB3")

        gosub L_showListVars

    else if(A_GuiControl ="vGuiB4")

        gosub L_showListLines

return



L_showListLines:

    ListLines

    pause

return


L_showListVars:

    ListVars

return


L_showOutputDebug:

    loop,3

    {

        outputdebug %A_Index% 프로그램 흐름에 방해하지 않고 같을 확인한다.

    }

return


L_showMsgBox:

    loop,3

    {

       msgbox %A_Index% 프로그램을 중지시키고 값을 확인하기 용이 하다.

    }

return


guiclose:

exitapp



반응형

+ Recent posts