Screen clipping

Post your working scripts, libraries and tools
AviationGuy
Posts: 188
Joined: 17 Jan 2019, 10:13

Re: Screen clipping

07 Mar 2019, 04:07

@FG
I assume if "Screen Clipping w options 5.ahk" works fine alone then it has #Lbutton define in it. When you #inclue and then state again, you are ending up with a duplicate hotkey definition.
'Screen Clipping' has indeed the #LButton defined in it. But when I removed it from the 'Screen clipping' file and just keep it in my own file, it still gives the same error.

@Cerberus
Or perhaps the files Tesseract.ahk and Screen Clipping w options 5.ahk both contain a function with the exact same name. The error speaks of a function definition. So those two files are incompatible with each other.
The 'Tesseract' file doesn't use the function that is used in the 'Screen Clipping' file. The 'Screen Clipping' file does however also includes the 'Tesseract' file so I removed that line there too but still... same error message.

@Joe Glines
What an honor that you react to my question :) I've watched a lot of your vids since I started with AHK at the beginning of this year. Please keep on making them since I learned a lot from them.
Now on to the question:
The file you are using has like 1000 more lines. This isn't a problem really but the reason I used the other one is that I want as few lines as possible. After I included the file I want to remove all the functions the #Lbutton::SCW_ScreenClip2Win(clip:=0,email:=0) hotkey isn't using and when I'm using your file that would be a lot more work and will get way too complicated for me I think. Next to this, and more importantly, with the script you are using I am only able to close the screen clip by pressing esc while in the one I'm using I can close the screen clip by clicking on the top right.
I tried changing this in your script but unfortunately, I do not have the knowledge to do this.
But for now, I will use the script that is on your website, thanks for that!

Thanks for your replies!

***EDIT***
OK, that won't work either. 'TheAutomatorScript' is the script from the website Joe Glines mentioned.

Code: Select all

#Include S:\...\TheAutomatorScript.ahk
#Lbutton::SCW_ScreenClip2Win(clip:=1,email:=0,IMUGR:=0)
It's the same problem. Works when using just the 'TheAutomatorScript' but not when I'm using the hotkey in another file and include the 'TheAutomatorScript'. I found out that the specific function that gives an error is defined in the 'TheAutomatorScritp' file and in the 'Gdip' file but why does this only gives an error when using the hotkey in another script?
User avatar
Joe Glines
Posts: 689
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

09 Mar 2019, 10:03

@AviationGuy I'm glad you're liking the script & videos! :) As for the length of the script, why do you care? The performance difference you'll see is negligible.

I don't understand what you're trying to do. My script is built to be running and have the hotkey trigger the screen capture. I leave it running all the time (granted in mine I change it so the icon isn't visible so my system tray doesn't get crammed up)
r2997790
Posts: 58
Joined: 02 Feb 2017, 02:46

Re: Screen clipping

12 Apr 2019, 08:21

I think this is may all time favorite AHK script. Gold Joe!

I wondered if anyone has written a function to enable to handling of a second (extended) screen. I thought there was one, but I cant find it now.

I'm using two monitors now and it doesnt work properly on my second larger screen,

Thanks everyone
R
User avatar
Joe Glines
Posts: 689
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

13 Apr 2019, 16:07

r2997790 wrote:
12 Apr 2019, 08:21
I'm using two monitors now and it doesnt work properly on my second larger screen,
I believe the current version takes care of the issue. Try the version found here: http://the-automator.com/screen-clipping-with-ocr/
shujedi
Posts: 1
Joined: 07 Aug 2019, 17:10

Re: Screen clipping

07 Aug 2019, 17:13

I've been using the old version for 3 or 4 years now and literally can't live without it.
I just got a new computer and I'm trying to get it working on the new machine. Is there a guide or some instructions somewhere on how to get this going?
I can't remember how I got it loaded and working originally?
I've downloaded the latest zip file (w/ the tesseract abilities). I'm spinning my wheels on how to get it working.
THANK YOU SO MUCH!!
User avatar
Joe Glines
Posts: 689
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

20 Aug 2019, 17:08

@shujedi
what's it doing? Did you watch the video talking through it?
RapsStepFather
Posts: 1
Joined: 08 Sep 2019, 22:24

Re: Screen clipping

08 Sep 2019, 22:28

Joe Glines wrote:
20 Aug 2019, 17:08
@shujedi
what's it doing? Did you watch the video talking through it?
Hi there Joe!
First of all, thank you so so much for your amazing work, I've been using this for years and can't imagine not having it.
Recently my laptop got wiped and now I'm trying to get the latest version of this script again but your website seems to be down.
Can you please help me get this script?
Thanks!
User avatar
Joe Glines
Posts: 689
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

09 Sep 2019, 06:19

I was messing with my permission settings. The site should be accessible now.
Simoner26
Posts: 1
Joined: 03 Nov 2019, 19:21

Re: Screen clipping

03 Nov 2019, 19:30

