-1

I currently have made a program in AutoIT that has PixelSearch methods inside of it. Anyway, I have a pretty intense GUI that can be annoying to fill out everytime you run it, so I decided I would make a save/load settings button. It turns out that AutoIT handles file reading/writing pretty inefficiently, so writing to the file to "save" settings and reading from the file to "load" settings was out of the question. I decided to make something in C# since the FileStream class is amazing. But, to replace the AutoIT program, I need the function pixelsearch, which basically searches for a certain pixel in a rectangle/point defined. Anyone have an idea how this is created, or if there is one already how it is used?

P.S: Is there also a way that I can save the cursor's location after the user presses a certain button in C#? I was thinking of a mouseEvent of some sort.

Andrew Savinykh
  • 22,530
  • 13
  • 90
  • 143
Ipwnusck
  • 63
  • 1
  • 9
  • Use PInvoke to get pixels, like described here: http://stackoverflow.com/a/753157/284111 You will need to write your own function to do the search, based on it, but it's not very hard. – Andrew Savinykh Dec 18 '13 at 23:40
  • Also, what is inefficient about save/load in autoit? – Andrew Savinykh Dec 18 '13 at 23:40
  • May be related to here http://stackoverflow.com/questions/1483928/how-to-read-the-color-of-a-screen-pixel – Jafin Dec 18 '13 at 23:41
  • @zespri I want it to search for a pixel in a certain area of a certain color and return the x and y coordinates. And the file writing/reading is very inefficient, you try it out and tell me how it goes :) – Ipwnusck Dec 18 '13 at 23:51
  • @Jafin I want it to search for a color in a rectangle and return the color's position (x and y coordinates) – Ipwnusck Dec 18 '13 at 23:52
  • I understand what you want to do. What problems do you have in achieving it? – Andrew Savinykh Dec 19 '13 at 00:04
  • Did you use `IniRead`/`IniWrite` or `RegRead`/`RegWrite`? There should be no problem with saving settings to a file... – Samoth Dec 19 '13 at 21:05

1 Answers1

0

you certainly can save the mouse click locations, try to use the mouse events mouseUp(object sender, MouseEventArgs e) mouseDown(object sender, MouseEventArgs e) ... inside the function you can open a stream and write the location everytime then close it , the location is e.Location

chouaib
  • 2,714
  • 5
  • 18
  • 33