Kajmer Posted October 22, 2013 Share Posted October 22, 2013 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 thanks ! Link to comment Share on other sites More sharing options...
Bowmore Posted October 22, 2013 Share Posted October 22, 2013 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 More sharing options...
water Posted October 22, 2013 Share Posted October 22, 2013 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Kajmer Posted October 22, 2013 Author Share Posted October 22, 2013 (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 October 22, 2013 by Kajmer Link to comment Share on other sites More sharing options...
water Posted October 22, 2013 Share Posted October 22, 2013 @ 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
somdcomputerguy Posted October 22, 2013 Share Posted October 22, 2013 $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. Link to comment Share on other sites More sharing options...
Kajmer Posted October 22, 2013 Author Share Posted October 22, 2013 (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 October 22, 2013 by Kajmer Link to comment Share on other sites More sharing options...
water Posted October 22, 2013 Share Posted October 22, 2013 (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 October 22, 2013 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Kajmer Posted October 22, 2013 Author Share Posted October 22, 2013 @ water Lol 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 ! Link to comment Share on other sites More sharing options...
czardas Posted October 23, 2013 Share Posted October 23, 2013 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. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 23, 2013 Moderators Share Posted October 23, 2013 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. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts