Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;hotkey to activate OCR
- f1::
- getSelectionCoords(x_start, x_end, y_start, y_end)
- RunWait, C:\Users\Thom\Desktop\Capture2Text_v3.9\Capture2Text\Capture2Text.exe %x_start% %y_start% %x_end% %y_end%
- MsgBox, %clipboard%
- return
- ; creates a click-and-drag selection box to specify an area
- getSelectionCoords(ByRef x_start, ByRef x_end, ByRef y_start, ByRef y_end) {
- ;Mask Screen
- Gui, Color, FFFFFF
- Gui +LastFound
- WinSet, Transparent, 50
- Gui, -Caption
- Gui, +AlwaysOnTop
- Gui, Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%,"AutoHotkeySnapshotApp"
- ;Drag Mouse
- CoordMode, Mouse, Screen
- CoordMode, Tooltip, Screen
- WinGet, hw_frame_m,ID,"AutoHotkeySnapshotApp"
- hdc_frame_m := DllCall( "GetDC", "uint", hw_frame_m)
- KeyWait, LButton, D
- MouseGetPos, scan_x_start, scan_y_start
- Loop
- {
- Sleep, 10
- KeyIsDown := GetKeyState("LButton")
- if (KeyIsDown = 1)
- {
- MouseGetPos, scan_x, scan_y
- DllCall( "gdi32.dll\Rectangle", "uint", hdc_frame_m, "int", 0,"int",0,"int", A_ScreenWidth,"int",A_ScreenWidth)
- DllCall( "gdi32.dll\Rectangle", "uint", hdc_frame_m, "int", scan_x_start,"int",scan_y_start,"int", scan_x,"int",scan_y)
- } else {
- break
- }
- }
- ;KeyWait, LButton, U
- MouseGetPos, scan_x_end, scan_y_end
- Gui Destroy
- if (scan_x_start < scan_x_end)
- {
- x_start := scan_x_start
- x_end := scan_x_end
- } else {
- x_start := scan_x_end
- x_end := scan_x_start
- }
- if (scan_y_start < scan_y_end)
- {
- y_start := scan_y_start
- y_end := scan_y_end
- } else {
- y_start := scan_y_end
- y_end := scan_y_start
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement