Sign in to follow this  
Followers 0
Kajmer

variable help ?

11 posts in this topic

Hey guys, im new in the Forums :)

So.. i got a question i tried to wrote an script that is looking for this variable =

$variable1 PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
If $variable1 = 0xB4FF00 Then = $variable2

So here is my fail If variable1 is True then i want it to do variable2, and if false it does nothing

Well here is my full script

While True
    $variable1 PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
    $variable2 PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
    
    If $variable = 0xB4FF00 Then = $variable2
       
      EndIf
    
       If $variable2 = 0xFFFFFF Then
      Send("{I}")
        Sleep(77)
    EndIf
WEnd

Hope u guys can help me :P thanks !

Share this post


Link to post
Share on other sites



This is the correct syntax for what I think you want to do. 

While True
    $variable1 = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
    $variable2 = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
    
    If $variable = 0xB4FF00 Then
        If $variable2 = 0xFFFFFF Then
            Send("{I}")
            Sleep(77)
        EndIf
    EndIf
WEnd

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

Welcome to AutoIt and the forum!

Can you please tell us which program you try to automate? Oftern there are faster and more reliable ways to do what you want  to do.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks for the quick replies,

@ Bowmore

it says Error at Line 5

If $variable = 0xB4FF00 Then

If ^ ERROR

Edit: i found the ERROR but the script doesnt work :)

 

@ water

I want the script to look for an color and if the color appears it looks for the 2nd color and if the 2nd color is there too it sends the key ' i '

so it only sends the key if both colors are on the screen it doesnt have to look at the first color first tho, both colors have just to be there 

 

Edit: If i try it with 1 color it works, but the 2nd color has to be there too otherwise it is not useable for me

 

So here is my script at the moment with no errors but still not working :)

 

While True
    $variable1 = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
    $variable2 = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
    
    If $variable1 = 0xB4FF00 Or $variable1 = 0xBFFD31 Then
        If $variable2 = 0xFFFFFF Then
            Send("{I}")
            Sleep(77)
        EndIf
    EndIf
WEnd
Edited by Kajmer

Share this post


Link to post
Share on other sites
@ water

I want the script to look for an color and if the color appears it looks for the 2nd color and if the 2nd color is there too it sends the key ' i '

so it only sends the key if both colors are on the screen it doesnt have to look at the first color first tho, both colors have just to be there 

That's what I've already seen from your code. But to which program do you want to send the string "{I}"?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

$variable1 & $variable2 are both using the PixelGetColor function with the same parameters.. So if the first If is true, the second If will always be false.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@ water

i can't understand why would u want to know that ?

That script will be used on a Programm,

The script would take alot of work

 

@ somdcomputerguy

So i could use 1 variable for both commands ?

Thanks for the replies !

Edited by Kajmer

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@ water

 

i can't understand why would u want to know that ?

That script will be used on a Programm,

The script would take alot of work

Why don't you want to tell us?

As I stated above: "Often there are faster and more reliable ways to do what you want  to do."

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

@ water

Lol :P you know what i am tryin to do, so if there would be some easyer ways u dont need to know in which Programm i will use it :)

Thanks for help anyways !

Share this post


Link to post
Share on other sites

Kajmer - Without further information people can only assume what it is you are trying to do. You seem like a reasonable person, so here's my suggestion: go and read the forum rules now.

Share this post


Link to post
Share on other sites

Kajmer,

Please read those Forum rules (there is also a link at bottom right of each page) before you post again - we do enforce them. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0