Jump to content

Recommended Posts

Posted (edited)

I find it very weird:
if I run like this:
     Local $aCoord = PixelSearch($posX, $posY, $sizeX, $sizeY, '0xFF455E')

works fine!

If I run like this:
    Local $metaColor1 = '0xFF455E' or like this Local $metaColor1 = "0xFF455E" or Local $metaColor1 = "'0xFF455E'"
    Local $aCoord = PixelSearch($posX, $posY, $sizeX, $sizeY, $color)

it doesn't want to work! So something with variable is not working and yes if I print it out like this:
ConsoleWrite(@LF & $posX & ":"& $posY & ":"& $sizeX & ":" & $sizeY & ":" & $color&@LF)
771:80:833:151:0xFF455E

So I dont see the problem, maybe some of you people?

Edited by Daka
Posted

Maybe you should use $metaColor1 instead of $color in the PixelSearch?

If that was a typo, then try it without the quotes, because it's a number not a string.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

I was hoping for typo, but it is not. Next code calls function:

Local $metaColor1 = 0xFF455E
   ;check if meta therapy button is availible, visible?
   If ControlCommand("[CLASS:TFormResearchGR]", "", "[CLASS:"& $btn_meta_class &"; INSTANCE:"& $btn_meta_instance &"]", "IsVisible", "") Then
      dump("$btn_metaVisible is visible"&@LF)
      $btn_metaVisible = True
      ;if meta therapy button visable, then check if meta therapy button is green and red if good connection is with headphone
      $image_path = "images\meta-therapy-green-red.bmp"
      $text = "meta therapy button not green"
      ;dump("this is text"& $text & @LF)
      $buttonActivated1 = ifButtonActivated("[CLASS:TFormResearchGR]", $btn_meta_class, $btn_meta_instance, $metaColor1, False, True, $image_path, $text)
      dump("Activated meta button: " & $buttonActivated1)

And in that function, I call: PixelSearch and if I set the sting in this function like:
$metaColor1 = 0xFF455E and set that then it works, but if I set it before when calling function it doens not wont to work. This is weird. And if I Consolewrite it, string (number) is there :(

Func ifButtonActivated($window, $button, $instance, $metaButtonColor, $click = True, $msgBoxShow = True, $image_path = False, $text = False, $litoPhyto = False)
   ConsoleWrite(@LF & "function ifButtonActivated: " & @LF)
   ConsoleWrite("$window:" & $window &" $button: "& $button &" $instance: "& $instance &" $color: "& $metaButtonColor &@LF)
   ConsoleWrite('$image_path: '& $image_path & @LF)
   Local $buttonActivated = False
   Local $buttonCanceled = False
   Local $buttonNotActivated = False
   ;because even if you bioconnector is inbetween time connected the red button will not appear
   ;so we need to loop again
   Local $litoPhytoActivated = False
   ConsoleWrite($window & @LF)
   ConsoleWrite($button & @LF)
   ConsoleWrite($instance & @LF)

   ;if button exists, research button dont exists
   Do
      If ControlCommand($window, "", "[CLASS:"& $button &"; INSTANCE:"& $instance &"]", "IsEnabled", "") Then
    ConsoleWrite($window & "[CLASS:"& $button &"; INSTANCE:"& $instance &"]IsEnabled" & @LF)
         $aPos = ControlGetPos($window, "", "[CLASS:"& $button &"; INSTANCE:"& $instance &"]")
     ConsoleWrite("$aPos[2]" & $aPos[2] & @LF)
     ConsoleWrite("$aPos[3]" & $aPos[3] & @LF)
         $sizeX = $aPos[0] + $aPos[2] + 72
         $sizeY = $aPos[1] + $aPos[3]
     $posX = $aPos[0] + 72
     $posY = $aPos[1]


         ConsoleWrite("$posX:" & $posX & "$posY:" & $posY & "$sizeX" & $sizeX & "$sizeY:" & $sizeY & "$color" & $metaButtonColor &@LF)

         ; Find a pure red pixel in the range 0,0-20,300
     ConsoleWrite(@LF & $posX & ":"& $posY & ":"& $sizeX & ":" & $sizeY & ":" & $metaButtonColor&@LF)

     ConsoleWrite($metaButtonColor& @LF)
     ConsoleWrite(Int($metaButtonColor)& @LF)
         ;Local $aCoord = PixelSearch($posX, $posY, $sizeX, $sizeY, $color)
     $metaColor1 = 0xFF455E
     ConsoleWrite($metaColor1& @LF)
     ConsoleWrite(Int($metaColor1)& @LF)
     Local $aCoord = PixelSearch($posX, $posY, $sizeX, $sizeY, $metaButtonColor)

 

Posted

This is very weird, if I pass it to function the number is there, but Pixelcoordinate dont want to accept it!

How can I see what really get the pixelcoord? Because if I print out the string it is there!

Posted

I did also like set direct to function the string:
 

$buttonActivated1 = ifButtonActivated("[CLASS:TFormResearchGR]", $btn_meta_class, $btn_meta_instance, 0xFF455E, False, True, $image_path, $text)

or

$buttonActivated1 = ifButtonActivated("[CLASS:TFormResearchGR]", $btn_meta_class, $btn_meta_instance, Int(0xFF455E), False, True, $image_path, $text)

I find it very weird :(

Posted

if I set it as Global then it works perfect, but hen I dont pass it to function.

But I can't let go how can it be that passing it to function gives different results, this is not possible!

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
×
×
  • Create New...