xanathos Posted May 12, 2012 Share Posted May 12, 2012 (edited) Hello everyoneI'm having a little problemHere is a part of my code:Func MouseScan() Local $count = 0 Local $expensive = Number(GUICtrlRead($CTRL_OrderSell)) < GUICtrlRead($CTRL_OrderBuy) Local $cheap = Number(GUICtrlRead($CTRL_OrderSell)) > GUICtrlRead($CTRL_OrderBuy) $x = MouseGetPos(0) $y = MouseGetPos(1) For $count = 0 to 9 step 1 Local $Box = _MemoryRead($ADDR_MsgBoxSell, $openmem, "word") MouseClick("left", MouseGetPos(0), MouseGetPos(1)-35, 2) GuiCtrlSetData($CTRL_MsgBoxSell, number($box)) If $expensive = 1 then Send("{ESC}") EndIf Next EndFuncHere is what I wanna do:1. Click on some part of the screen2. When the msgbox pops, I want to compare 2 values from 2 inputbox ($CTRL_OrderSell and $CTRL_OrderBuy)3. If no msgbox appears (value is stored in $CTRL_MsgBoxSell 1 if the msgbox is there / 0 if it's not), it moves to y-354. If $CTRL_OrderSell < $CTRL_OrderBuy it presses ESC and moves to y-355. If $CTRL_OrderSell > $CTRL_OrderBuy it presses ENTER and moves to y-35 (not in the code yet, since I'm having a problem from the previous step already)6. Loop that until $count = 9 after that executes another function (another mousemove) and after the function has been executed repeat from step 1Here is what happens:Since it's in a loop, it won't "refresh" the values in their respective inputbox until the loop has been executed (therefore the comparison between OrderSell and OrderBuy fails)I'm a bit lost... Edited May 31, 2012 by xanathos Link to comment Share on other sites More sharing options...
kaotkbliss Posted May 12, 2012 Share Posted May 12, 2012 simply re evaluate the variable at the point you need it refreshed if you guictrlsetdata at some point, then later a new guictrlread should get your new values. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
xanathos Posted May 12, 2012 Author Share Posted May 12, 2012 (edited) simply re evaluate the variable at the point you need it refreshed if you guictrlsetdata at some point, then later a new guictrlread should get your new values. Look closely, this is what I'm already doing MouseClick("left", MouseGetPos(0), MouseGetPos(1)-35, 2) GuiCtrlSetData($CTRL_MsgBoxSell, number($box)) If $expensive = 1 then $expensive already guictrlread after guictrlsetdata... I need it refreshed like 1 second after mouseclick has been executed, so I put it inside the loop after mouseclick, but then problem is, that it doesn't get refreshed until the whole loop has ended... Edited May 12, 2012 by xanathos Link to comment Share on other sites More sharing options...
xanathos Posted May 12, 2012 Author Share Posted May 12, 2012 Bump Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 12, 2012 Moderators Share Posted May 12, 2012 xanathos, Please do not bump your posts within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. 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...
xanathos Posted May 13, 2012 Author Share Posted May 13, 2012 (edited) Still looking for some help... Edited May 13, 2012 by xanathos Link to comment Share on other sites More sharing options...
kaotkbliss Posted May 14, 2012 Share Posted May 14, 2012 You're reading OrderBuy and OrderSell but in the script you posted, you aren't changing their data You change MsgBoxSell but you never read that controll in your script you posted. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
xanathos Posted May 15, 2012 Author Share Posted May 15, 2012 You're reading OrderBuy and OrderSellbut in the script you posted, you aren't changing their dataYou change MsgBoxSell but you never read that controll in your script you posted.They are being set by another function which is being called in the main gui loop (I even tried to call that same function inside the loop of the MouseScan() function, but It still won't refresh Link to comment Share on other sites More sharing options...
kaotkbliss Posted May 15, 2012 Share Posted May 15, 2012 Ok, so you want to update your ordersell and order buy right after the mouseclick but you do not set the data for those 2 controls you will probably need to do a bit of rewriting... put the updating of those controls into a seperate function, then call that function anywhere in the script where you need to update those controls. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
xanathos Posted May 15, 2012 Author Share Posted May 15, 2012 Ok, so you want to update your ordersell and order buy right after the mouseclick but you do not set the data for those 2 controlsyou will probably need to do a bit of rewriting...put the updating of those controls into a seperate function, then call that function anywhere in the script where you need to update those controls.I did that already; with no luck... Link to comment Share on other sites More sharing options...
kaotkbliss Posted May 15, 2012 Share Posted May 15, 2012 (edited) it would be something like: MouseClick("left", MouseGetPos(0), MouseGetPos(1)-35, 2) _your_set_buy_and_sell_function() $expensive = Number(GUICtrlRead($CTRL_OrderSell)) < GUICtrlRead($CTRL_OrderBuy) $cheap = Number(GUICtrlRead($CTRL_OrderSell)) > GUICtrlRead($CTRL_OrderBuy) GuiCtrlSetData($CTRL_MsgBoxSell, number($box)) If $expensive = 1 then *edit* I noticed that in your $expensive and $cheap, you are only converting the first guictrlread to a number and not the read after the < and > signs. Edited May 15, 2012 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
xanathos Posted May 15, 2012 Author Share Posted May 15, 2012 (edited) Func MouseScan() ;~ $expensive = GUICtrlRead($CTRL_OrderSell) < GUICtrlRead($CTRL_OrderBuy) ;~ $cheap = GUICtrlRead($CTRL_OrderBuy) < GUICtrlRead($CTRL_OrderSell) $x = MouseGetPos(0) $y = MouseGetPos(1) $count = 0 For $count = 0 to 8 step 1 $expensive = Number(GUICtrlRead($CTRL_OrderSell)) < Number(GUICtrlRead($CTRL_OrderBuy)) $cheap = Number(GUICtrlRead($CTRL_OrderBuy)) < Number(GUICtrlRead($CTRL_OrderSell)) MouseClick("left", MouseGetPos(0), MouseGetPos(1) - 38, 2) LoadPrice() FindValueInString() MemReadMsgBox() ;~ compare() sleep(1000) If $expensive = 1 AND GUICtrlRead($CTRL_MsgBoxSell) = '1' then Sleep(2000) Send("{ESC}") EndIf ;~ If $cheap = 1 AND GUICtrlRead($CTRL_MsgBoxSell) = '1' Then ;~ sleep(500) ;~ Msgbox(0, "Han", "Cours l'acheter!") ;~ Send("{ESC}") ;~ EndIf Next ;~ ExitLoop EndFunc ;==>MouseScan Here is the LoadPrice() func, that sets the input for $OrderSell: expandcollapse popupFunc 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 Still no luck Edited May 24, 2012 by xanathos Link to comment Share on other sites More sharing options...
xanathos Posted May 16, 2012 Author Share Posted May 16, 2012 Bump for more help please Link to comment Share on other sites More sharing options...
xanathos Posted May 19, 2012 Author Share Posted May 19, 2012 bump Link to comment Share on other sites More sharing options...
xanathos Posted May 24, 2012 Author Share Posted May 24, 2012 (edited) Would still appreciate some help please Edited May 24, 2012 by xanathos Link to comment Share on other sites More sharing options...
xanathos Posted May 28, 2012 Author Share Posted May 28, 2012 up Link to comment Share on other sites More sharing options...
xanathos Posted May 29, 2012 Author Share Posted May 29, 2012 I don't know if that's because my question is too complicated but since I've seen way more complicated problems getting solved I don't think so, but I don't know why my thread is not getting any answer...I'm not asking for a complete solution but any help or hint would be appreciated Link to comment Share on other sites More sharing options...
BrewManNH Posted May 29, 2012 Share Posted May 29, 2012 You haven't said what you need help with, try explaining better what you're trying to do that doesn't work right. 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 GudeHow 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 More sharing options...
xanathos Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) You haven't said what you need help with, try explaining better what you're trying to do that doesn't work right. Func MouseScan() ;~ $expensive = GUICtrlRead($CTRL_Revente) < GUICtrlRead($CTRL_Achat) ;~ $cheap = GUICtrlRead($CTRL_Achat) < GUICtrlRead($CTRL_Revente) $x = MouseGetPos(0) $y = MouseGetPos(1) For $count = 1 to 9 step 1 $expensive = Number(GUICtrlRead($CTRL_Revente)) < Number(GUICtrlRead($CTRL_Achat)) $cheap = Number(GUICtrlRead($CTRL_Achat)) < Number(GUICtrlRead($CTRL_Revente)) MouseClick("left", MouseGetPos(0), MouseGetPos(1) - 38, 2) loaditemprice() FindValueInString() MemReadMsgBox() ;~ compare() sleep(1000) If $expensive = 1 AND GUICtrlRead($CTRL_MsgBoxSell) = '1' then Sleep(2000) Send("{ESC}") EndIf ;~ If $cheap = 1 AND GUICtrlRead($CTRL_MsgBoxSell) = '1' Then ;~ sleep(500) ;~ Msgbox(0, "Han", "Cours l'acheter!") ;~ Send("{ESC}") ;~ EndIf Next ;~ ExitLoop EndFunc ;==>MouseScan My script compares 2 values from 2 guicrtls; basically if my ordersell guictrl is > to orderbuy guictrl it should press ESC key and continue to next Y-18 from where it stopped, they are placed in a loop, depending on where my mouse is placed, that value changes, problem is that until the loop has not ended it will not return the correct value from where the mouse is... Edited May 30, 2012 by xanathos Link to comment Share on other sites More sharing options...
BrewManNH Posted May 30, 2012 Share Posted May 30, 2012 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? 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 GudeHow 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now