Jump to content

tut for newbies #2


 Share

Recommended Posts

Before you read this tut you must have the skills of ai tut #1

Note : your pc must run on 32-bits and have a firefox window open :lmao:

PixelSearch(0,0,@DesktopHeight,@DesktopWidth,0xEF7D10)

With this you you look on your full screen to find a firefox window , i only search , if i found or not , i dont do anything .. How do you know the color ?

Open your autoIt map where it is installed.. Start up AU3Info.exe if you click anywhere on the screen ( not in window of progam) then he start .. you will see mutch info of the window that get the focus ... if you press ctrl + alt + F he go to pause .. if you hate the highlight you goto the window and choose menu , options , highlight controls .. you can set here always on top off too , always on top means that he dont go away if you set the focus on an other progam.. if you move the mouse on the window of firefox , on the icon in the start bar

Posted Image

if you there with the mouse you a color in AU3Info .. i has do the same and i found the color "0xEF7D10"... Where you found it in AU3Info.exe?

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: >> HERE << Dec:

$found = PixelSearch(0,0,@DesktopHeight,@DesktopWidth,0xEF7D10)

I set the x and y in $found , but in a array , You must work with arrays

$found = PixelSearch(0,0,@DesktopHeight,@DesktopWidth,0xEF7D10)
if not @error then
endif

What stands here ? if not @error then wtf means that ? its easy .. for the progam stands here "If there is not a error then".. You shall think now , Then What? Then he does all statments that he find before the next endif..

$found = PixelSearch(0,0,@DesktopHeight,@DesktopWidth,0xEF7D10)
if not @error then
 mousemove($found[0],$found[1])
endif

The mouse will be move now to $found[0] .. function PixelSearch will be write the x of 0xEF7D10 in $found[0] .. the y can be found in $found[1]

$found = PixelSearch(0,0,@DesktopHeight,@DesktopWidth,0xEF7D10)
if not @error then
 mousemove($found[0],$found[1])
 mouseclick("left")
endif

Yeah we has faked a mouseclick , Windows thinks that you has pressed a mousebutton , "left" now he thinks .. its mouseclick("left") not right , if you do mouseclick("right") then he press the right button.. you got "middle" to , if has found on this site that some mouse's got mousebutton 4 .. and 5 .. i dont know how , i have never tryed it..

With us progam we got a little problem .. What to do if there is no firefox , he must do nothing ? No that not normal , you start your progam and he Search for 0xEF7D10 and he stops .. thats not nice , is it? no it isn't..

$found = PixelSearch(0,0,@DesktopHeight,@DesktopWidth,0xEF7D10)
if not @error then
 mousemove($found[0],$found[1])
 mouseclick("left")
else
 msgbox(0,"Error","We didn't found firefox")
endif

Now we has made a message if firefox dont exits , how i know that firefox not exits ? First i do "If not @error then" , It mean "If no errors then" , now we got , There is a error , What error ? He dont found firefox .. Why not ? Window isn't open.. 3 Statments later you get "else" .. "if there is no error then" ,Else means here "if there is a error" .. Then i show a msgbox with in it "We didn't found Firefox" , And as title "Error" .. In Next tut you can find how we edit the site bar ;)

-jaenster

Link to comment
Share on other sites

@jaenster: your looking for just 1 color, but you cannot be sure only firefox uses it

maybe you should do

if not winexists ("firefox") then

instead of

$found = PixelSearch(0,0,@DesktopHeight,@DesktopWidth,0xEF7D10)
if not @error then

the rest is fine

as i said i like your tuts

Link to comment
Share on other sites

thats depending on the person using it

1. some people think that window-managment is way easier (like me)

than pixel-management, especially in this case as you don't know if firefox is the only application visible using this color

2. the way you're looking for the color is quite slow maybe you should use pixelchecksum - maybe too hard for newbies

don't get me wrong this is no criticism, these are just some suggestions for your future scripts

Link to comment
Share on other sites

  • Moderators

I'm thinking you should stay away from doing a tutorial jaenster in english. I'm a bit experienced with AutoIt, but I must say, your tutorial(s) confuses the hell out of me.

Why don't you try to write one in your native tongue, for those that speak your language could surely understand and it would have a greater affect then what your doing here.

There are better tutorials out there that the english speaking users can 'Easily' understand, by coders/scripters that have much more experience with AutoIt.

http://www.autoitscript.com/forum/index.ph...topic=19434&hl=

http://www.autoitscript.com/forum/index.php?showtopic=21048#

This is not meant in any way to be hurtful, in fact... I applaud your efforts, but if your truly not helping them to understand your broken english explinations, your only hurting them in the long run.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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