매크로

조회 수 185 추천 0 댓글 0

사용코드 : https://tailstar.net/index.php?mid=autohotkey&category=295327&page=2&document_srl=12131982

예지력 1님의 MS오피스 스타일 GUI 프로토타입


왜 F5:: 를 누르면 Qty에 지정된 숫자만큼 반복하지 않고 정상작동이 안되요..

버튼으로 눌러야만 정상작동이 되는데 ..원인을 모르겠습니다.



;============

;사용코드

;============


#SingleInstance, Off  ;프로그램 중복실행 허용

#NoEnv  ;내장환경변수 제거, 퍼포먼스 향샹 목적

#NoTrayIcon  ;트레이아이콘 제거

#KeyHistory 0  ;키저장기능 제거, 퍼포먼스 향샹 목적

ListLines Off  ;라인제거, 퍼포먼스 향샹 목적

SetWinDelay, 0  ;윈도우 관련 딜레이 최소한으로 설정 (-1은 딜레이X)

SetBatchLines, -1  ;코드간 자동 Sleep 삭제, 속도 향샹 목적

new OfficeGUI()

return

 

class OfficeGUI {

 

static GuiW := A_ScreenWidth * 0.3, GuiH := A_ScreenHeight * 0.6  ;시작 Static 변수 Assign

 

__New() {

 

this.Bound := []  ;오브젝트 생성

this.Bound.IconButton := this.IconButton.Bind(this)  ;이하 버튼 g라벨 초기 설정 구간

this.Bound.MinimizeButton := this.MinimizeButton.Bind(this)

this.Bound.MaximizeButton := this.MaximizeButton.Bind(this)

this.Bound.CloseButton := this.CloseButton.Bind(this)

this.Bound.MoveButton := this.MoveButton.Bind(this)

this.Color := "FFFFFF"  ;배경색 Assign

 

Gui, New, -DPIScale -Caption +Resize +hwndhMainWindow  ;구이 윈도우설정

this.hMainWindow := hMainWindow  ;클래스내 사용을위해 hwnd 설정

 

Gui, Margin, 0, 0  ;컴포넌트 간의 기본폭 삭제

Gui, Color, % this.Color  ;배경색 지정

 

; 아래는 BoundFunction 관련 코드 (도움말 http://ahkscript.org/docs/objects/Functor.htm)

Gui, Add, Text, % " x" 1 " y" 1 " w" 37 " h" 28 " +BackgroundTrans hwndhIconButton"  ; 아이콘 영역 설정

this.hIconButton := hIconButton  ;아이콘 hwnd 설정

BoundIconButton := this.Bound.IconButton  ;함수 바운드

GuiControl, +g, %hIconButton%, %BoundIconButton%  ;아이콘버튼 g라벨 바운드

 

Gui, Add, Text, % " x" this.GuiW-89 " y" 4 " w" 29 " h" 22 " +BackgroundTrans hwndhMinimizeButton" ;최소화 영역 설정

this.hMinimizeButton := hMinimizeButton  ;최소화 hwnd 설정

BoundMinimizeButton := this.Bound.MinimizeButton  ;함수 바운드

GuiControl, +g, %hMinimizeButton%, %BoundMinimizeButton%  ;최소화버튼 g라벨 바운드

 

Gui, Add, Text, % " x" this.GuiW-59 " y" 4 " w" 29 " h" 22 " +BackgroundTrans hwndhMaximizeButton"  ;최대화  영역

this.hMaximizeButton := hMaximizeButton  ;최대화 hwnd 설정

BoundMaximizeButton := this.Bound.MaximizeButton  ;함수 바운드

GuiControl, +g, %hMaximizeButton%, %BoundMaximizeButton%  ;최대화버튼 g라벨 바운드

 

Gui, Add, Text, % " x" this.GuiW-30 " y" 4 " w" 29 " h" 22 " +BackgroundTrans hwndhCloseButton"  ;종료 (X) 영역

this.hCloseButton := hCloseButton  ;종료 hwnd 설정

BoundClose := this.Bound.CloseButton  ;함수바운드

GuiControl, +g, %hCloseButton%, %BoundClose%  ;종료버튼 g라벨 바운드

 

Gui, Add, Text, % " x" 1 " y" 1 " w" this.GuiW-2 " h" 28 " +BackgroundTrans hwndhMoveButton"  ;상단바  영역

this.hMoveButton := hMoveButton  ;hwnd 설정

BoundMoveButton := this.Bound.MoveButton  ;함수바운드

GuiControl, +g, %hMoveButton%, %BoundMoveButton%  ;상단 드래그영역 g라벨 바운드

 

;이제부터는 Progrss를 이용한 버튼이미지 그리기 부분

Gui, Add, Progress, % " x" 11 " y" 4 " w" 16 " h" 16 " Background0072C6", 0  ;GUI 아이콘

Gui, Add, Progress, % " x" this.GuiW-80 " y" 10 " w" 9 " h" 2 " Background777777 hwndhMin", 0  ;GUI MINIMIZE

Gui, Add, Progress, % " x" this.GuiW-50 " y" 3 " w" 11 " h" 2 " Background777777 hwndhMaxT", 0  ;GUI 최대화 top

Gui, Add, Progress, % " x" this.GuiW-50 " y" 11 " w" 11 " h" 2 " Background777777 hwndhMaxB", 0  ;GUI 최대화 bottom

Gui, Add, Progress, % " x" this.GuiW-41 " y" 3 " w" 2 " h" 10 " Background777777 hwndhMaxR", 0  ;GUI 최대화 right

Gui, Add, Progress, % " x" this.GuiW-50 " y" 3 " w" 2 " h" 10 " Background777777 hwndhMaxL", 0  ;GUI 최대화 left

  

Gui, Add, Progress, % " x" this.GuiW-20 " y" 4 " w" 1 " h" 1 " Background777777 hwndhXTL1", 0  ;GUI CLOSE TOP-LEFT 01

Gui, Add, Progress, % " x" this.GuiW-21 " y" 5 " w" 3 " h" 1 " Background777777 hwndhXTL2", 0  ;GUI CLOSE TOP-LEFT 02

Gui, Add, Progress, % " x" this.GuiW-20 " y" 6 " w" 3 " h" 1 " Background777777 hwndhXTL3", 0  ;GUI CLOSE TOP-LEFT 03

Gui, Add, Progress, % " x" this.GuiW-13 " y" 4 " w" 1 " h" 1 " Background777777 hwndhXTR1", 0  ;GUI CLOSE TOP-RIGHT 01

Gui, Add, Progress, % " x" this.GuiW-14 " y" 5 " w" 3 " h" 1 " Background777777 hwndhXTR2", 0  ;GUI CLOSE TOP-RIGHT 02

Gui, Add, Progress, % " x" this.GuiW-15 " y" 6 " w" 3 " h" 1 " Background777777 hwndhXTR3", 0  ;GUI CLOSE TOP-RIGHT 03

Gui, Add, Progress, % " x" this.GuiW-19 " y" 7 " w" 6 " h" 1 " Background777777 hwndhXC1", 0  ;GUI CLOSE CENTER 01

Gui, Add, Progress, % " x" this.GuiW-18 " y" 8 " w" 4 " h" 1 " Background777777 hwndhXC2", 0  ;GUI CLOSE CENTER 02

Gui, Add, Progress, % " x" this.GuiW-18 " y" 9 " w" 4 " h" 1 " Background777777 hwndhXC3", 0  ;GUI CLOSE CENTER 03

Gui, Add, Progress, % " x" this.GuiW-19 " y" 10 " w" 6 " h" 1 " Background777777 hwndhXC4", 0  ;GUI CLOSE CENTER 04

Gui, Add, Progress, % " x" this.GuiW-20 " y" 11 " w" 3 " h" 1 " Background777777 hwndhCBL1", 0  ;GUI CLOSE BOTTOM-LEFT 01

Gui, Add, Progress, % " x" this.GuiW-21 " y" 12 " w" 3 " h" 1 " Background777777 hwndhCBL2", 0  ;GUI CLOSE BOTTOM-LEFT 02

Gui, Add, Progress, % " x" this.GuiW-20 " y" 13 " w" 1 " h" 1 " Background777777 hwndhCBL3", 0  ;GUI CLOSE BOTTOM-LEFT 03

Gui, Add, Progress, % " x" this.GuiW-15 " y" 11 " w" 3 " h" 1 " Background777777 hwndhCBR1", 0  ;GUI CLOSE BOTTOM-RIGHT 01

Gui, Add, Progress, % " x" this.GuiW-14 " y" 12 " w" 3 " h" 1 " Background777777 hwndhCBR2", 0  ;GUI CLOSE BOTTOM-RIGHT 02

Gui, Add, Progress, % " x" this.GuiW-13 " y" 13 " w" 1 " h" 1 " Background777777 hwndhCBR3", 0  ;GUI CLOSE BOTTOM-RIGHT 03

Gui, Add, Progress, % " x" 1 " y" this.GuiH-23 " w" this.GuiW-2 " h" 22 " Background0072C6 hwndhBar", 0  ;GUI STATUSBAR


Gui, Font, s9 c444444, Segoe UI  ;프로그램 타이틀 텍스트를위해 폰트설정

Gui, Add, Text, % " x" 37 " y" 2 " w" this.GuiW-96 " +Center +BackgroundTrans hwndhTitletext", 프로그램 타이틀

Gui, Font  ;폰트 초기화


Gui, Font, s8 cFFFFFF, Segoe UI  ;하단 메시지 텍스트를위해 폰트설정

Gui, Add, Text, % " x" 8 " y" this.GuiH-19 " w" this.GuiW-16 " +BackgroundTrans hwndhBarText", 하단 메시지 텍스트

Gui, Font  ;폰트 초기화



;=====================================================================

;  GUI CODE START

;=====================================================================

Gui, Font, S9  normal, 맑은 고딕

Gui, Add, GroupBox, x32 y103 w250 h130 cBLUE  , Excel to Batch

Gui, Add, Text, x42 y145 w40 h20 +Center, 시간

Gui, Add, Text, x42 y185 w40 h20 +Center, 횟수


Gui, Font, S16  normal, 맑은 고딕

Gui, Add, Edit, x82 y133 w100 h40 +Center vtime1,

Gui, Add, Edit, x82 y173 w100 h40 +Center vQty1,


Gui, Font, S9  normal,  맑은 고딕

Gui, Add, Button, x182 y133 w90 h80 +Center, F5

;=====================================================================

;  GUI CODE END

;=====================================================================

WinEvents.Register(this.hMainWindow, this)  ;기본 GuiEvent 레지스트


Gui, Show, % " w" this.GuiW " h" this.GuiH, GUI

}

 

IconButton()  ;아이콘버튼, Bound된 g라벨 Function

{

    SendInput, !{Space}  ;컨트롤메뉴 보이게

}

 

MinimizeButton()  ;최소화버튼, Bound된 g라벨 Func

{

    WinMinimize

}

 

MaximizeButton()  ;최대화버튼, Bound된 g라벨 Func

{

    VarSetCapacity(rect, 16, 0)

    DllCall("GetClientRect", uint, this.hMainWindow, uint, &rect )  ;보더와 캡션을 제외한 실제 윈도우영역을 구함

    if (NumGet( rect, 8, "int" ) >= A_ScreenWidth - 50)

        WinRestore

   else

       WinMaximize

}

 

MoveButton() ;상단 드래그영역, Bound된 g라벨 Func

{

    PostMessage, 0xA1, 2,,, A  ;드래그

}

 

CloseButton()  ;종료 X버튼, Bound된 g라벨 Func

{

    this.Delete("Bound")  ;Bound 오브젝트 제거

    WinEvents.Unregister(this.hMainWindow)  ;기본 GuiEvent 설정 언로드

    Gui, Destroy

    ExitApp

}

 

GuiSize()  ;구이 리사이즈, WinEvents.Register(this.hMainWindow, this)로 인해 Bound됨

{

    global

    GuiControl, Move, % this.hMinimizeButton, % "x" A_GuiWidth - 89 " y" 4 " w" 29 " h" 22

    GuiControl, Move, % this.hMaximizeButton, % "x" A_GuiWidth - 59 " y" 4 " w" 29 " h" 22

    GuiControl, Move, % this.hCloseButton, % "x" A_GuiWidth - 29 " y" 4 " w" 29 " h" 22

    GuiControl, Move, % this.hMoveButton, % "x" 1 " y" 1 " w" A_GuiWidth - 2 " h" 28

    GuiControl, Move, % hMin, % "x" A_GuiWidth - 80 " y" 10 " w" 9 " h" 2

    GuiControl, Move, % hMaxT, % "x" A_GuiWidth - 50 "y" 3 "w" 11 "h" 2

    GuiControl, Move, % hMaxB, % "x" A_GuiWidth - 50 "y" 11 "w" 11 "h" 2

    GuiControl, Move, % hMaxR, % "x" A_GuiWidth - 41 "y" 3 "w" 2 "h" 10

    GuiControl, Move, % hMaxL, % "x" A_GuiWidth - 50 "y" 3 "w" 2 "h" 10

    GuiControl, Move, % hXTL1, % "x" A_GuiWidth - 20 " y" 4 " w" 1 " h" 1

    GuiControl, Move, % hXTL2, % "x" A_GuiWidth - 21 " y" 5 " w" 3 " h" 1

    GuiControl, Move, % hXTL3, % "x" A_GuiWidth - 20 " y" 6 " w" 3 " h" 1

    GuiControl, Move, % hXTR1, % "x" A_GuiWidth - 13 " y" 4 " w" 1 " h" 1

    GuiControl, Move, % hXTR2, % "x" A_GuiWidth - 14 " y" 5 " w" 3 " h" 1

    GuiControl, Move, % hXTR3, % "x" A_GuiWidth - 15 "y" 6 "w" 3 "h" 1

    GuiControl, Move, % hXC1, % "x" A_GuiWidth - 19 " y" 7 " w" 6 " h" 1

    GuiControl, Move, % hXC2, % "x" A_GuiWidth - 18 " y" 8 " w" 4 " h" 1

    GuiControl, Move, % hXC3, % "x" A_GuiWidth - 18 " y" 9 " w" 4 " h" 1

    GuiControl, Move, % hXC4, % "x" A_GuiWidth - 19 " y" 10 " w" 6 " h" 1

    GuiControl, Move, % hCBL1, % "x" A_GuiWidth - 20 " y" 11 " w" 3 " h" 1

    GuiControl, Move, % hCBL2, % "x" A_GuiWidth - 21 " y" 12 " w" 3 " h" 1

    GuiControl, Move, % hCBL3, % "x" A_GuiWidth - 20 " y" 13 " w" 1 " h" 1

    GuiControl, Move, % hCBR1, % "x" A_GuiWidth - 15 " y" 11 " w" 3 " h" 1

    GuiControl, Move, % hCBR2, % "x" A_GuiWidth - 14 " y" 12 " w" 3 " h" 1

    GuiControl, Move, % hCBR3, % "x" A_GuiWidth - 13 " y" 13 " w" 1 " h" 1

    GuiControl, Move, % hBar, % "x" 1 " y" A_GuiHeight - 23 " w" A_GuiWidth - 2 " h" 22

    GuiControl, Move, % hTitletext, % "x" 37 " y" 2 " w" A_GuiWidth - 96

    GuiControl, Move, % hBarText, % "x" 8 " y" A_GuiHeight - 19 " w" A_GuiWidth - 16

    WinSet, Redraw

}

}

 

class WinEvents

{

