Sign in to follow this  
Followers 0
jimmys

Loop

17 posts in this topic

Hey im new to autoit so go easy on me >_< how can i get this to work

If PixelGetColor( 577, 78) = 0x3C6330 Then

Send("1")

i want it so everytime that cordinate is 577, 78 = 0x3C6330 that it sends 1

Thanks :)

Share this post


Link to post
Share on other sites



Hi jimmys,

1st Welcome to the AutoIt Forums! :idiot:

Some of the following tips may not apply to you, but it may make your life a bit easier here on the forum in the future.

CODE
  • Did you know that we have an awesome search feature?

    You can find many answers to your current questions, just by typing in the right search patterns.

  • A suggestion is to use the Advanced Search mode:

  • Type your specific search term in quotes.
  • Click the forum you want to search in (the one most likely to have your information would generally be the Example Script forum and or the General Help and Support Forum).
  • Click on "Search titles only" radio button.
  • Click perform search.
The above will help you narrow down your searches and prevent you from unneccesarily posting a new thread.

[*]Also, you should try to read the Sticky posts that are at the top of each of the AutoIt Forums you enter such as:

[*]Forum Etiquette:

  • Making a new thread:

    • Use the Search feature first to see if your question has already been answered.
    • Look in the help file as well before even thinking of posting (When what you want could be obtained by simply reading the help file, you don't generally get a good response from your AutoIt community).
    • Titles are very important here. 1 word titles or titles like "help me", "write something for me", "I'm a noob" etc... aren't tolerated.
    • Use common sense when creating a new thread.

      Ask yourself if the title is descriptive enough to even interest someone (preferably those that know what they are talking about) to even look at your thread, let alone reply in it.

    • Think about how it would show in the search feature if someone were to look for something just like you are looking for (think of the keywords you used yourself and obviously didn't find anything (because we know you used the search feature :) ) and use those types of keywords in your title as well).
  • Thread content:

    • Be descriptive with your query. (Make sure we actually know what you want to do).
    • Show you've made an effort in coding what you want (provide the reproducer code (generally no more than 50 lines as people lose interest in debugging someones script for free)).
    • Don't talk in ebonics. A lot of the forum members are adults, and a lot of them know how to help you, but talk like a child, you'll be treated as such.
    • Don't ask for help making keyloggers, spam (even if it's to do as a prank), or anything that can be thought of as malicious. You'll more than likely have the thread locked by a moderator, and take a bashing from your fellow AutoIt community.
    • When posting code, use code boxes. This can be accomplished by using [code ]<content here>[/code ] (No spaces between the brackets []).

      Using code boxes will keep the indentation and make it easier to read for others to help you.

  • Bumping your threads:

    • Use common courtesy here.

      Keep in mind every time you bump your thread to the top of the forum, you knock the other threads down a notch.

      Everyone posting for help has just as much right for their threads to get read as you do.

      Because of that, do not bump your post more than once in a 24 hour period.

      A Bump is simply posting in your thread with nothing that pertains to your query with the sole purpose of moving it up.

      Deleting previous bumps, and posting new ones is not tolerated, and the moderators can find those deletions, so do yourself a favor and don't cross that line >_< .

  • Rude or obnoxious content:

    This falls pretty much under the common sense thing. If you use it (common sense) before posting, you won't have issues.

    • Don't use foul language, remember, a lot of the community is at work when they read these threads.
    • Don't provoke or instigate an argument with someone.
  • Double Posting:

    • It's understood that sometimes there's a lag in the system, and sometimes people don't see their post go up right aways so they post again.

      If this happens to you, simply notify a moderator with the report feature in the post, and politely ask them to delete it.

    • If you're just creating another topic because your original topic is not being answered the way you want or at all, this is not tolerated. You could lose your posting privileges all together over it.
  • Non-English languages

    • If English is not your primary language, please make an attempt to interpret (yourself or online) and post that interpretation.

      We have wonderful users from around the world, so after you've done your post in English, back it up with your question also in your native tongue (You may find your answer much quicker using both).

That's it for now, I hope you have a wonderful learning experience, and hope to see you contribute to the community as your knowledge grows.

Share this post


Link to post
Share on other sites

Hey im new to autoit so go easy on me >_< how can i get this to work

If PixelGetColor( 577, 78) = 0x3C6330 Then

Send("1")

i want it so everytime that cordinate is 577, 78 = 0x3C6330 that it sends 1

Thanks :)

