Jump to content

i cant get this script get to work properly :/


Recommended Posts

#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

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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...