Tripoz Posted July 29, 2015 Posted July 29, 2015 (edited) hi, i have a code like this :--edit--how to make $Span.InnerHTML to array so i can collect 30 output from $Span.InnerHTML and calculate it for Maximal Value and Minimal Value of it. Edited August 8, 2015 by Tripoz
kylomas Posted July 29, 2015 Posted July 29, 2015 (edited) Tripoz,The value I get from $Span is a 3.4 number (e.g.707.9264). You have many choices:1 - write the values to a file then read the file to an array for processing2 - write the values to a delimited string then split on that delimiter3 - write the values to an array directlyWhich way you choose has to do with volume and processing.Incidentally,until NOT ISobj($SPan)will not stop your do loop.kylomasedit: point 3 should read "values" not "files" Edited July 29, 2015 by kylomas clarification Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Tripoz Posted July 29, 2015 Author Posted July 29, 2015 Tripoz,The value I get from $Span is a 3.4 number (e.g.707.9264). You have many choices:1 - write the values to a file then read the file to an array for processing2 - write the values to a delimited string then split on that delimiter3 - write the files to an array directlyWhich way you choose has to do with volume and processing.Incidentally,until NOT ISobj($SPan)will not stop your do loop.kylomashi @kylomashmm.. what i must do if i want that the processing is in inside the program itself (not use/open another file).can u give me some example bro?for the Stoping loop, yeah im still have some issue with that but my focus is still on "Capturing the $Span" i will fix it later.
kylomas Posted July 30, 2015 Posted July 30, 2015 Tripoz,I cleaned up much of your code and rearranged some of it, particularly the way you were managing IE objects. This is just example code for you to build on, not a complete solution.expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <IE.au3> #include <date.au3> ; on exit cleanup the instance of IE OnAutoItExitRegister('terminate') Global $URL = "https://www.binary.com/c/trade.cgi?market=random&time=5t&form_name=risefall&expiry_type=duration&amount_type=stake&H=S0P¤cy=USD&underlying_symbol=R_50&amount=1&date_start=now&type=CALL&l=EN" ; create instance of IE ; attach to existing instance if possible ; not visible ; wait for page to load Global $oIE = _IECreate($URL, 1, 0) $Form1_1 = GUICreate("Bedebah", 200, 200) $Input12 = GUICtrlCreateLabel("", 70, 20, 50, 20, $SS_CENTER, $WS_EX_STATICEDGE) $Label26 = GUICtrlCreateLabel("SPOT :", 20, 20, 50, 20) $Button1 = GUICtrlCreateButton("RUN", 20, 150, 160, 30) GUICtrlSetFont(-1, 16, 800, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000000) $Button2 = GUICtrlCreateButton("Process Spot Values", 20, 100, 160, 20) GUISetState(@SW_SHOW) Global $aSpot[30], $sSaveSpot, $Span, $idx = 0 While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $Button1 GUICtrlSetData($Button1, (GUICtrlRead($Button1) = 'Run' ? 'Stop' : 'Run')) ; toggle button text case $nMsg = $Button2 ; do whatever you want with the array, in this case, just display it _arraydisplay($aSpot,'Spot Values') Case $nMsg = $GUI_EVENT_CLOSE Exit EndSelect ; This routine gets run for every iteration of the message loop (appx every 10 millisecs). If GUICtrlRead($Button1) = 'Stop' Then if $idx = 30 then guictrlsetdata($Input12,'Array Full') ContinueLoop endif $Span = _IEGetObjById($oIE, "spot") ; try to get object If Not IsObj($Span) Then ContinueLoop ; if no object then continue message loop if $sSaveSpot = $Span.innerHTML then continueloop ; if the object is the same as last time then continue message loop GUICtrlSetData($Input12, $Span.innerHTML) ; populate label... $aSpot[$idx] &= _now() & ' - ' & $Span.innerHTML ; and array... $sSaveSpot = $Span.innerHTML ; and compare variable $idx += 1 ; increment array pointer EndIf WEnd Func terminate() If IsObj($oIE) Then $oIE.quit EndFunc ;==>terminatekylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Tripoz Posted July 30, 2015 Author Posted July 30, 2015 (edited) @kylomas damnn man..ur so nice... thx alot for helping me out..but i still newbie here.. n i want to learn more n more...so my code for managing IE are not right, right ? especially for ieattach right?once again thx so much..i will combine with what i need... Edited August 8, 2015 by Tripoz
kylomas Posted July 30, 2015 Posted July 30, 2015 (edited) Multiple IE objects was one problem. Looping on the Spot object was another. General code organization was a third.If you have any problems, just ask. Please make sure that you run the example and understand what it is doing and why.kylomasEdit: Also, please don't quote from previous threads. It just burns space for no good reason. Edited July 30, 2015 by kylomas additional info Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Tripoz Posted July 30, 2015 Author Posted July 30, 2015 @kylomasok bro..sorry for that quote then..where i can learn about code organization? n my degree isn't in computer.I just make script started with "What Function that i want to make" it first...and then i will adding one n another function.but when the func getting bigger n much it blown my head..lol..
kylomas Posted July 30, 2015 Posted July 30, 2015 Tripoz,If you are not doing this professionally then your best bet is to look at examples on the forum. One of the best things that you can do for yourself as a beginner is to think the problem through and lay it down functionally on paper. Start with high level functions and fill in specifics, including data flows as you expand the detail in each function. This assumes that you have a basic knowledge of how Windows message loops work.Sorry I cannot offer more without getting into a massive tutorial.kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Tripoz Posted July 30, 2015 Author Posted July 30, 2015 @kylomasbtw thanks bro..ur helping me so much.... Thanks..
Tripoz Posted August 5, 2015 Author Posted August 5, 2015 (edited) i tried to modif @kylomas's code.--edited--the idea is every 5 array it will calculate array[1] and array[3].how to make this happen?thanks Edited August 11, 2015 by Tripoz
kylomas Posted August 5, 2015 Posted August 5, 2015 Tripoz,This is the point where you need to think through exactly what results you want to arrive at. This will have a bearing on how you do it. Also, if you are taking away the throttle for 30 entries then you will need to manage the array.E.G.:1 - what are you going to do with the calcs?2 - Does the script run continuously?etc.kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Tripoz Posted August 6, 2015 Author Posted August 6, 2015 @kylomas1. Its just substract calc2. I will make the code collect 5array and then calculate it. If the result is negative it will repeat the process untill the result is positif numbers.Thx
Tripoz Posted August 6, 2015 Author Posted August 6, 2015 (edited) i tried myself n got what i want before..---edited---the next question is How to use _ArrayMax() in every 5 Array that i collect above. Edited August 8, 2015 by Tripoz self solved
Tripoz Posted August 6, 2015 Author Posted August 6, 2015 (edited) how to make my program running twice or more??i try to run this code :--edited--but just could running for 1 time. after that i got error code : --editedhow to fix this? Edited August 11, 2015 by Tripoz secret code btw
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