How to save the coordinate library in the form of excel or txt Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
emanate22
Posts: 52
Joined: 11 May 2021, 00:03

How to save the coordinate library in the form of excel or txt

Post by emanate22 » 16 Jan 2022, 22:52

I used findtext to find the color of a single pixel, so there are thousands of coordinates.
How to save them as txt or excel?
I need to use them in another ahk script to compare whether my target is included in these coordinates library.

Code: Select all

Text:="|<>000000-141414$1.k"
 if (ok:=FindText(465, 922, 579, 1018, 0, 0, Text))
 {
 ;X%A_Index%:=ok[A_Index].x, Y%A_Index%:=ok[A_Index].y,
 }
Last edited by emanate22 on 16 Jan 2022, 23:13, edited 1 time in total.

User avatar
boiler
Posts: 16949
Joined: 21 Dec 2014, 02:44

Re: How to save the coordinate library in the form of excel or txt

Post by boiler » 16 Jan 2022, 23:03

emanate22 wrote: I used findtext to find the color of a single pixel
Why FindText() instead of PixelGetColor? You mean you have it capturing every pixel’s color in a defined area? Why save what’s in an array to a bunch of pseudo-array elements? Or is that commented out because you don’t intend to do that?

User avatar
boiler
Posts: 16949
Joined: 21 Dec 2014, 02:44

Re: How to save the coordinate library in the form of excel or txt  Topic is solved

Post by boiler » 16 Jan 2022, 23:15

I suggest you store them in CSV format (a text file format that can be imported into Excel) using something like this:

Code: Select all

Text:="|<>000000-141414$1.k"
if (ok:=FindText(465, 922, 579, 1018, 0, 0, Text))
	for Each, Coord in ok
		FileAppend, Coord.x "," Coord.y "`n", Coordinates.csv

Actually, since you have thousands of them, using FileAppend thousands of times would be slow. Do this instead:

Code: Select all

Out := ""
Text:="|<>000000-141414$1.k"
if (ok:=FindText(465, 922, 579, 1018, 0, 0, Text))
	for Each, Coord in ok
		Out .= Coord.x "," Coord.y "`n"
FileAppend, % Out, Coordinates.csv
Last edited by boiler on 16 Jan 2022, 23:25, edited 1 time in total.

emanate22
Posts: 52
Joined: 11 May 2021, 00:03

Re: How to save the coordinate library in the form of excel or txt

Post by emanate22 » 16 Jan 2022, 23:24

boiler wrote:
16 Jan 2022, 23:03
emanate22 wrote: I used findtext to find the color of a single pixel
Why FindText() instead of PixelGetColor? You mean you have it capturing every pixel’s color in a defined area? Why save what’s in an array to a bunch of pseudo-array elements? Or is that commented out because you don’t intend to do that?
My target is a pixel, but will find 5000 coordinates, so I'm saving all of them so I can search for them in another ank's script

My ultimate goal is to confirm whether a certain coordinate in the A layer is included in a module colored by me in the B layer (the AB layers are coincident with each other)

Post Reply

Return to “Ask for Help (v1)”