Skip to content
AutoHotKey
2011.02.21 23:55

COM 사용

조회 수 19066 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

ahk_l COM  사용



com_CreateObject 는 새롭게 만드는 것이고,

그후에 com_invoke로 세부 명령을 주는 방식으로 사용되는데...


현재 띄워져 있는 익스플로러의 InternetExplorer.Application 을 invoke 해서 
document의 body를 만진다... 라고 할때

InternetExplorer.Application의정보는


http://www.autohotkey.com/forum/topic34972.html 




;네이버가 타이틀에 포함된 익스플로러 창이 존재하면, google 창으로 이동시킵니다. 

COM_Init() 
pageSearched:="네이버" 
Loop, % COM_Invoke(psw := COM_Invoke(psh:=COM_CreateObject("Shell.Application"), "Windows"), "Count") 

LocationName:=COM_Invoke(pwb:=COM_Invoke(psw, "Item", A_Index-1), "LocationName") 
IfInString,LocationName,%pageSearched% 

url:="http://www.google.com" 
COM_Invoke(pwb, "Navigate", url) 
Break 


COM_Release(pwb) ;didnt break so release the one we didnt use 


return




#include, com.ahk 
COM_Init() 
pageSearched:="네이버" 
psh:=COM_CreateObject("Shell.Application") 
psw:=COM_Invoke(psh, "Windows") 
LCt:=COM_Invoke(psw, "Count")                                        ;Shell.Windows.Count (LoopCount) 
  Loop, % lct 
  { 
  pwb:=COM_Invoke(psw, "Item", A_Index-1)                    ;Shell.Windows.Item 
;pwb:=Shell.Windows.Item 의 값이 0이면(Shell.Windows.Item가 아니면) Continue(LocationName 에서 에러발생) 
      if pwb=0 
      Continue 
  LocationName:=COM_Invoke(pwb, "LocationName")          ;창이름을 갖는 변수 (InternetExplorer Object) 
      IfInString,LocationName,%pageSearched% 
      { 
      url:="http://www.google.com" 
      COM_Invoke(pwb, "Navigate", url) 
      Break 
      } 
  COM_Release(pwb) 
  } 

약간의 주석과 초보자가 보기쉽게 수정해봤어요.. 주석이 맞으려나 모르겠네요; 
;pwb:=Shell.Windows.Item 의 값이 0이면(Shell.Windows.Item가 아니면) Continue(LocationName 에서 에러발생) 
      if pwb=0 
      Continue 
이부분은 써놓고도 뭔지 모르겠어요;





    Basic understanding of COM Pointer 
    Understanding of COM_CreateObject MSDN 
      MSDN does a fine job explaining this i wont re hash it just remember creates a parent object for use with our invoke calls

    Understanding of COM_AtlAxGetControl MSDN 
    Understanding of COM_AtlAxCreateContainer MSDN 
      we will be using COM_AtlAxCreateContainer and COM_AtlAxGetControl in our examples just remember this is a way of getting a control pointer from a window control that we are in our case creating

    Understanding of COM_Invoke MSDN 
      Sean gives us a Basic Example. Basically this is an execution function. if you need to get or set a value execute a method of move from a parent object to a member object you can do so from COM_Invoke

    Understanding of COM_Release MSDN 
      In the interest of trying to dumb this down here goes. 
      everytime you create a pointer to an object or interface you should release it for each time you create it you do not release strings just object and interface pointers. Its a way of freeing memory and its good for your program but well if you dont do it the worst that can happen on most beginner scripts is some semi slow performance

    Understanding of COM_QueryService MSDN 
      In our examples we will use this function to get one object pointer from another using CLSID. there are instances when getting pwin can bypass some security zone settings which can cause scripts to fail at times

    Understanding of COM_QueryInterface MSDN 
      Returns a pointer to a specified interface on an object to which a client currently holds an interface pointer.

    Understanding of COM_ConnectObject MSDN 
      Just remember this is how we can setup ahk access to events. Gonna be a much later before I cover events but be patient


