Skip to content
조회 수 40671 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

 

   관련 게시물 :

 

   AUTOhotKEY 웹페이지 열지않고 소스 가져오기 또는 로그인 하기 

   AUTOhotKEY 오토핫키 콤보박스 제어하기

   AUTOhotKEY 웹페이지 감시결과에 따라 마이피플로 글 전송하기

   AUTOhotKEY 윈도우 ahk_id 추출하기

   Autohotkey 엑셀(Excel)에서 행값 증가시키기

   Autohotkey 30분마다 자동으로 디스크 정리하기

                                                                     

                                                   

 

화면보호기(ScreenSaver) On/Off 방법


SetTimer, CheckScrSaver, 1000 ; 매초마다 검사 
Return 

CheckScrSaver: 
DllCall("SystemParametersInfo" 
    , "UInt" , 0x72 ; SPI_GETSCREENSAVERRUNNING = 0x72 
    , "UInt" , 0 
    , "UIntP", Param 
    , "UInt" , 0) 
If (Param = 1) ; 스크린세이버 동작 확인 
    SendInput, {Shift} ; 쉬프트키를 눌러 스크린세이버 작동 중지 
Return



또는



하기의 스크립트를 상주시키고 settimer로 주기적으로 실행시켜보세요. 
TimerScreenSaver: 
mousemove 0,1,,r 
mousemove 0,-1,,r 
return 

출처 : fhly 님의 fLauncher


 

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

 

RegWrite REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, ScreenSaveActive, 0


 

 

You could just set a power profile, or set the existing "High performance" setting, to not show screensaver. So rather than changing a bunch of setting, all you do is change from a balanced power mode to a high performance one. You could change back afterwards, but I think that the balanced will be in place on restart.

Using Win + b to get to system tray, right arrow and enter and up (or down) would change the setting more quickly. You could set a Autohotkey script to automate this, perhaps with a "if [media] window active" rule.

 

 

 

https://gist.github.com/1965854

 

This is part of my AutoHotkey script that turns off my monitor when I press Win+\.

It also turns the screensaver on at the same time, so that Windows Live Messenger (and any other programs) know I am away.

I don't have a password on my screensaver, so there is a second version (Win+Shift+\) that locks the PC as well.

 

 

; Win+\
#\::
    SendMessage 0x112, 0xF140, 0, , Program Manager ; Start screensaver
    SendMessage 0x112, 0xF170, 2, , Program Manager ; Monitor off
    Return

; Win+Shift+\
#+\::
    Run rundll32.exe user32.dll`,LockWorkStation ; Lock PC
    Sleep 1000
    SendMessage 0x112, 0xF170, 2, , Program Manager ; Monitor off
    Return

 

 

See This, I already have a script for running the current screen saver, just run the following script and u can run the current screen saver with

Ctrl+`

