본문 바로가기

잡동사니

오토핫키-controlsettext 콘트롤러에 있는 텍스트 수정.

728x90

오토핫키는 간편하게 스크립트를 만들기 쉬워서, 갑자기 반복적인 일을 할 때,

대충 만들어서 쓰기 편하다.. 다른 프로그래밍 언어를 배워보려고 시도는 많이 했지만,

난해하고, 처음 접하기에는 어렵다.. ㅠㅠ

오토핫키는 다른 언어보다 쉽고 빠르게 배울수있어서, 편하다..

하지만 프로그래밍에 한계가 있으며, 복잡하고 완성도가 높은 프로그램을 만들때,

프로그램의 속도가 느리다는 단점이 있다.. 그래도 배울만한 가치는 있는듯하다.

 

- / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / – / - / - / - / -

글자를 복사하면, 메모장에 바로 붙여넣기 하는

스트립트를 만들려고한다.

 

image

오토핫키 프로그램을 설치하면, 기본제공되는 윈도우스파이를 이용해서, 메모장의 컨트롤창을 찾는다.

 

image

메모장위에 마우스커서를 가져가 놓으면, 프로그램 이름과, 마우스가 위치해있는, 컨트롤이름이 보여진다.

- / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / – / - / - / - / -

1::                         ;1번을 누르면 스크립트 시작.

send, ^{c}                         ;컨트롤 c를 눌러서 선택한 텍스트 복사.

controlsettext, Edit1, %clipboard%, 제목 없음 – 메모장                        ;메모장에 붙여넣기.

return

image

image

 

- / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / - / – / - / - / - / -

출처

https://www.autohotkey.com/docs/commands/ControlSetText.htm

ControlSetText

Changes the text of a control.
ControlSetText [, Control, NewText, WinTitle, WinText, ExcludeTitle, ExcludeText]

Select

Parameters
Control
Can be either ClassNN (the classname and instance number of the control) or the control's text, both of which can be determined via Window Spy. When using text, the matching behavior is determined by SetTitleMatchMode. If this parameter is blank, the target window's topmost control will be used.

To operate upon a control's HWND (window handle), leave the Control parameter blank and specify ahk_id %ControlHwnd% for the WinTitle parameter (this also works on hidden controls even when DetectHiddenWindows is Off). The HWND of a control is typically retrieved via ControlGet Hwnd, MouseGetPos, or DllCall.
NewText
The new text to set into the control. If blank or omitted, the control is made blank.
WinTitle
A window title or other criteria identifying the target window. See WinTitle.
WinText
If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText is ON.
ExcludeTitle
Windows whose titles include this value will not be considered.
ExcludeText
Windows whose text include this value will not be considered.

ErrorLevel

[v1.1.04+] This command is able to throw an exception on failure. For more information, see Runtime Errors.

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

Remarks

Most control types use carriage return and linefeed (`r`n) rather than a solitary linefeed (`n) to mark the end of each line. To translate a block of text containing `n characters, follow this example:
StringReplace, MyVar, MyVar, `n, `r`n, All

Select | Download

To improve reliability, a delay is done automatically after every use of this command. That delay can be changed via SetControlDelay.

Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.

Related

SetControlDelay, ControlGetFocus, ControlGetText, ControlGet, Control, ControlMove, ControlGetPos, ControlClick, ControlFocus, ControlSend

Example
ControlSetText, Edit1, New Text Here, Untitled -

Select | Download

728x90