It is also imperitive that we have an understanding of the following 

    Basic Understanding of IE architecture MSDN 
    Basic understanding of the webrowser object for Gui MSDN [url=http://msdn.microsoft.com/en-us/library/aa741312(VS.85).aspx]MSDN[/url]


For our automation tasks we will be aquireing and interface pointer to iWebrowser2 through out my examples you will see this reflected as pwb 
    First I want to remind all please have COM in the standard libraries such as c:\program files\autohotkey\lib 

    Always initialize COM once per script 
    If you will not be using a GUI object





로그인 후 댓글쓰기가 가능합니다.

?

  1. 17
    Mar 2010
    13:03

    TCPDUMP 사용방법 / TCP 자세히 보기

    Category컴퓨터잡담 Views18043
    Read More
  2. 10
    Feb 2011
    22:57

    AutoHotkey COM Standard Library

    CategoryAutoHotKey Views18046
    Read More
  3. 29
    Mar 2010
    15:04

    50 개 이상의 Ajax 예제들

    Category컴퓨터잡담 Views18179
    Read More
  4. 16
    Feb 2011
    07:05

    [ahk_l] 섬세한 인터넷 자동검색

    CategoryAutoHotKey Views18185
    Read More
  5. 23
    Jul 2010
    10:47

    윈도 로그인하기 전에 배치파일을 실행하는 방법

    Category컴퓨터잡담 Views18259
    Read More
  6. 09
    Feb 2011
    19:27

    com.ahk

    CategoryAutoHotKey Views18260
    Read More
  7. 23
    Oct 2011
    12:59

    Excel VBA) DAO를 이용하여 엑셀문서 열지않고 데이타 가져오기

    Category컴퓨터잡담 Views18275
    Read More
  8. 12
    Feb 2013
    17:04

    C#) 입문 - 프로젝트 생성하기

    CategoryVisual C++ Views18317
    Read More
  9. 13
    Feb 2011
    21:56

    EzClick.exe / ezbho.dll 프로세스 삭제방법

    Category프로세스 Views18612
    Read More
  10. 04
    Sep 2010
    09:38

    Excel에서 틀 고정 방법

    Category컴퓨터잡담 Views18628
    Read More
  11. 05
    Feb 2011
    08:19

    [autohotkey] FTP-업로드 예제분석

    CategoryAutoHotKey Views18645
    Read More
  12. 04
    Oct 2012
    17:00

    도스모드 ftp에서 하위폴더까지 모두 ftp로 전송하기

    Category컴퓨터잡담 Views18789
    Read More
  13. 25
    Jan 2011
    08:39

    c++의 상식, 프로그램의 시작

    CategoryVisual C++ Views18835
    Read More
  14. 19
    May 2013
    13:41

    악성 dll로 시작페이지가 변경되었을 때 조치방법

    Category컴퓨터잡담 Views18868
    Read More
  15. 07
    Jul 2009
    16:36

    제 2의 안철수? 티맥스 윈도우

    Category컴퓨터잡담 Views18879
    Read More
  16. 29
    Mar 2010
    15:04

    50 개 이상의 Ajax 예제들

    Category컴퓨터잡담 Views18950
    Read More
  17. 31
    Dec 2011
    08:32

    autohotkey) 핑테스트 프로그램

    CategoryAutoHotKey Views18952
    Read More
  18. 10
    Oct 2010
    23:51

    [javascript_tip]자바스크립트 값 넘기기

    Category컴퓨터잡담 Views18961
    Read More
  19. 16
    Feb 2011
    06:30

    [ahk] 다른 프로그램의 트레이 아이콘을 숨기기

    CategoryAutoHotKey Views19029
    Read More
  20. 21
    Feb 2011
    23:55

    COM 사용

    CategoryAutoHotKey Views19066
    Read More
Board Pagination Prev 1 ... 35 36 37 38 39 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소