Jump to content

4b0082

Active Members
  • Posts

    60
  • Joined

  • Last visited

Recent Profile Visitors

198 profile views

4b0082's Achievements

  1. I tried multiplying the results by 100 then comparing them but I'm still getting double as my variable and it's still processing the error. Edit: Nevermind! I forgot to wrap Int() around the new variable. It works now, thanks!
  2. I needed a way to round down and that's a snippet of code I found through the forums that worked. I'm not sure of another way to do it.
  3. For some reason I can't compare $rTotal and $Total properly. Both have a return value of "0.57" and are set as double variables, but when I compare the two I still get my error message. I've tried converting the variables with Number() but that didn't seem to change anything. Local $Total = .57 Local $SubTotal = Round($Total/1.15, 2) Local $rFee = FloorEx($SubTotal * 0.1, 2) + FloorEx($SubTotal * 0.05, 2) Local $rTotal = $SubTotal + $rFee If $rTotal <> $Total Then MsgBox(0, "Broken", VarGetType($Total)) EndIf Func FloorEx($fNumber, $iDec = 3) Return StringFormat("%." & $iDec & "f", Floor($fNumber * 10 ^ $iDec) / 10 ^ $iDec) EndFunc
  4. Bump, still need help with this.
  5. $sPD = 'item=1&price=2&quantity=3' ; Creating the object $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "https://website.com/123456789", False) $oHTTP.SetRequestHeader("Host", "website.com") $oHTTP.SetRequestHeader("Connection", "keep-alive") $oHTTP.SetRequestHeader("Accept", "*/*") $oHTTP.SetRequestHeader("Origin", "http://website.com") $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.45 Safari/537.36") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") $oHTTP.SetRequestHeader("Accept-Encoding", "gzip,deflate") $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.8,pt;q=0.6,es;q=0.4") ; Performing the Request $oHTTP.Send($sPD) ; Download the body response if any, and get the server status response code. $oReceived = $oHTTP.ResponseText MsgBox(4096, "Response code", $oReceived) I'm trying to submit an HTTP POST to an auction site, but I'm not getting the kind of response I'm expecting. I've never used HTTP POST before, so forgive my ignorance, but is there something wrong with this code where my header isn't being submitted?
  6. Thanks, I changed my "working in background" icon to the normal pointer. No way to just disable it while the script is running, though?
  7. I've got a script loading and closing several hidden IE windows in a loop, and every time my script loops my mouse flickers the loading circle (Win7). Is there any kind of work around for this? It's not really affecting me in any way, it's just distracting and a little annoying.
  8. Well, I'm not sure what the problem was - but it looks like it's gone now.
  9. It's monitoring the status of websites. I actually want to run this in hidden mode, but it's still interrupting my activity and I narrowed it down to the _IECreate and Navigate that's causing the problem. I still haven't found a solution; when I replace the working _IECreate with the one that's causing problems it still causes problems in the alternative script, so I'm not sure what the issue is. It's the same links, same website, same order, so it's got to be something about the code.
  10. I have two version of a script opening IE to load data, then closing - script 'a' opens IE in the background without dragging the application to the front and disrupting activity (scrolling, typing, etc.) - script 'b' opens IE in the foreground and disrupts activity. Why is script 'a' functioning differently than 'b'? Is there a way I can dictate that the script opens IE in the background so it won't interfere with whatever I'm doing while my program runs in the background? I've also tried replacing _IEQuit with ProcessClose("iexplore.exe") and it doesn't make a difference. Both these scripts would start at the same location in the main code, so I'm not sure why _IECreate is behaving so differently. Sorry ahead of time SmOke_N if this is related to the problem you mentioned in another thread. Edit: Also, setting $iTakeFocus to 0 doesn't change anything. Script A: For $cPage = 0 to $tPage-1 ; -- Opens and closes 5 IE, one at a time. $oIE = _IECreate($url[$cPage], 0, 0) Sleep(2000) _IEQuit($oIE) Next Script B: $oIE = _IECreate($url[0], 0, 0) ; -- Opens the first tab. For $cPage = 1 to $tPage-1 ; -- Opening 4 additional tabs. Sleep(2000) $oIE.Navigate($url[$cPage], 0x0800) Next For $cPage = 1 to $tPage-1 ; -- Close each tab. _IEQuit($tab[$cPage]) Next
  11. I'm not sure I actually understand _IEAttach to be honest, I read through your other post a bit and I think it sounds like _IEAttach has a problem with latching on to ANY instance it meets rather than a specific one, but I've read the docs and it still doesn't make complete sense about the proper and improper way to use it. Could you give a short example of a right and wrong way to use it?
  12. I found a solution, it's not great - but it works! I think. SmOke_N, could you tell me what problems I might run into using this script as an alternative? For $cPage = 0 to $tPage-1 $tab[$cPage] = _IEAttach($url[$cPage], "url") If Not (IsObj($tab[$cPage]) = True) Then Local $i = 0 Do $tab[$cPage] = _IEAttach($url[$cPage], "url") Sleep(500);;; This will let us $i += 1 ;;;;; wait 5 seconds before giving up! ConsoleWrite($i & @CRLF) Until (IsObj($tab[$cPage]) = True) OR $i = 10 ; If the page loads or we've timed out, move on EndIf ConsoleWrite("$tab[" & $cPage & "] is an object: " & (IsObj($tab[$cPage]) = True) & @CRLF) ; Checking to see results Next
  13. Your code is waiting for pages to load but still not finding the string I'm looking for, which I don't understand because the string search works fine when it's in a standalone AU3 with _IECreate to test it. I know you said my code is unstable, but is there really no better alternative to "_IELoadWait($tab[$tPage-1])" then having to include an entire new function? Your script is almost as long as my entire code. It's not really a problem but I've handwritten everything so I can hunt down exactly where changes need to be made, and importing another script just makes it more difficult to work with (like I said, I'm still learning).
  14. Edit: I added a Sleep before my IEAttach and they all output true, thanks for the debug. I'm not sure what "safer routine" you're referring to, but I did what I could with what was on the link you gave me. If there's a better way to do it I'd like to know, I'm still learning. $tab[0] is an object: True $tab[1] is an object: True $tab[2] is an object: True $tab[3] is an object: True $tab[4] is an object: True
×
×
  • Create New...