Jump to content

Loop problems


Recommended Posts

Hi w3scools. 1st of all this is my first post.normaly the main page is help enough for me, but this time it wasn't :) .I Use Samurize (for those of you who don't know it, it graps information and puts it on your desktop)then I Use MyPhoneExplorer. A program that tells me various information about my phone. I figured out where in the log I can find The temperature.mobpc3.jpg I am mainly intersted in the percentage of power on the battery and the temperatures. By using bits of old scripts I've made, I came up with this:

URL = "C:\Programmer\MyPhoneExplorer\Debug.txt"Private Function GetHTML(URL)   Dim objXMLHTTP,HTML   Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")   Set objRS = CreateObject("ADODB.Recordset")   objXMLHTTP.Open "GET", URL, False   objXMLHTTP.Send   HTML = objXMLHTTP.responseBody   objRS.Fields.Append "txt", 200, 45000, &H00000080   objRS.Open   objRS.AddNew   objRS.Fields("txt").AppendChunk HTML   GetHTML = objRS("txt").ValueEnd FunctionFunction LocateInfo()   HTML = GetHTML(URL)   StartString = "[RX]: *EBCA: "   StartInfo = InStrRev(HTML, SearchString, -1) + Len(StartString)   Endstring = ","   for i = 1 to 13   Endinfo = InStr(StartInfo,HTML,Endstring)   Data = Mid(HTML,StartInfo, Endinfo-StartInfo)   StartInfo = Endinfo + Len(Data) + 1   next   End Function

Here are the last couple of lines from the log:

00:30:51.85 [RX]: +COPS: 0,0,"DK SONOFON"00:30:51.87 [RX]: OK00:30:56.87 [TX]: AT*EBCA=100:30:57.10 [RX]: AT*EBCA=100:30:57.10 [RX]: *EBCA: 3901,4100,0,0,26,25,0,7,617,68,273,0,579,000:30:57.17 [RX]: OK00:30:57.17 [TX]: AT*EBCA=000:30:57.35 [RX]: AT*EBCA=000:30:57.35 [RX]: OK00:30:57.37 [TX]: AT+CSQ00:30:57.60 [RX]: AT+CSQ00:30:57.60 [RX]: +CSQ: 14,9900:30:57.62 [RX]: OK00:30:57.64 [TX]: AT+COPS?00:30:57.78 [RX]: AT+COPS?00:30:57.78 [RX]: +COPS: 0,0,"DK SONOFON"00:30:57.78 [RX]: OK00:31:02.78 [TX]: AT*EBCA=100:31:03.03 [RX]: AT*EBCA=100:31:03.03 [RX]: *EBCA: 3901,4100,0,0,26,25,0,7,617,68,273,0,579,000:31:03.09 [RX]: OK00:31:03.09 [TX]: AT*EBCA=000:31:03.28 [RX]: AT*EBCA=000:31:03.28 [RX]: OK00:31:03.29 [TX]: AT+CSQ

Any suggestions on how I can obtain this informaiton, useing LoopingI hope I have given enough information, and I hope some of you can at least give me a hint on what to doJakob. :)

Link to post
Share on other sites

I've made a solution myself ... But without looping.

