Bigred2k Posted August 15, 2011 Share Posted August 15, 2011 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 More sharing options...
monoscout999 Posted August 15, 2011 Share Posted August 15, 2011 and what are your efforts on this? Link to comment Share on other sites More sharing options...
cdkid Posted August 15, 2011 Share Posted August 15, 2011 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 More sharing options...
Bigred2k Posted August 15, 2011 Author Share Posted August 15, 2011 Not much. I'm watching basic video tutorials on youtube at the moment =P Link to comment Share on other sites More sharing options...
Bigred2k Posted August 15, 2011 Author Share Posted August 15, 2011 Thanks CD. I'll start there. Link to comment Share on other sites More sharing options...
Bigred2k Posted August 15, 2011 Author Share Posted August 15, 2011 OK. Here's what I got: http://pastebin.com/mC9Kgdbf Im not sure how to tie the individual pixel searches in with the 7,8,9 keypresses. Link to comment Share on other sites More sharing options...
monoscout999 Posted August 15, 2011 Share Posted August 15, 2011 (edited) 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 August 15, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
Bigred2k Posted August 15, 2011 Author Share Posted August 15, 2011 This is the first script ive written so thanks for being patient. you can see the latest version here:http://pastebin.com/8iyTHPQ3 How do I make it so that it loops over and over waiting for the next hotkey press? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 16, 2011 Share Posted August 16, 2011 (edited) Put a While...WEnd loop, with a small Sleep (parameter of 10 is fine), between the last HotKeySet and the first function (Func). This will keep the script running. Edited August 16, 2011 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
monoscout999 Posted August 16, 2011 Share Posted August 16, 2011 (edited) 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 August 16, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
StrykeR69 Posted August 16, 2011 Share Posted August 16, 2011 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 More sharing options...
somdcomputerguy Posted August 16, 2011 Share Posted August 16, 2011 StrykeR69 - you shouldn't hijack a thread to ask an unrelated question.. Start a new topic. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now