Jump to content
Sign in to follow this  
drakonis

i cant get this script get to work properly :/

Recommended Posts

drakonis

#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?

Share this post


Link to post
Share on other sites
drakonis

anyway i think thats the part its messed up.

controlsend("Archlorc", "", "", "{TAB}")

sleep(1)

EndIf

any help?

Share this post


Link to post
Share on other sites
water

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 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
drakonis

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

Share this post


Link to post
Share on other sites
drakonis

cmon guys... help me out here

Share this post


Link to post
Share on other sites
drakonis

bump

Share this post


Link to post
Share on other sites
unixu

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 by unixu

Share this post


Link to post
Share on other sites
drakonis

now i get incorrect parameter error when runing script :/

Share this post


Link to post
Share on other sites
unixu

on which line and post the line

Share this post


Link to post
Share on other sites
drakonis

on which line and post the line

from get pixel() i erased the line and i can run it now.. but it doesnt work :< im hopeless lol

Share this post


Link to post
Share on other sites
drakonis

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 by drakonis

Share this post


Link to post
Share on other sites
unixu

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 by unixu

Share this post


Link to post
Share on other sites
drakonis

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

i 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

Share this post


Link to post
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
Sign in to follow this  

×