Jump to content

variable help ?


Kajmer
 Share

Recommended Posts

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 !

Link to comment
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

Link to comment
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 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

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
Link to comment
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 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

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

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...