First posting:
i am trying to make an auto
This sounds like you are doing the work and need some help.
Last posting:
I was looking on how to do it
This sounds like you want someone to do it for you.
You will learn more by doing it yourself. Read the Help sections.
Possible structure to do this:
Make a loop (Repeat,Until) to monitor an area of the screen for a certain pixel color (See all Pixel commands)
When that color exists, then exit from loop and activate key (Press, Send) to perform action.
Check out the following Help sections to work with the structure above.:
Repeat, GetPixelColor, WaitPixelColor, GetRectCheckSum, WaitRectChanged, Until, Press, Send.
You are more likely to get help if you are willing to put in some of your own effort. Submit your script explaining problems as noted in earlier posts.