Jump to content


ImageSearch - OutputVarX, OutputVarY


  • Please log in to reply
4 replies to this topic

#1 LeBoob

LeBoob
  • Guests

Posted 14 May 2012 - 03:06 PM

In ImageSearch, the variables OutputVarX, OutputVarY are the upper-left corner of the image being found. Is is possible to set it to other corners of the image, like bottom right?

If it cant be done within the ImageSearch function, how bout finding our the size of the image and then offset it to get to the other corner?

#2 Leef_me

Leef_me
  • Moderators
  • 7704 posts

Posted 14 May 2012 - 04:10 PM

To be clear, ImageSearch is a command not a function. There is a big difference.
It is _not_ possible to comfigure the command to report a different corner.
You should be able see the width and height of the image by looking at it's properties with Windows Explorer.
Once you know the width and height, you can assign those values to variables before executing the ImageSearch.

If you want to move to the center of the found image you could use
mousemove, OutputVarX+width/2, OutputVarY+height/2

#3 theone

theone
  • Guests

Posted 20 May 2012 - 10:06 AM

interesting question.

however the solution given would mean that he'll have to manually and tediously find out the size of every image he uses, then key them into the script to do the offseting. sure theres a script somewhere that can do this automatically?

#4 heyyjuliet

heyyjuliet
  • Guests

Posted 02 June 2012 - 03:04 PM

I'm curious about this too. Does anyone have a better solution?

#5 Leef_me

Leef_me
  • Moderators
  • 7704 posts

Posted 02 June 2012 - 08:46 PM

; based on a list of images, create 3 psuedo-arrays containing: names, widths and heights

list= blue_highlight.bmp,all_black.bmp,back.bmp,backx0.bmp,bird.bmp,black.bmp



loop, parse, list, `,

{

  ; add a control to a gui, get it's size and destroy the gui

  gui,99:add, picture, vimage, %A_LoopField%

  GuiControlGet, image, 99:Pos

  gui,99:destroy



  image%a_index% := A_LoopField

  image%a_index%w := imagew

  image%a_index%h := imageh

}

listvars

msgbox

return