Jump to content

simple script help


Recommended Posts

I need some help writing a very simple script that searches a area of the screen for a certain color and if found sends a keypress.

The script should work like so:

When numpad 7 is pressed, autoit should send a keypress of "W", search the pixel range of 560,620(top left pixel)/580,645(bottom right pixel), wait till it finds color#1, send 2nd "W" keypress

When numpad 8 is pressed, autoit should send a keypress of "W", search the pixel range of 560,620(top left pixel)/580,645(bottom right pixel), wait till it finds color#2, send 2nd "W" keypress

When numpad 8 is pressed, autoit should send a keypress of "W", search the pixel range of 560,620(top left pixel)/580,645(bottom right pixel), wait till it finds color#3, send 2nd "W" keypress

if someone doesn't mind programming this for me I would REALLY appreciate it.

Thanks!

Link to comment
Share on other sites

Some useful functions to check out in the help files would be

PixelGetColor

PixelSearch

HotKeySet

Send

Hope this helps. I'm sure if you provided an attempt anyone would be willing to help modify it.

~cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

the first that i see is that you don`t know how to use HotKeySet() see the help file and the examples for this function...

The variables like $blue_pixel = 0x0033FF must be $blue_pixel = "0x0033FF" because that gives you an error...

My advice.. start for one thing at the time, and try to solve that, for example the fist thing you need to do is know how to use the hotkeyset, then do an example of this function and learn how to use it, until that don`t go for another function because you will get messy and is not pleaseant help to messy people with messy scripts.

Edited by monoscout999
Link to comment
Share on other sites

You can paste your script directly into the forum using

[/autoit] tags.. just paste your code between.
You dont need to add the brackets in every hotkeyset function or in every send function, this is reserved for special characters, read the help file about the send function and the apendix theres info about this feature. But if you want to use the numpad as hotkey you have to use it but in the correct way {NUMPAD0} - {NUMPAD9} Numpad digits 
you need a loop to containing the script
something like this
[autoit]while true
   sleep(50)
Wend

You will see many loops in the autoit examples

Your PixelSearch function have syntaxis errors... [5] is not a valid value for that parameter, only the integer alone is enough.

there a lot of corrections but are going in the right direction... the experience gives you the knowldege

Another free tip, if you are using SciTe look into the tools menu, something called tidy, this will adjust the format and the spacing of the text inside the script.

EDIT: some syntax examples

HotKeySet("{NUMPAD7}", "ToggleBlue")

$coord = PixelSearch(560, 620, 580, 645, $blue_pixel,5)

Send("w")
Edited by monoscout999
Link to comment
Share on other sites

help! I made a program wich have a textbox and there have something typed....when I press the start button....the program goes to startup....how can I do to when the pc is powered on from the start up...the program don't shown the form(textbox and start button)...just don't shown anything and by hisself go to start up????

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...