반응형
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- IfInString
- 배열
- EnvDiv
- ControlSend
- SetEnv
- 식
- if
- Blocks
- IfWinExist
- autohotkey
- EnvSub
- EnvMult
- 식의 설명
- SetMouseDelay
- SetKeyDelay
- Menu
- if(식)
- StringGetPos
- SetTitleMatchMode
- Threads
- DetectHiddenWindows
- MouseClick
- EnvSet
- Var:=식
- ControlGetText
- SetControlDelay
- API
- EnvAdd
- 함수
- IF (식)
Archives
- Today
- Total
ㄴrㅎnㅂrㄹrㄱi
글자를 포함한 스크린 샷을 찍습니다. 본문
반응형
TextToImage 1.07 - Write text onto an image or screenshot
-
#SingleInstance, Force
-
SetWorkingDir %A_ScriptDir%
-
#Include, TextToImage-1.07.ahk
-
-
-
Create:
-
;MsgBox, %E%
-
-
; TextToImage v1.07 by tic
-
;
-
; TextToImage can overlay writing to a screenshot of the entire screen or active window, or from an existing image and write to file
-
; TextToImage(In, Text, Output, x, y, Font, TColour, Size, Weight)
-
;
-
; In: Can either be the "Screen" or "Window" and will take a screenshot of the respective choice, or the location of an exisitng image
-
;
-
; Text: This is the text to overlay onto the screenshot
-
;
-
; Output: This is the path and filename that the image will be written to.
-
; The extension can be .bmp,.jpg,.png,.tif,.gif and will be written as that type accordingly
-
;
-
; x: This is the x-coordinate to place the text. This coordinate will be the distance from the left the text will be placed.
-
; This value may be a ratio. For instance 4:5 would place the text at the position 4/5ths of the width of the image
-
; You must also consult which mode align is in
-
;
-
; y: This is the y-coordinate to place the text. This coordinate will be the distance from the top the text will be placed.
-
; This value may be a ratio. For instance 1:3 would place the text at the position 1/3ths of the height of the image
-
; You must also consult which mode align is in
-
;
-
; Size: This is the height of the text in pixels
-
;
-
; Align: This must have 2 styles set, The text's x placement (Left,Centre,Right) and the text's y placement (Top,Bottom)
-
; It must be used for example as Left|Bottom - This would place the text at the bottom of it's bounding area and aligned left
-
;
-
; Weight: This is the boldness of the text. Make the value greater to make it more bold
-
;
-
; Font: This is the font to set the text to be
-
; Examples are: Arial, Bookman Old Style, Times New Roman
-
;
-
; TColour: This is the colour to set the text in RGB format.
-
; So FF0000 is red
-
;
-
; Style: Can contain the words Underline,Italic,Strikeout and will set the text in the appropriate styles
-
-
{
-
-
{
-
{
-
WinGetPos, nL, nT, nW, nH, A ; Get coordinates for active window
-
WinGetTitle, Title, A
-
{
-
GoSub, TTS_GdiplusShutdown
-
Return, "Window is not visible"
-
}
-
}
-
NumPut(nW, bi, 4)
-
NumPut(nH, bi, 8)
-
NumPut(32, NumPut(1, bi, 12, "UShort"), 0, "Ushort")
-
hBM := DllCall("gdi32CreateDIBSection", "UInt", mDC, "UInt", &bi, "UInt", 0, "UIntP", "", "UInt", 0, "UInt", 0)
-
hDC := DllCall("GetDC", "UInt", 0) ; Get DC of screen and bitblt either whole screen or active window
-
DllCall("BitBlt", "UInt", mDC, "Int", 0, "Int", 0, "Int", nW, "Int", nH, "UInt", hDC, "Int", nL, "Int", nT, "UInt", 0x40000000|0x00CC0020)
-
}
-
{
-
DllCall("kernel32MultiByteToWideChar", "UInt", 0, "UInt", 0, "UInt", &In, "Int", -1, "UInt", &wFile, "Int", VarSetCapacity(wFile)//2)
-
-
If !pBitmap
-
{
-
Gosub, TTS_GdiplusShutdown
-
Return, "Failed to load image"
-
}
-
-
}
-
-
StringSplit, OutputArray, Output, .
-
Extension := "." . OutputArray%OutputArray0%
-
{
-
GoSub, TTS_GdiplusShutdown
-
Return, "Invalid file extension. Only bmp,jpg,png,tif,gif are available"
-
}
-
-
{
-
GoSub, TTS_GdiplusShutdown
-
}
-
Width := NumGet(bm, 4, "Int") ; Get properties of bitmap
-
Height := NumGet(bm, 8, "Int")
-
bpp := NumGet(bm, 18, "Ushort")
-
-
DllCall("SetGraphicsMode", "UInt", mDC, "UInt", 2) ; Set graphics mode for DC to allow world transformations
-
-
-
LogPixelsSY := DllCall("GetDeviceCaps", "UInt", hDC, "Int", 90) ; Number of pixels per logical inch along the screen height
-
TextHeight := -(Size*logPixelsSY)/72
-
-
NumPut(TextHeight, logfont, 0) ; Set text height
-
;NumPut(TextWidth, logfont, 4) ; Change text width
-
-
NumPut(Weight, logfont, 16) ; Set text weight
-
NumPut(1, logfont, 21)
-
NumPut(1, logfont, 20)
-
NumPut(1, logfont, 22)
-
-
NumPut(5, logfont, 26) ; ClearType antialiasing XP and above only
-
-
AlignWord := "Right,Top,Bottom,Centre,Left"
-
AlignNum := "2,0,8,6,0"
-
-
StringSplit, AlignWords, AlignWord, `,
-
StringSplit, AlignNums, AlignNum, `,
-
-
Loop, %AlignWords0%
-
StringReplace, Align, Align, % AlignWords%A_Index%, % AlignNums%A_Index%, All
-
StringSplit, Pos, Align, |
-
Align := Pos1 | Pos2
-
-
TColour := "0x" . TColour
-
prevColor := DllCall("SetTextColor", "UInt", mDC, "UInt", ((TColour & 0xFF) << 16) + (TColour & 0xFF00) + ((TColour >> 16) & 0xFF), "UInt")
-
-
{
-
StringSplit, XRatio, x, :
-
XPos := XRatio1*(Width//XRatio2)
-
}
-
XPos := x
-
-
{
-
StringSplit, YRatio, y, :
-
YPos := YRatio1*(Height//YRatio2)
-
}
-
YPos := y
-
-
-
Loop, %Text0%
-
{
-
YPos += 1.5*Size ; Draw text Into device
-
}
-
-
-
-
Loop, %nCount%
-
{
-
-
}
-
If pImage ; Save image to file
-
{
-
sString := Output
-
nSize := DllCall("MultiByteToWideChar", "UInt", 0, "UInt", 0, "UInt", &sString, "Int", -1, "UInt", 0, "Int", 0)
-
DllCall("MultiByteToWideChar", "UInt", 0, "UInt", 0, "UInt", &sString, "Int", -1, "UInt", &wString, "Int", nSize)
-
-
}
-
GoSub, TTS_GdiplusShutdown
-
Return, XPos . "|" . YPos
-
-
TTS_GdiplusShutdown:
-
}
반응형
'AUTOHOTKEY > 스크립트' 카테고리의 다른 글
Captcha (GUI) - 입력코드 확인 (0) | 2007.12.22 |
---|---|
HTML 태그 적용 시키기. (0) | 2007.12.22 |
AHK Chat (Another Method) (0) | 2007.11.25 |
XML 관련 함수 (0) | 2007.11.13 |
ado com (0) | 2007.11.10 |
Comments