Code (Copy):
^`:: ; screensaver

   RegRead, screensaver, HKCU,Control Panel\Desktop ,ScreenSaveActive
   if screensaver = 0
   {
      MsgBox, 0, ScreenSaver, ScreenSaver Not Active,3
   }
   else
   {
   RegRead, screensaver, HKCU,Control Panel\Desktop ,SCRNSAVE.EXE
   run,%screensaver% /s
   }
return

 

 

 

http://www.autohotkey.com/docs/commands/PostMessage.htm

 

; Turn Monitor Off:
SendMessage, 0x112, 0xF170, 2,, Program Manager  ; 0x112 is WM_SYSCOMMAND, 0xF170 is SC_MONITORPOWER.
; Note for the above: Use -1 in place of 2 to turn the monitor on.
; Use 1 in place of 2 to activate the monitor's low-power mode.
return

; Start the user's chosen screen saver:
SendMessage, 0x112, 0xF140, 0,, Program Manager  ; 0x112 is WM_SYSCOMMAND, and 0xF140 is SC_SCREENSAVE.

 

 

 

 

Send Messages to a Window or Its Controls
by Rajat


This page discusses the PostMessage and SendMessage commands and will answer some questions like:

"How do I press a button on a minimized window?"
"How do I select a menu item when WinMenuSelectItem doesn't work with it?!"
"This is a skinnable window.... how do I send a command that works every time?"
"and what about hidden windows?!"


Requirements: AutoHotkey v1.0.09+ and Winspector Spy (www.windows-spy.com)

As a first example, note that WinMenuSelectItem fails to work with the menu bar on Outlook Express's "New Message" window. In other words, this code will not work:

WinMenuSelectItem, New Message,, &Insert, &Picture...

 

But PostMessage can get the job done:

PostMessage, 0x111, 40239, 0, , New Message

Works like a charm! But what the heck is that? 0x111 is the hex code of wm_command message and 40239 is the code that this particular window understands as menu-item 'Insert Picture' selection. Now let me tell you how to find a value such as 40239:

  1. Open Winspector Spy and a "New Message" window.
  2. Drag the crosshair from Winspector Spy's window to "New Message" window's titlebar (the portion not covered by Winspector Spy's overlay).
  3. Right click the selected window in the list on left and select 'Messages'.
  4. Right click the blank window and select 'Edit message filter'.
  5. Press the 'filter all' button and then dbl click 'wm_command' on the list on left. This way you will only monitor this message.
  6. Now go to the "New Message" window and select from its menu bar: Insert > Picture.
  7. Come back to Winspector Spy and press the traffic light button to pause monitoring.
  8. Expand the wm_command messages that've accumulated (forget others if any).
  9. What you want to look for (usually) is a code 0 message. sometimes there are wm_command messages saying 'win activated' or 'win destroyed' and other stuff.. not needed. You'll find that there's a message saying 'Control ID: 40239' ...that's it!
  10. Now put that in the above command and you've got it! It's the wParam value.

For the next example I'm taking Paint because possibly everyone will have that. Now let's say it's an app where you have to select a tool from a toolbar using AutoHotkey; say the dropper tool is to be selected.

What will you do? Most probably a mouse click at the toolbar button, right? But toolbars can be moved and hidden! This one can be moved/hidden too. So if the target user has done any of this then your script will fail at that point. But the following command will still work:

PostMessage, 0x111, 639,,,untitled - Paint

Another advantage to PostMessage is that the Window can be in the background; by contrast, sending mouse clicks would require it to be active.


Here are some more examples. Note: I'm using WinXP Pro (SP1) ... if you use a different OS then your params may change (only applicable to apps like Wordpad and Notepad that come with windows; for others the params shouldn't vary):

;makes writing color teal in Wordpad
PostMessage, 0x111, 32788, 0, , Document - WordPad

;opens about box in Notepad
PostMessage, 0x111, 65, 0, , Untitled - Notepad

;toggles word-wrap in Notepad
PostMessage, 0x111, 32, 0, , Untitled - Notepad

;play/pause in Windows Media Player
PostMessage, 0x111, 32808, 0, , Windows Media Player

;suspend the hotkeys of a running AHK script!
DetectHiddenWindows, on
SetTitleMatchMode, 2
PostMessage, 0x111, 65305,,, MyScript.ahk - AutoHotkey ; Use 65306 to Pause vs. Suspend.


This above was for PostMessage. SendMessage works the same way but additionally waits for a return value, which can be used for things such as getting the currently playing track in Winamp (see Automating Winamp for an example).

Here are some more notes:

  • The note above regarding OS being XP and msg values changing with different OSes is purely cautionary. if you've found a msg that works on your system (with a certain version of a software) then you can be sure it'll work on another system too with the same version of the software. In addition, most apps keep these msg values the same even on different versions of themselves (e.g. Windows Media Player and Winamp).
  • If you've set the filter to show only wm_command in Winspector Spy and still you're getting a flood of messages then right click that message and select hide (msg name)... you don't want to have a look at a msg that appears without you interacting with the target software.
  • The right pointing arrow in Winspector Spy shows the msg values and the blurred left pointing arrows show the returned value. A 0 (zero) value can by default safely be taken as 'no error' (use it with SendMessage, the return value will be in %ErrorLevel%).
  • For posting to partial title match add this to script:
    SetTitleMatchMode, 2
  • For posting to hidden windows add this to script:
    DetectHiddenWindows, On

Note: There are apps with which this technique doesn't work. I've had mixed luck with VB and Delphi apps. This technique is best used with C, C++ apps. With VB apps the 'LParam' of the same command keeps changing from one run to another. With Delphi apps... the GUI of some apps doesn't even use wm_command. It probably uses mouse pos & clicks.

Go and explore.... and share your experiences in the AutoHotkey Forum. Feedback is welcome!

This tutorial is not meant for total newbies (no offense meant) since these commands are considered advanced features. So if after reading the above you've not made heads or tails of it, please forget it.

-Rajat

 

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

?

  1. 08
    Aug 2011
    12:57

    [AHK_B&AHK_L] 익스플로러 HTML 문서정보 알아내기(IE HTML Element Spy)

    CategoryAutoHotKey Views15160
    Read More
  2. 02
    Aug 2011
    17:03

    [AHK_B&AHK_L] 엑셀 제어 비교.

    CategoryAutoHotKey Views20252
    Read More
  3. 02
    Aug 2011
    16:39

    [AHK_L] 현재 열려진 인터넷 창 값 가져오기

    CategoryAutoHotKey Views16574
    Read More
  4. 30
    Mar 2011
    17:18

    정보수집

    CategoryAutoHotKey Views16064
    Read More
  5. 25
    Feb 2011
    08:54

    [ahk]웹페이지가 띄워진 창 내용을 추출하여 로딩이 완료되었는지를 확인할 수 있는 소스

    CategoryAutoHotKey Views14747
    Read More
  6. 24
    Feb 2011
    18:33

    ahk로 만든 파일을 exe로 컴파일 한 후 실행시킬때 변수를 임의

    CategoryAutoHotKey Views15310
    Read More
  7. 22
    Feb 2011
    13:00

    클릭해서 새창열리는 페이지에 클릭 또는 값설정 가능한가요?

    CategoryAutoHotKey Views14723
    Read More
  8. 22
    Feb 2011
    01:31

    ahk_l 웹페이지 파일로 저장한 뒤 불러와 필요한 부분 추출하여 출력하기

    CategoryAutoHotKey Views16987
    Read More
  9. 22
    Feb 2011
    01:22

    ahk_l 웹페이지 앞, 뒤페이지 제어 예제소스 및 설명첨부

    CategoryAutoHotKey Views17535
    Read More
  10. 22
    Feb 2011
    01:15

    ahk_l 과 com 의 이해

    CategoryAutoHotKey Views17485
    Read More
  11. 21
    Feb 2011
    23:58

    autohotkey_L Object

    CategoryAutoHotKey Views15387
    Read More
  12. 21
    Feb 2011
    23:55

    COM 사용

    CategoryAutoHotKey Views19063
    Read More
  13. 17
    Feb 2011
    19:17

    웹페이지의 내용을 변수에 넣기

    CategoryAutoHotKey Views14492
    Read More
  14. 17
    Feb 2011
    07:17

    WinMenuSelectItem로 메뉴선택하기

    CategoryAutoHotKey Views16252
    Read More
  15. 16
    Feb 2011
    07:05

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

    CategoryAutoHotKey Views18182
    Read More
  16. 16
    Feb 2011
    06:30

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

    CategoryAutoHotKey Views19005
    Read More
  17. 14
    Feb 2011
    23:19

    Each enumerated result will be assigned to the ByRef parameter Result. And, introduced a Global variable _hResult_ which will store the hResult of the Invoke.

    CategoryAutoHotKey Views5402
    Read More
  18. 14
    Feb 2011
    22:36

    #ifwinactive & #ifwinexist 윈도우창 마다 핫키의 용도를 다르게 사용하는 방법

    CategoryAutoHotKey Views16518
    Read More
  19. 14
    Feb 2011
    17:29

    AutoHotkey_L: Arrays, Debugger, x64, COM, #If expression

    CategoryAutoHotKey Views21591
    Read More
  20. 14
    Feb 2011
    16:44

    [ahk] 레지스터리 등록여부 확인 후 없으면 추가시키기

    CategoryAutoHotKey Views14972
    Read More
Board Pagination Prev 1 2 3 4 5 Next
/ 5

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소