    static Table := {}


Register(hWnd, Class, Prefix="Gui")

{

    Gui, +LabelWinEvents.

    this.Table[hWnd] := {Class: Class, Prefix: Prefix}

}


Unregister(hWnd)

{

    this.Table.Delete(hWnd)

}


Dispatch(hWnd, Type)

{

    Info := this.Table[hWnd]

    return Info.Class[Info.Prefix . Type].Call(Info.Class)

}


Size()

{

    return WinEvents.Dispatch(this, "Size")

}

}


;====== 기본 창 활성화 소스=========

^1::

WinGetActiveTitle, title1

MsgBox, 0, ,title1 : %title1%, 1

return


^2::

WinGetActiveTitle, title2

MsgBox, 0, ,title2 : %title2%, 1

return

^!1::

{

MSGBOX, %A_Temp%

}

return

;==================== BASIC START ====================

F5::

ButtonF5:

Gui, submit, Nohide

Loop, %Qty1%

{

WinActivate, %title1%

WinWaitActive, %title1%

sleep, %time1%

Send, ^c

sleep, %time1%

send, {down}

sleep, %time1%

WinActivate, %title2%

WinWaitActive, %title2%

sleep, %time1%

send, ^v

sleep, %time1%

send, {enter}

WinActivate, %title1%

WinWaitActive, %title1%

sleep, %time1%

}

MsgBox, !!

return





GuiClose:

ExitApp

F2::Reload

F3::pause

F4::ExitApp



List of Articles
분류 제목 글쓴이 최근변경 추천
질문 여러기기 ADB 연결 관련 질문드립니다. 2 joeypre 2017.01.13 0/0
질문 린2 매크만드시는분들중에 비활성 어찌하고 계시나요? 가족오락관 2017.01.12 0/0
질문 오토핫키 뮤텍스 우회 질문합니다 2 Erica 2017.01.29 0/0
질문 매크로 질문좀 하려구영 어렵네여 1 칠무해훈남 2017.01.16 0/0
질문 Hotkey가 안먹히는데 원인을 모르겠어요. (단축키 : F5::) 법돌 2017.01.10 0/0
질문 Combobox 에 대해 궁금한게 있어요 스웨이스 2017.01.10 0/0
질문 모니터 끄면 이미지 서치가 안됩니다.. 3 Redori 2017.01.20 0/0
질문 비활성화로 키 계속 누른건 어덯게하나요? ejejej 2017.01.10 0/0
질문 while문 궁금한게 있습니다. 4 스웨이스 2017.01.10 0/0
질문 고급시계 경작매크로있으신분이나..제작가능하신분~ 진호 2017.01.08 0/0
질문 CoordMode 와 WingetPos에 대해 궁금한게 있습니다. 2 스웨이스 2017.01.08 0/0
질문 변수에 대해서 질문있습니다. 4 카카오고양이 2017.01.07 0/0
질문 GUI 버튼 모양/색상변경방법문의드려요 법돌 2017.01.07 0/0
질문 오토핫키 L버전? 어떻게 확인하는거죠 법돌 2017.01.05 0/0
질문 리스트뷰에 체크박스 .. .혹시 어떤식으로 값을 가져와... 5 제발등업좀2 2017.01.13 0/0
질문 초보. 이미지 서칭 질문좀여~ 1 흐리흐리 2017.01.20 0/0
질문 비활성 이미지서치가 크롬에서 안되는이유가 있나요? 법돌 2017.01.04 0/0
질문 타이틀로 실행메크로 지정방법이 있나요? 2 법돌 2017.01.05 0/0
질문 오토핫키 이미지서치 오류가 좀 나는거 같은데 해결법 ... 2 스웨이스 2017.01.04 0/0
질문 매크로 실행 후 매크로내의 버튼 같은것들 비활성화 시... 1 hiki 2017.01.03 0/0
Board Pagination Prev 1 ... 9596979899100101102103 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글