PixelGetColor returns decimal value of pixel`s color.

Try this:

If ("0x" & Hex(PixelGetColor( 577, 78),6)) == 0x3C6330 Then

When the words fail... music speaks

Share this post


Link to post
Share on other sites

This is my script so far but it doesnt send 1 when the color is there

HotKeySet("{HOME}", "_Dunno")

While 1

Sleep(100)

WEnd

Func _Dunno()

If ("0x" & Hex(PixelGetColor( 828, 5),6)) == 0x005AE7 Then

Call ("ice")

EndIf

EndFunc

Func _ice()

Send("1")

Sleep(20)

Call("Dunno")

EndFunc

Share this post


Link to post
Share on other sites

This is my script so far but it doesnt send 1 when the color is there

HotKeySet("{HOME}", "_Dunno")

While 1

Sleep(100)

WEnd

Func _Dunno()

If ("0x" & Hex(PixelGetColor( 828, 5),6)) == 0x005AE7 Then

Call ("ice")

EndIf

EndFunc

Func _ice()

Send("1")

Sleep(20)

Call("Dunno")

EndFunc

Sorry, my bad. Replace == with =

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Thanks again is there something wrong with my call?

HotKeySet("{HOME}", "_Dunno")

While 1

Sleep(100)

WEnd

Func _Dunno()

Mousemove (649, 731, 2)

If ("0x" & Hex(PixelGetColor( 649, 731),6)) = 0xFFFFFF Then

Call("ice")

EndIf

EndFunc

Func _ice()

Send("1")

Sleep(50)

Call("Dunno")

EndFunc

Share this post


Link to post
Share on other sites

ice()<>_ice()


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Thanks it calls now but i have to tap home to get it to detect the color

HotKeySet("{HOME}", "_Dunno")

While 1

Sleep(100)

WEnd

Func _Dunno()

If("0x" & Hex(PixelGetColor( 558, 108),6)) = 0x999988 Then

Call("_ice")

EndIf

EndFunc

Func _ice()

Send("1")

Sleep(20)

Call("_Dunno")

EndFunc

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

.. is there something wrong with my call?

Yes.

PixelGetColor returns a number so if you want to compare it to a number don't change it to a string

if PixelGetColor( 649, 731) = 0xffffff then;

and not

If ("0x" & Hex(PixelGetColor( 649, 731),6)) = 0xFFFFFF Then

This next way would also be correct (by why do it?)

If ("0x" & Hex(PixelGetColor( 649, 731),6)) = "0xFFFFFF" Then

BTW, the best way to cal a function is to use the function name followed by brackets. The bracket should contain any necesssary parameters.

ice() rather than Call("ice")

EDIT: I see that is how you started. Apologies. You were given some incorrect advice by Andeik.

Now I look at the earlier posts I see that things are a bit uncontrolled. One function calls another which thjen calls the previous function and I would expect some nasty crash if the pixel being checked is the colour you are looking for.

Do you want the send("1") to happen only once or repeatedly if the pixel colour is corect?

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Yes.

PixelGetColor returns a number so if you want to compare it to a number don't change it to a string

if PixelGetColor( 649, 731) = 0xffffff then;

and not

If ("0x" & Hex(PixelGetColor( 649, 731),6)) = 0xFFFFFF Then

This next way would also be correct (by why do it?)

If ("0x" & Hex(PixelGetColor( 649, 731),6)) = "0xFFFFFF" Then

BTW, the best way to cal a function is to use the function name followed by brackets. The bracket should contain any necesssary parameters.

ice() rather than Call("ice")

EDIT: I see that is how you started. Apologies. You were given some incorrect advice by Andeik.

Now I look at the earlier posts I see that things are a bit uncontrolled. One function calls another which thjen calls the previous function and I would expect some nasty crash if the pixel being checked is the colour you are looking for.

Do you want the send("1") to happen only once or repeatedly if the pixel colour is corect?

Andreik has been told about this before. http://www.autoitscript.com/forum/index.php?showtopic=79574

@Andreik ... Improper coding methods could cause more harm than good regardless of whether something works or not. Please don't suggest this method again.

Edit

If (PixelGetColor(x, y) == 0x00000) Then

Would be more to the point.

Edit2:

Edited my post with an example and took out the original post :)

Edited by SmOke_N

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.

Share this post


Link to post
Share on other sites

Yes.

PixelGetColor returns a number so if you want to compare it to a number don't change it to a string

if PixelGetColor( 649, 731) = 0xffffff then;

and not

If ("0x" & Hex(PixelGetColor( 649, 731),6)) = 0xFFFFFF Then

This next way would also be correct (by why do it?)

If ("0x" & Hex(PixelGetColor( 649, 731),6)) = "0xFFFFFF" Then

BTW, the best way to cal a function is to use the function name followed by brackets. The bracket should contain any necesssary parameters.

ice() rather than Call("ice")

EDIT: I see that is how you started. Apologies. You were given some incorrect advice by Andeik.

Now I look at the earlier posts I see that things are a bit uncontrolled. One function calls another which thjen calls the previous function and I would expect some nasty crash if the pixel being checked is the colour you are looking for.

Do you want the send("1") to happen only once or repeatedly if the pixel colour is corect?

Thanks for your help i want it to happen repeatedly otherwise i have to keep taping the hotkey.

Share this post


Link to post
Share on other sites

Thanks for your help i want it to happen repeatedly otherwise i have to keep taping the hotkey.

Not tested of course

HotKeySet("{HOME}", "_Dunno")
HotKeySet("{Esc}", "MyExit")

While 1
    Sleep(100)
WEnd

Func _Dunno()
    MouseMove(649, 731, 2);<-----------------??
    While Hex(PixelGetColor(649, 731) = 0xFFFFFF;<---------check coords and value
        ice()
    WEnd
EndFunc  ;==>_Dunno

Func _ice()
    Send("1")
    Sleep(50)
EndFunc  ;==>_ice

Func MyExit()
    Exit
EndFunc  ;==>MyExit

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Doesnt work :)

line 21 (FIle "File "C:\Documents and Settings\Jimmy\My documents\world.au3"):

While Hex(PixelGetColor(649, 731) = 0xFFFFFF

While Hex(PixelGetColor(649, 731) = ^ ERROR

Error: Error parsing function call.

Edited by jimmys

Share this post


Link to post
Share on other sites

Doesnt work :)

line 21 (FIle "File "C:\Documents and Settings\Jimmy\My documents\world.au3"):

While Hex(PixelGetColor(649, 731) = 0xFFFFFF

While Hex(PixelGetColor(649, 731) = ^ ERROR

Error: Error parsing function call.

You're missing the closing parenthesis for the Hex() function.

It still should be:

While (PixelGetColor(649, 731) == 0xFFFFFF)


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.

Share this post


Link to post
Share on other sites

Thanks but its still not looping :)

Share this post


Link to post
Share on other sites

Thanks but its still not looping :)

Then the color you're looking for is incorrect or the coordinates are off.... because it will work as long as the color is true.

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.

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  
Followers 0