ImagePut - A core library for images in AutoHotkey (Now supports HEIC & WEBP)

Post your working scripts, libraries and tools.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: ImagePut - A core library for images in AutoHotkey (Now supports HEIC & WEBP)

Post by robodesign » 28 Feb 2024, 18:04

@iseahound .impressive work!
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.

gdqb521
Posts: 13
Joined: 15 Aug 2015, 08:01

Re: ImagePut - A core library for images in AutoHotkey (Now supports HEIC & WEBP)

Post by gdqb521 » 12 Mar 2024, 06:21

Hey!

I want to take a screenshot and run an imagesearch on it from a Application thats not currently in the foreground/ covered by other applications.
how to do used imageput ()?

Code: Select all

; 窗口类
ImagePutWindow("ahk_class notepad")

Code: Select all

Error: Image type could not be identified.

	---- d:\LibV2\ImagePut.ah2
	565: If ComObjQuery(image, "{A2296057-EA42-4099-983B-539FB6505426}")
	566: Return "D2dBitmap"
▶	569: Throw Error("Image type could not be identified.")
	570: }
	572: {

The current thread will exit.
=========================================================

Code: Select all

; 或将类型声明为截屏:
ImagePutWindow({screenshot: "Untitled - Notepad", crop: [0, 0, 100, 100]}) ; 使用 BitBlt 进行屏幕捕捉

Code: Select all

Error: This value of type "String" has no method named "Has".

	---- d:\LibV2\ImagePut.ah2
	1422: image := [x, y, w, h]
	1423: }
▶	1429: If image.Has(5) and WinExist(image[5])
	1429: {
	1430: Try
=======================================================================

Code: Select all

; 或将类型声明为截屏:
ImagePutWindow({window: "Untitled - Notepad", crop: [0, 0, 100, 100]})     ; 使用 PrintWindow 进行窗口捕获

Code: Select all

Error: pBitmap cannot be zero.

	---- d:\LibV2\ImagePut.ah2
	314: cleanup := "stream"
	318: If !(pBitmap := this.ImageToBitmap(type, image, keywords))
▶	319: Throw Error("pBitmap cannot be zero.")
	323: (validate) && DllCall("gdiplus\GdipImageForceValidation", "ptr", pBitmap)
	324: (crop) && this.BitmapCrop(&pBitmap, crop)

The current thread will exit.

iseahound
Posts: 1451
Joined: 13 Aug 2016, 21:04
Contact:

Re: ImagePut - A core library for images in AutoHotkey (Now supports HEIC & WEBP)

Post by iseahound » 12 Mar 2024, 09:49

That's not me... WinExist() is case sensitive. Try ahk_class Notepad on Windows 11. I think before, it used to be lowercase on Windows 7 and I never changed the documentation.

Post Reply

Return to “Scripts and Functions (v2)”