Jump to content

GuiCtrlSetData inside Loop won't refresh data


Recommended Posts

You're only reading the location of the mouse once before it goes into the For loop, is that what you're intending?

Also, the controls you're reading from, are they in an AutoIt GUI or an external program?

Yes, that is why I have put everything in the loop, I have to do the check every mouseclick for 9 times, it's more convenient with a loop

i'm reading from an external program and store them in those GUICTRL

Link to comment
Share on other sites

You're checking the same mouse click location 9 times? For what? Does it change in between those clicks?

You're going to have to post a lot more code than just this function, because I have no idea what it is you're trying to do, your explanation is really vague as to what you're trying to do. Also, you can't use GUICtrlRead on an external (non-AutoIt) program, you'd need to use something else to read from an external control.

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

Link to comment
Share on other sites

You're checking the same mouse click location 9 times? For what? Does it change in between those clicks?

You're going to have to post a lot more code than just this function, because I have no idea what it is you're trying to do, your explanation is really vague as to what you're trying to do. Also, you can't use GUICtrlRead on an external (non-AutoIt) program, you'd need to use something else to read from an external control.

It doesn't check the same location, it checks every 18 pixels from the current Y axis

I'm reading the memory to get those values from the external program, it returns a correct value in my autoit script, I have tried already, here is the function that reads depending on the mouse coordinates

func GetOrderId()
OpenMemory()
$StaticOffset = dec("C50494")
Global $pid = ProcessExists("iexplore.exe")
Global $CUROffset[1]
$CUROffset[0] = 0
$baseADDR = _MemoryModuleGetBaseAddress($pid, "mlang.dll")
$finalADDR = $baseADDR + $StaticOffset
$MemTest = _MEMORYREAD($finalADDR, $openmem)
Return $MemTest
EndFunc   ;==>GetOrderId

Func LoadPrice()
$OrderID = GetOrderId()
Local $file = @ScriptDir & "Orders" & $OrderID & ".txt"
Local $fileopen = FileOpen(@ScriptDir & "Orders" & $OrderID & ".txt")
Local $filereadline = FileReadLine(@ScriptDir & "Orders" & $OrderID & ".txt")
Local $line = StringSplit(FileRead(@ScriptDir & "Orders" & $OrderID & ".txt"), @CR)
$size_bytes = FileGetSize(@ScriptDir & "Orders" & $OrderID & ".txt")
if $OrderID = 0 Then
  $OrderID2 = $OrderID
  Return
EndIf
if $OrderID = $OrderID2 Then
  Return
EndIf
$OrderID2 = $OrderID
$webpage = InetRead("http://127.0.0.1/Order.aspx?id=" & $OrderID)
;~ $webpage = 0
$webstring = BinaryToString($webpage)
if FileExists($file) Then
  $webstring = FileRead($fileopen)
  $newOrdervalue = $filereadline
Else
  $webstring = BinaryToString($webpage)
  $pos = StringInStr($webstring, "Price")
  $postocut = $pos + 28
  $trimmedleft = StringTrimLeft($webstring, $postocut)
  $pos2 = StringInStr($trimmedleft, " ")
  $newOrdervalue = StringMid($webstring, $postocut, $pos2)
Endif
$length = StringLen($newOrdervalue)
;~   $length = StringLen($newOrdervalue)

If $length > 3 then
  $tausender = StringTrimRight($newOrdervalue, 3)
  $htausender = StringTrimLeft($newOrdervalue, $length - 3)
  $newOrdervalue2 = $tausender & "" & $htausender
  GUICtrlSetData( Int($CTRL_OrderSell), Int($newOrdervalue2))
  $oldOrdervalue2 = $newOrdervalue
Else
  Number(GUICtrlSetData($CTRL_OrderSell, $newOrdervalue))
EndIf
;~   if FileExists($file) Then
;~    $webstring = FileRead($fileopen)
;~      $newOrdername = $filereadline
;~   Else
$pos3 = StringInStr($webstring, "Order-name")
$pos3tocut = $pos3 + 11
$trimmedleft2 = StringTrimLeft($webstring, $pos3tocut)
$pos4 = StringInStr($trimmedleft2, "")
$newOrdername = StringMid($webstring, $pos3tocut, $pos4)
GUICtrlSetData($CTRL_Nom, $newOrdername)
$oldOrdername = $newOrdername
;~   EndIf
if FileExists($file) Then
  FileClose($file)
Else
  FileWriteLine($file, $newOrdervalue)
  FileWriteLine($file, $newOrdername)
  FileClose($file)
EndIf
EndFunc   ;==>loadOrderprice
Edited by xanathos
Link to comment
Share on other sites

You are making no sense with your explanations and short code pieces, either post the whole script or stop bumping the thread, because I'm sure no one can figure out what you need, or what you're doing.

Post the script, the whole script and not just pieces of it. Tell us what program you're trying to get information from also, because you said it was an external program we need to know this.

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

Link to comment
Share on other sites

You are making no sense with your explanations and short code pieces, either post the whole script or stop bumping the thread, because I'm sure no one can figure out what you need, or what you're doing.

Post the script, the whole script and not just pieces of it. Tell us what program you're trying to get information from also, because you said it was an external program we need to know this.

No offence, but if you looked a little bit at my script, all your questions have been answered, like what I'm trying to do or what is the external program...Just a hint:
Global $pid = ProcessExists("iexplore.exe")
Edited by xanathos
Link to comment
Share on other sites

Ok so you're trying to get something out of IE, you can't use GUICtrlRead to get it from IE. What memory locations are you trying to read from that contains the information you need that clicking the web page is going to help you get, that's the part that makes no sense. You click somewhere on the page, you then read something from memory based upon clicking with the mouse? Have you looked at the IE UDF? Because that will probably work a lot better than scanning the memory for something.

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

Link to comment
Share on other sites

Ok so you're trying to get something out of IE, you can't use GUICtrlRead to get it from IE. What memory locations are you trying to read from that contains the information you need that clicking the web page is going to help you get, that's the part that makes no sense. You click somewhere on the page, you then read something from memory based upon clicking with the mouse? Have you looked at the IE UDF? Because that will probably work a lot better than scanning the memory for something.

Actually that's a school project that has some requirements, and one of them is to use memory reading on a web browser

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

  • Recently Browsing   0 members

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