Jump to content
Sign in to follow this  
diablo1903

Pixel color and keypresses

Recommended Posts

diablo1903

Hey, im really new to auto-it, and im just wondering if there was a possible way to find the color of a set pixel, and use a certain key depending on what it is.

The main thing is that it wont be the active window, and was wondering if it was possible to send a key to that specific (non-active) window instead of the active one.

Im assuming for the pixel color, their just cant be anything in front of it, which isnt a problem.

Thanks

Edited by diablo1903

Share this post


Link to post
Share on other sites
Jos

Let me guess: You did an extensive search on these forums and found out that you must be the first asking this... right ?

^_^


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
CodyBarrett

Controlsend()

pixlegetcolor()

sorry jos for ruining your fun

Share this post


Link to post
Share on other sites
Jos

sorry jos for ruining your fun

You didn't .. he is all yours. Success with explaining the commands you just posted and making that work. ^_^

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
CodyBarrett

Controlsend (FROM HELPFILE)

ControlSend ( "title", "text", controlID, "string" [, flag] )

title - The title of the window to access.

text - The text of the window to access.

controlID - The control to interact with. See Controls.

string - String of characters to send to the control.

flag - [optional] Changes how "keys" is processed:

flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow.

flag = 1, keys are sent raw.

Return Value

Success: Returns 1.

Failure: Returns 0 if window/control is not found.

Remarks

ControlSend works in a similar way to Send but it can send key strokes directly to a window/control, rather than just to the active window.

ControlSend is only unreliable for command prompts as that works differently to normal windows (seems to check physical states rather than accepting the keystroke messages). For normal windows ControlSend should be way more reliable than a normal Send - and yes it does send shift, ctrl, alt etc.

As mention in the Send help the keyboard that send different chars when in CAPS LOCK and using the Shift Key cannot be simulated. An example is the Czech Keyboard. A good workaround is to use the ControlSetText.

The control might first need to be given focus with the ControlFocus command, specially when referencing an controlID created by the script itself.

Opt("SendKeyDelay",...) alters the the length of the brief pause in between sent keystrokes.

Opt("SendKeyDownDelay",...) alters the length of time a key is held down before being released during a keystroke.

lol hope some of that helps

Share this post


Link to post
Share on other sites
Humper

I just have to ask one thing:

title - The title of the window to access.

text - The text of the window to access.

Whats the difference?

[center][/center]

Share this post


Link to post
Share on other sites
Jos

Controlsend (FROM HELPFILE)

lol hope some of that helps

My conclusions:

what are the odds that a member called diablo1903 will be making a bot for a game? (diablo??)

How many controls do you think there will be on a games window?

How would you use pixelgetcolor() on a hidden/minimized window?

Jos - out...

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
CodyBarrett

true... once again.. like in my sig.. helpfile is your best friend.. oh and the forums help too ^_^

and humper

the title is the windows TITLE the text is whats in the window.. like controls and text

Edited by CodyBarrett

Share this post


Link to post
Share on other sites
Humper

Still don't really getting it ^_^

Title is: Mozilla Firefox

Text is: Pixel color and keypresses - autoit forums

or do I get this wrong?


[center][/center]

Share this post


Link to post
Share on other sites
Jos

Still don't really getting it ^_^

Title is: Mozilla Firefox

Text is: Pixel color and keypresses - autoit forums

or do I get this wrong?

Please read the helpfile on this which clearly explains the difference between searching the Window Title and the text in the window itself.

This thread needs to go back on the OP's topic.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
diablo1903

My conclusions:

what are the odds that a member called diablo1903 will be making a bot for a game? (diablo??)

How many controls do you think there will be on a games window?

How would you use pixelgetcolor() on a hidden/minimized window?

Jos - out...

It essentially is a bot of sorts, but its not for Diablo. The type of thing I'm making should really be a lot simpler then that, more like:

if pixel x is red, press b. if pixel x is blue, press c.

Just something extremely simple like that, my question wasn't essentially of how to do it, just a general question of if it was possible to check the color of a minimized/inactive window, and to send keypress' to it.

As for the searching comment- I didn't think id be able to find a simple yes/no answer with a certain code line id be able to use, without finding an entirely made bot. As if I found a made one, my laziness would force me to use that instead of making one (Which I don't want to happen)

Also just as another small question, is it possible to move a specified window to a pre-set point on the screen?

Share this post


Link to post
Share on other sites
will88

is it possible to move a specified window to a pre-set point on the screen?

WinMove() ?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.