drakonis Posted May 29, 2009 Share Posted May 29, 2009 #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here HotKeySet('{f6}','Close') HotKeySet('{f5}','TogglePause') Global $Pause $PX = '395' ;Pixels X Coord. $PY = '46' ;Pixels Y Coord. $PixelColor = '646364' ;Pixel to check = Black While 1 Sleep(3) GetPixel() WEnd Func Close() ;Hotkey ESC Exits exit 0 EndFunc Func TogglePause() ;Hotkey F1 Pauses the script $Pause = NOT $Pause While $Pause sleep(3) ToolTip('Pixel Shutdown is "Paused"',0,0) WEnd ToolTip("") EndFunc Func GetPixel() ;Constantly checks the pixel color $PixC = PixelGetColor($PX,$PY) $PixH = Hex($PixC, 6) If $PixH = $PixelColor Then controlsend("Archlorc", "", "", "{TAB}") sleep(1) EndIf Sleep(3) EndFunc I want it to simply TAB as soon as the pixel color appears on the coordinates. it does tab but only ONCE and then stops from tabbing. How do i make it work constantly with pixel check every like second and tab if the pixel color was recognized? Link to comment Share on other sites More sharing options...
drakonis Posted May 29, 2009 Author Share Posted May 29, 2009 anyway i think thats the part its messed up. controlsend("Archlorc", "", "", "{TAB}") sleep(1) EndIf any help? Link to comment Share on other sites More sharing options...
water Posted May 29, 2009 Share Posted May 29, 2009 If my understanding of "controlsend" is correct you should add the ControlId as parameter 3. Or if you just want to send {TAB} to the active window use "send". My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
drakonis Posted May 29, 2009 Author Share Posted May 29, 2009 If my understanding of "controlsend" is correct you should add the ControlId as parameter 3.Or if you just want to send {TAB} to the active window use "send".ty for postinG ;}First of all I wanT It to sEnD SiliEnT keys Archlora window even If if its minimized or not on top.what do u mean by cntrolid as parameter 3. im really just a begginer and i dont know what to do with that advice. could u paste me how it should look so i can check it out? ThANKS Link to comment Share on other sites More sharing options...
drakonis Posted May 29, 2009 Author Share Posted May 29, 2009 cmon guys... help me out here Link to comment Share on other sites More sharing options...
drakonis Posted May 30, 2009 Author Share Posted May 30, 2009 bump Link to comment Share on other sites More sharing options...
unixu Posted May 30, 2009 Share Posted May 30, 2009 (edited) drakonis the problem is your while only calls the getpixel function once maybe you can fix it by rewriting the function use getpixel($pixelcolor) as function and then call the function with getpixel("your colorcode here") maybe this will work out here an example Func GetPixel($I_PY,$I_PX,$I_PixelColor);Constantly checks the pixel color $I_PixC = PixelGetColor($I_PX,$I_PY) $I_PixH = Hex($I_PixC, 6) If $I_PixH = $I_PixelColor Then controlsend("Archlorc", "", "", "{TAB}") sleep(1) EndIf Sleep(3) EndFunc now call the function with GetPixel("395","46",'646364' ) btw crontrolsend like i know only works if you got the handle of the window Edited May 30, 2009 by unixu Link to comment Share on other sites More sharing options...
drakonis Posted May 30, 2009 Author Share Posted May 30, 2009 now i get incorrect parameter error when runing script :/ Link to comment Share on other sites More sharing options...
unixu Posted May 30, 2009 Share Posted May 30, 2009 on which line and post the line Link to comment Share on other sites More sharing options...
drakonis Posted May 30, 2009 Author Share Posted May 30, 2009 on which line and post the linefrom get pixel() i erased the line and i can run it now.. but it doesnt work :< im hopeless lol Link to comment Share on other sites More sharing options...
drakonis Posted May 30, 2009 Author Share Posted May 30, 2009 (edited) i shortened the script $I_PX = '395' ;Pixels X Coord. $I_PY = '46' ;Pixels Y Coord. $I_PixelColor = '646364' Func GetPixel($I_PY,$I_PX,$I_PixelColor);Constantly checks the pixel color $I_PixC = PixelGetColor($I_PX,$I_PY) $I_PixH = Hex($I_PixC, 6) If $I_PixH = $I_PixelColor Then controlsend("Archlorc", "", "", "{TAB}") sleep(1) EndIf Sleep(3) EndFunc how do i get this thing to work? i remind that i want it to constantly check the pixel this cordinate and if the color is the same as in pixel color i want it to TAB imidiently untill the pixel color changes to something else Edited May 30, 2009 by drakonis Link to comment Share on other sites More sharing options...
unixu Posted May 30, 2009 Share Posted May 30, 2009 (edited) it still send the tab only once ? if yes try a winwait("Archlorc") then $handle = WingetHandle("Archlorc") controlsend($handle,"","","{TAB}") this will send tab when the window is running until you close Archlorc if you do winwaitactive it will send tab when the game comes active or in forground also working WinWaitNotActive Edited May 30, 2009 by unixu Link to comment Share on other sites More sharing options...
drakonis Posted May 30, 2009 Author Share Posted May 30, 2009 it still send the tab only once ?if yes try a winwait("Archlorc")then $handle = WingetHandle("Archlorc")controlsend($handle,"","","{TAB}")this will send tab when the window is running until you close Archlorcif you do winwaitactive it will send tab when the game comes active or in forgroundalso working WinWaitNotActivei want it to send tab only once untill the pixel color changes to something else(due to tab pressing)sorry but these function are pretty much alien for me ;p im merly a begginer hah 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