pezo89 Posted May 14, 2010 Posted May 14, 2010 Hi guys how can i have it search for the blue pixel (see img) and then click on whenever it is found (it tend to bounce abit up and down as the sites are diffrent) have tried this without luck $pixelSearch=PixelSearch(28,425,796,1014,0x0099FF) If IsArray($pixelSearch) Then MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,5)' endif what i need it to do, is to search for that color, click on it, and just continue with the script (this just a small part of it, but the rest contains personal information so wont post the entire script here anyways, thx for the help in advance..
JohnOne Posted May 14, 2010 Posted May 14, 2010 Thats quite not the right way to go about what you are wanting to do (if click a button on the website is what you wat to do) You want to be looking into the IE or FF UDFs. Im sorry I cannot offer you an example as Im not that familiar with them myself but I do offer sage council, the pixel functions are just wrong for your job. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
pezo89 Posted May 15, 2010 Author Posted May 15, 2010 yea but ie commands are for Internet Explorer only arent they? might it be able to use an imgsearch with AHK to jumpstart the cycle of the AU script?
JohnOne Posted May 15, 2010 Posted May 15, 2010 There is also a Firefox udf that would do the job, in a similar fashion to IE, its called FF.au3 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
pezo89 Posted May 15, 2010 Author Posted May 15, 2010 yea but my scripting knowledge is far beneeth the requirement to implement that lol =)
JohnOne Posted May 15, 2010 Posted May 15, 2010 (edited) Ok, fair enough, but I gurantee you will turn to FF.au3 after wasting your time with this approach, and wonder why you didnt spend that time looking at FF examples, because like you say the sites are not the same. First you will need to look in a more likely place for the button as there will almost certainly be another colour the same as the one you are looking for, before the one you want (If its at the bottom then maybe you should search from bottom to top) Next you will want to get a checksum of the pixels around that area to validate to are at the correct place Then $pixelSearch=PixelSearch(28,425,796,1014,0x0099FF) ;<<=======This needs to be nearer the area you are likely to find the button If IsArray($pixelSearch) Then $checksum = PixelChecksum($pixelSearch[0]-4,$pixelSearch[1]-4,$pixelSearch[0]+4,$pixelSearch[1]+4) ;<==Get a checksum from the area around the first pixel found If $checksum = $CalculatedChecksum Then; <======== Check it against one you have previously calculated MouseClick("left",$pixelSearch[0] + 4,$pixelSearch[1] + 4,1,5) EndIf Endif Good luck. Edited May 15, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
pezo89 Posted May 15, 2010 Author Posted May 15, 2010 Ok, fair enough, but I gurantee you will turn to FF.au3 after wasting your time with this approach, and wonder why you didnt spend that time looking at FF examples, because like you say the sites are not the same. First you will need to look in a more likely place for the button as there will almost certainly be another colour the same as the one you are looking for, before the one you want (If its at the bottom then maybe you should search from bottom to top) Next you will want to get a checksum of the pixels around that area to validate to are at the correct place Then $pixelSearch=PixelSearch(28,425,796,1014,0x0099FF) ;<<=======This needs to be nearer the area you are likely to find the button If IsArray($pixelSearch) Then $checksum = PixelChecksum($pixelSearch[0]-4,$pixelSearch[1]-4,$pixelSearch[0]+4,$pixelSearch[1]+4) ;<==Get a checksum from the area around the first pixel found If $checksum = $CalculatedChecksum Then; <======== Check it against one you have previously calculated MouseClick("left",$pixelSearch[0] + 4,$pixelSearch[1] + 4,1,5)' EndIf Endif Good luck. Thx alot, but there is somthing wrong, getting an syntax error :S
JohnOne Posted May 15, 2010 Posted May 15, 2010 theres a quote at the end of the mouseclick line needs removing. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
pezo89 Posted May 16, 2010 Author Posted May 16, 2010 theres a quote at the end of the mouseclick line needs removing. tried that lol still gets this msg'es C:\Users\Andreas\Desktop\Del 2.au3(37,128) : WARNING: $pixelSearch possibly not declared/created yet $pixelSearch=PixelSearch(28,425,796,1014,0x0099FF) ;<<=======This needs to be nearer the area you are likely to find the button ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Andreas\Desktop\Del 2.au3(39,165) : WARNING: $checksum possibly not declared/created yet $checksum = PixelChecksum($pixelSearch[0]-4,$pixelSearch[1]-4,$pixelSearch[0]+4,$pixelSearch[1]+4) ;<==Get a checksum from the area around the first pixel found ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Andreas\Desktop\Del 2.au3(40,40) : WARNING: $CalculatedChecksum: possibly used before declaration. If $checksum = $CalculatedChecksum Then ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Andreas\Desktop\Del 2.au3(40,40) : ERROR: $CalculatedChecksum: undeclared global variable. If $checksum = $CalculatedChecksum Then ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Andreas\Desktop\Del 2.au33 - 1 error(s), 3 warning(s)
JohnOne Posted May 16, 2010 Posted May 16, 2010 Dosent make sense to me why that happens sometimes lets look at your fist message for example "C:\Users\Andreas\Desktop\Del 2.au3(37,128) : WARNING: $pixelSearch possibly not declared/created yet" Then underneath it shows the line where its clearly defined "$pixelSearch=PixelSearch(28,425,796,1014,0x0099FF)" Maybe you have to declare it previously Local $pixelSearch etc.... AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
XKahn Posted May 16, 2010 Posted May 16, 2010 (edited) LOL So you are mass spamming the job site with your resume no doubt. I really do wish you the best of luck on that effort. So let me assist you by using an "old school" method of finding the submit button. The younger crowd is way too mouse dependent. What you actually need to do is use the Send("{TAB}") inside a loop until it crosses the correct link. So the next thing we look at is; what could be used to define that link. A quick look at the properties shows; javascript:document.sendSoeknad.submit(); That could be used as a whole or just the simple "submit" in part. Use $x = StatusbarGetText("Internet Explorer") or $x = StatusbarGetText("Mozilla Firefox") So now you need to have your script looking for the button property in a TAB loop until found. Once found, you simply do Send("{ENTER}") and your done. To recap; AutoItSetOption("WinTitleMatchMode", 2) $x = StatusbarGetText('Firefox') $result = StringInStr($x, "submit") MsgBox (0,'READY?','Get to the site before you say ok.') While $result = 0 Send("{TAB}") $x = StatusbarGetText('Firefox') $result = StringInStr($x, "submit") Sleep (20) WEnd Send("{ENTER}") The above code is not yet perfected but is pretty close, I am having some difficulty reading the status bar info for FFox but IE works. See no hunting down those pixels after all. Happy hunting! Edited May 16, 2010 by XKahn
pezo89 Posted May 18, 2010 Author Posted May 18, 2010 LOL So you are mass spamming the job site with your resume no doubt. I really do wish you the best of luck on that effort. So let me assist you by using an "old school" method of finding the submit button. The younger crowd is way too mouse dependent. What you actually need to do is use the Send("{TAB}") inside a loop until it crosses the correct link. So the next thing we look at is; what could be used to define that link. A quick look at the properties shows; javascript:document.sendSoeknad.submit(); That could be used as a whole or just the simple "submit" in part. Use $x = StatusbarGetText("Internet Explorer") or $x = StatusbarGetText("Mozilla Firefox") So now you need to have your script looking for the button property in a TAB loop until found. Once found, you simply do Send("{ENTER}") and your done. To recap; AutoItSetOption("WinTitleMatchMode", 2) $x = StatusbarGetText('Firefox') $result = StringInStr($x, "submit") MsgBox (0,'READY?','Get to the site before you say ok.') While $result = 0 Send("{TAB}") $x = StatusbarGetText('Firefox') $result = StringInStr($x, "submit") Sleep (20) WEnd Send("{ENTER}") The above code is not yet perfected but is pretty close, I am having some difficulty reading the status bar info for FFox but IE works. See no hunting down those pixels after all. Happy hunting! did this work for you?, as it wont work for me..
pezo89 Posted May 18, 2010 Author Posted May 18, 2010 tried another approach, but im lost, it works out of the main code, but not within the maincode This works= #include <IE.au3> Global $Paused sleep ("1000") HotKeySet("{Insert}", "TogglePause") send ("{Insert}") $kordinater = PixelSearch(29, 573, 668, 901, 0x0099FF) If IsArray($kordinater) Then MouseClick("left", $kordinater[0], $kordinater[1], 1, 0) Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ;toolTip('Script - "Scriptet er - AV"',0, 40) WEnd ToolTip("") EndFunc Maincode = witch not work expandcollapse popupOpt('MustDeclareVars', 1) Opt("SendKeyDelay", 10) ;5 milliseconds Opt("SendKeyDownDelay", 1) ;1 millisecond Opt("MouseClickDelay", 10) ;10 milliseconds Opt("MouseClickDownDelay", 10) ;10 milliseconds Opt("MouseClickDragDelay", 250) ;250 milliseconds ;;Endre linje 150 til mouseclick;SEnde Søknad Global $Paused sleep ("1000") HotKeySet("{Insert}", "TogglePause") WinActivate("Microsoft Excel - Jobber som skal søkes på") sleep (1000) WinWaitActive("Microsoft Excel - Jobber som skal søkes på") sleep (1000) MouseMove (119,601,12) sleep (1000) mouseclick ("Left") sleep (1000) send ("{Down}") sleep (1000) send ("^{c}") sleep (1000) WinActivate ("Mozilla Firefox") WinWait ("Mozilla Firefox") sleep (1000) MouseMove(419,56,25) sleep (1000) MouseClick("LEFT") sleep (1500) send ("^{v}") sleep (1500) send ("{enter}") sleep (3000) send ("^{0}") sleep (1000) send ("^{NUMPADSUB 3}") sleep (1000) $kordinater = PixelSearch(29, 573, 668, 901, 0x0099FF) sleep (1000) If IsArray($kordinater) Then MouseClick("left", $kordinater[0], $kordinater[1], 1, 0) sleep (2000)
pezo89 Posted May 18, 2010 Author Posted May 18, 2010 Got it working. well sort of. i start the search for the blue button command with a runwait command lol
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