Hi Joe, thanks for this amazing tool. I´m having this issue while trying to use the Ctrl+T option to activate OCR and I´m receiving this message "The procedure entry point_controlfp_s could no be located in the dynamic link library", also it throws the exception "Tesseract failed." in line 68 of the Tesseract.ahk file. I have no idea why it could, have you receive an exception of this type? Thanks in advance
User avatar
hasantr
Posts: 497
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Screen clipping

09 Jan 2020, 04:48

Joe Glines wrote:
09 Sep 2019, 06:19
Overall it's a great tool. I like a lot. Thanks

But.
Ctrl + T it's not responding at all.
User avatar
Joe Glines
Posts: 689
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

09 Jan 2020, 09:19

Do you select the clipped image first? you have to left click the clipped image, then hit control+T. Obviously this only works for the version that has the OCR in it (there are other versions that don't have it)
User avatar
hasantr
Posts: 497
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Screen clipping

11 Jan 2020, 06:38

Joe Glines wrote:
09 Jan 2020, 09:19
Do you select the clipped image first? you have to left click the clipped image, then hit control+T. Obviously this only works for the version that has the OCR in it (there are other versions that don't have it)
ocr.space can you update it with?
User avatar
Joe Glines
Posts: 689
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

13 Jan 2020, 10:28

hasantr wrote:
11 Jan 2020, 06:38
ocr.space can you update it with?
I don't understand your question
User avatar
Joe Glines
Posts: 689
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

24 Mar 2020, 08:59

I saw this post from malcev and decided to ditch Tesseract and take advantage of built-in OCR in Windows 10.

Go here to watch the video and get the script here
User avatar
Zseni
Posts: 44
Joined: 03 Nov 2019, 19:44
Contact:

Re: Screen clipping

24 Mar 2020, 23:45

I found this single line interesting

Code: Select all

Menu, tray, icon, %A_WinDir%\system32\mmcndmgr.dll,106
A camera icon and u only gave the code, so this must already exist on my computer and everyone else as well.
I was wondering if they're more of these, not just a camera icon and if there a library showing all the icons that exist on everyone's computers and their file path.
rommmcek
Posts: 975
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

29 Mar 2020, 07:39

@Zseni:

Code: Select all

CoordMode, ToolTip, Screen
Icons := []
ToolTip, % " Please wait while loading Icons! ", % A_ScreenWidth/2-200, % A_ScreenHeight/2-200
Loop, Files, %A_WinDir%\system32\*.*
    while hwnd:=LoadPicture(A_LoopFileFullPath, "Icon" A_Index-1)
        Icons.Push([A_LoopFileName, hwnd, A_Index-1])
ToolTip
gui, Add, Text, w256 vTxt, % Icons.1.1 ", Icon" Icons.1.3
Gui, Add, Pic, w128 h-1 vIcn +Border, % "HBITMAP:*" Icons.1.2
Gui, Show
Loop % Icons.Length()
{
    GuiControl, , Txt, % Icons[A_Index+1].1 ", Icon" Icons[A_Index+1].3
    GuiControl, , Icn, % "HBITMAP:*" Icons[A_Index+1].2
    ;sleep, 500
}
Gui, Destroy
ToolTip, % " You saw all icons in the`n`n    specified folder!", % A_ScreenWidth/2-200, % A_ScreenHeight/2-200
Sleep, 3000
ToolTip
ExitApp

GuiClose:
GuiEscape:
ExitApp
Pause::Pause
Last edited by rommmcek on 30 Mar 2020, 05:56, edited 1 time in total.
User avatar
boiler
Posts: 5292
Joined: 21 Dec 2014, 02:44

Re: Screen clipping

29 Mar 2020, 08:00

@Zseni - This script lets you browse a couple of the files that contain a lot of icons and see their associated icon numbers. It could be modified to show the icons in other files as well.

Code: Select all

Count := 329
Shell := 1
Image := 0
File := "shell32.dll"
gosub, CreateGui
return

CreateGui:
	Gui, Destroy
	Gui, -MinimizeBox -MaximizeBox
	Gui, Add, Radio, vShell32 gRadioClick Checked%Shell%, shell32.dll
	Gui, Add, Radio, vImageRes gRadioClick Checked%Image%, imageres.dll

	Gui, Add, ListView, h200 w180, Icon & Number
	ImageListID := IL_Create(Count)
	LV_SetImageList(ImageListID)
	loop, % Count
		IL_Add(ImageListID, File, A_Index) 
	loop, % Count
		LV_Add("Icon" . A_Index, A_Index)
	LV_ModifyCol("Hdr")  ; Auto-adjust the column widths.
	Gui Show
return

RadioClick:
	Gui, Submit
	Count := (Shell32 ? 329 : 412)
	File := (Shell32 ? "shell32.dll" : "imageres.dll")
	gosub, CreateGui
return

GuiClose:
ExitApp
User avatar
Cerberus
Posts: 168
Joined: 12 Jan 2016, 15:46

Re: Screen clipping

29 Mar 2020, 11:33

@boiler Slightly modified version, which makes the window as tall as possible, properly shows which file's icons are currently shown, and allows you to double-click to put a reference to the chosen icon on the clipboard:

Code: Select all

Count := 329
Shell := 1
Image := 0
File := "shell32.dll"
gosub, CreateGui
return

CreateGui:
	Gui, Destroy
	Gui, -MinimizeBox -MaximizeBox
	Gui, Add, Radio, vShell32 gRadioClick Checked%Shell% Check, shell32.dll
	Gui, Add, Radio, vImageRes gRadioClick Checked%Image% , imageres.dll
	Height := A_ScreenHeight - 170
	Gui, Add, ListView, h%Height% w180 gListClick, Icon & Number
	ImageListID := IL_Create(Count)
	LV_SetImageList(ImageListID)
	loop, % Count
		IL_Add(ImageListID, File, A_Index) 
	loop, % Count
		LV_Add("Icon" . A_Index, A_Index)
	LV_ModifyCol("Hdr")  ; Auto-adjust the column widths.
	Gui Show
return

RadioClick:
	Gui, Submit
	Count := (Shell32 ? 329 : 412)
	File := (Shell32 ? "shell32.dll" : "imageres.dll")
	Shell := Shell32 ? 1 : 0
	Image := Shell32 ? 0 : 1
	gosub, CreateGui
return

ListClick:
	If (A_GuiEvent = "DoubleClick")
	{
		Clipboard := "%A_WinDir%\system32\" File "," A_EventInfo
	}
Return

GuiClose:
ExitApp
User avatar
Gorgrak
Posts: 19
Joined: 07 Dec 2015, 16:34

Re: Screen clipping

06 May 2020, 03:14

FYI, Joe's script with the Win10 OCR feature was updated (on April 7, 2020). It no longer needs to save an image before magiking out the OCR to your clipboard.
Newest script here with a video explaining how Jackie modified it for Joe.

I have amalgamated Tervon's and Jackie's contributions a bit to come up with a method for OCR-ing a clipping you already have sitting there! Here are my changes to the Hotkey section as well as the frankenstein-ed function. (Especially note the Control+X Hotkey)

Code: Select all

;;;;;;;;;;;;;;;
;;; HOTKEYS ;;;
;;;;;;;;;;;;;;;
#Lbutton::SCW_ScreenClip2Win(clip:=0,email:=0,OCR:=0)		;		Win+Left-click	==	make a basic clipping (no clipboard/saving/OCR)
#!Lbutton::SCW_ScreenClip2Win(clip:=0,email:=1,OCR:=0)		;	Win+Alt+Left-click	==	save a clipping and email it (filepath copied to clipboard)
#^Lbutton::SCW_ScreenClip2Win(clip:=1,email:=0,OCR:=0)		; Win+Control+Left-click	==	make and copy a clipping to clipboard
#+Lbutton::SCW_ScreenClip2Win(clip:=0,email:=0,OCR:=1)		;	Win+Shift+Left-click	==	make a clipping and store the OCR in clipboard

#IfWinActive, ScreenClippingWindow ahk_class AutoHotkeyGUI
^c::SCW_Win2Clipboard(0) ; copy selected win to clipboard [change to (1) to include border]
^s::SCW_Win2File(0) ; save selected clipping on desktop as timestamp named .png ; this was submited by tervon
^x::SCW_Win2OCR() ; store the OCR of the clipping in clipboard
Rbutton::WinClose, A ; contributed by tervon
#IfWinActive

; (put this function at the end of your script, maybe?)
SCW_Win2OCR() {
	Send, !{PrintScreen} ; Active Win's client area to Clipboard
	Sleep, 50
	pToken := Gdip_Startup()
	pBitmap := Gdip_CreateBitmapFromClipboard()
	hBitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap) ; Convert an hBitmap from the pBitmap
	pIRandomAccessStream := HBitmapToRandomAccessStream(hBitmap) ; OCR function needs a randome access stream (so it isn't "locked down")
	DllCall("DeleteObject", "Ptr", hBitmap)	
	Clipboard := ocr(pIRandomAccessStream, "en")
	ObjRelease(pIRandomAccessStream)
	; Notify().AddWindow(Clipboard,{Icon:300,Background:"0x0000FF",Title:"OCR Performed, now on clipboard",TitleSize:16,size:15,Time:4000})
	ToolTip, % "Now on Clipboard`n`n" clipboard
	Sleep, 2000
	ToolTip
	Gdip_DisposeImage(pBitmap)
	Gdip_Shutdown("pToken") ; clear selection
}
Last edited by gregster on 06 May 2020, 11:35, edited 1 time in total.
Reason: External link fixed.
User avatar
BGM
Posts: 488
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: Screen clipping

25 May 2020, 21:36

I tried this. I used the win+Lbutton to make a clipping, then tried ctrl+x.
It gives me an error box saying the file 24630312 does not exist. Strange.

I figured out it happens on this line:
Clipboard := ocr(pIRandomAccessStream, "en")

Now, Using the win+Lbutton, we have created no files - only pasted the bmp to the screen. Looking at the ocr function, the first parameter is a file.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Rafaews, ras and 17 guests