Private Function GetHTML()   Dim objXMLHTTP,HTML   Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")   Set objRS = CreateObject("ADODB.Recordset")   objXMLHTTP.Open "GET", "C:\Programmer\MyPhoneExplorer\Debug.txt", False   objXMLHTTP.Send   HTML = objXMLHTTP.responseBody   objRS.Fields.Append "txt", 200, 45000, &H00000080   objRS.Open   objRS.AddNew   objRS.Fields("txt").AppendChunk HTML   GetHTML = objRS("txt").ValueEnd FunctionPrivate Function GetLink()   HTML = GetHTML()   StartString = "*EBCA: "   StartLink = InStrRev(HTML, StartString) + Len(StartString)   EndString = ":"   EndLink = InStr(StartLink, HTML, EndString) -4   Link = Mid(HTML, StartLink, EndLink-StartLink)   GetLink = LinkEnd FunctionFunction Spaending_pr_V()   HTML = GetLink()   Seperator = ","   Shift = InStr(HTML, Seperator)   Value = Mid(HTML,1, Shift)   Spaending_pr_V = Value/1000End FunctionFunction LadeSpaending_pr_V()   HTML = GetLink()   Seperator = ","   Jump = InStr(1,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   LadeSpaending_pr_V = Value/1000End FunctionFunction Ladestroem_pr_mA()   HTML = GetLink()   Seperator = ","   Jump2 = InStr(1,HTML,Seperator)+1   Jump = InStr(Jump2,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   Ladestroem_pr_mA = Value/10000End FunctionFunction Unknown1()   HTML = GetLink()   Seperator = ","   Jump3 = InStr(1,HTML,Seperator)+1   Jump2 = InStr(Jump3,HTML,Seperator)+1   Jump = InStr(Jump2,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   Unknown1 = ValueEnd FunctionFunction Batteritemperatur_pr_C()   HTML = GetLink()   Seperator = ","   Jump4 = InStr(1,HTML,Seperator)+1   Jump3 = InStr(Jump4,HTML,Seperator)+1   Jump2 = InStr(Jump3,HTML,Seperator)+1   Jump = InStr(Jump2,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   Batteritemperatur_pr_C = ValueEnd FunctionFunction Telefontemperatur_pr_C()   HTML = GetLink()   Seperator = ","   Jump5 = InStr(1,HTML,Seperator)+1   Jump4 = InStr(Jump5,HTML,Seperator)+1   Jump3 = InStr(Jump4,HTML,Seperator)+1   Jump2 = InStr(Jump3,HTML,Seperator)+1   Jump = InStr(Jump2,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   Telefontemperatur_pr_C = ValueEnd FunctionFunction Unknown2()   HTML = GetLink()   Seperator = ","   Jump6 = InStr(1,HTML,Seperator)+1   Jump5 = InStr(Jump6,HTML,Seperator)+1   Jump4 = InStr(Jump5,HTML,Seperator)+1   Jump3 = InStr(Jump4,HTML,Seperator)+1   Jump2 = InStr(Jump3,HTML,Seperator)+1   Jump = InStr(Jump2,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   Unknown2 = ValueEnd FunctionFunction Unknown3()   HTML = GetLink()   Seperator = ","   Jump7 = InStr(1,HTML,Seperator)+1   Jump6 = InStr(Jump7,HTML,Seperator)+1   Jump5 = InStr(Jump6,HTML,Seperator)+1   Jump4 = InStr(Jump5,HTML,Seperator)+1   Jump3 = InStr(Jump4,HTML,Seperator)+1   Jump2 = InStr(Jump3,HTML,Seperator)+1   Jump = InStr(Jump2,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   Unknown3 = ValueEnd FunctionFunction Unknown4()   HTML = GetLink()   Seperator = ","   Jump8 = InStr(1,HTML,Seperator)+1   Jump7 = InStr(Jump8,HTML,Seperator)+1   Jump6 = InStr(Jump7,HTML,Seperator)+1   Jump5 = InStr(Jump6,HTML,Seperator)+1   Jump4 = InStr(Jump5,HTML,Seperator)+1   Jump3 = InStr(Jump4,HTML,Seperator)+1   Jump2 = InStr(Jump3,HTML,Seperator)+1   Jump = InStr(Jump2,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   Unknown4 = ValueEnd FunctionFunction Battery_percent()   HTML = GetLink()   Seperator = ","   Jump9 = InStr(1,HTML,Seperator)+1      Jump8 = InStr(Jump9,HTML,Seperator)+1   Jump7 = InStr(Jump8,HTML,Seperator)+1   Jump6 = InStr(Jump7,HTML,Seperator)+1   Jump5 = InStr(Jump6,HTML,Seperator)+1   Jump4 = InStr(Jump5,HTML,Seperator)+1   Jump3 = InStr(Jump4,HTML,Seperator)+1   Jump2 = InStr(Jump3,HTML,Seperator)+1   Jump = InStr(Jump2,HTML,Seperator)+1   Shift = InStr(Jump, HTML, Seperator)   Value = Mid(HTML,Jump,Shift-Jump)   Battery_percent = ValueEnd Function

I am still interested if anyone knows how to loop this insteadJakob

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...