Advertisement
tabnation

ocr

Mar 2nd, 2021
1,488
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None
  1. ;hotkey to activate OCR
  2. f1::
  3. getSelectionCoords(x_start, x_end, y_start, y_end)
  4. RunWait, C:\Users\Thom\Desktop\Capture2Text_v3.9\Capture2Text\Capture2Text.exe %x_start% %y_start% %x_end% %y_end%
  5. MsgBox, %clipboard%
  6. return
  7.  
  8. ; creates a click-and-drag selection box to specify an area
  9. getSelectionCoords(ByRef x_start, ByRef x_end, ByRef y_start, ByRef y_end) {
  10. ;Mask Screen
  11. Gui, Color, FFFFFF
  12. Gui +LastFound
  13. WinSet, Transparent, 50
  14. Gui, -Caption
  15. Gui, +AlwaysOnTop
  16. Gui, Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%,"AutoHotkeySnapshotApp"
  17.  
  18. ;Drag Mouse
  19. CoordMode, Mouse, Screen
  20. CoordMode, Tooltip, Screen
  21. WinGet, hw_frame_m,ID,"AutoHotkeySnapshotApp"
  22. hdc_frame_m := DllCall( "GetDC", "uint", hw_frame_m)
  23. KeyWait, LButton, D
  24. MouseGetPos, scan_x_start, scan_y_start
  25. Loop
  26. {
  27. Sleep, 10
  28. KeyIsDown := GetKeyState("LButton")
  29. if (KeyIsDown = 1)
  30. {
  31. MouseGetPos, scan_x, scan_y
  32. DllCall( "gdi32.dll\Rectangle", "uint", hdc_frame_m, "int", 0,"int",0,"int", A_ScreenWidth,"int",A_ScreenWidth)
  33. DllCall( "gdi32.dll\Rectangle", "uint", hdc_frame_m, "int", scan_x_start,"int",scan_y_start,"int", scan_x,"int",scan_y)
  34. } else {
  35. break
  36. }
  37. }
  38.  
  39. ;KeyWait, LButton, U
  40. MouseGetPos, scan_x_end, scan_y_end
  41. Gui Destroy
  42.  
  43. if (scan_x_start < scan_x_end)
  44. {
  45. x_start := scan_x_start
  46. x_end := scan_x_end
  47. } else {
  48. x_start := scan_x_end
  49. x_end := scan_x_start
  50. }
  51.  
  52. if (scan_y_start < scan_y_end)
  53. {
  54. y_start := scan_y_start
  55. y_end := scan_y_end
  56. } else {
  57. y_start := scan_y_end
  58. y_end := scan_y_start
  59. }
  60. }
Advertisement
RAW Paste Data Copied
Advertisement