dedronek Posted April 30, 2016 Share Posted April 30, 2016 Hello guys, I created script which must click on object with classname on website and after it, copy phrase between two tags (I used IE.au3). Scripts work but not always. Sometime script loading page and when page is already load script dont click on object. Before it script dont crash itself. I dont know what is wrong :/ Please help me guys expandcollapse popup#include <Constants.au3> #include <IE.au3> #include <String.au3> #include <Array.au3> Opt("TrayIconDebug", 1) HotKeySet("{F9}", "kill") HotKeySet("{F10}", "pause") $zero = Null Func kill() Exit 0 EndFunc Func pause() $Paused = NOT $Paused While $Paused Sleep(100) Tooltip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc $i=0 Do nr() Until $i<-1 Func nr() $strona = FileReadLine("strony.txt",$i+1) $file = fileopen(@scriptdir & "\source.txt", 10) $IE = _IECreate($strona) _IELoadWait($IE,1,1) _IEAction($IE, "refresh") _IEAction($IE, "stop") $oInputs = _IETagNameGetCollection($IE, "span") Sleep(1000) For $oInput In $oInputs If $oInput.classname = "icon inlblk vtop b_phone4" Then _IEAction($oInput, "focus") If $oInput.classname = "icon inlblk vtop b_phone4" Then _IEAction($oInput, "click") If $oInput.classname = "link spoiler small nowrap" Then _IEAction($oInput, "focus") If $oInput.classname = "link spoiler small nowrap" Then _IEAction($oInput, "click") Next Sleep(1000) $source = _IEDocReadHTML($IE) FileWrite($file, $source) If (_StringBetween($source, '<strong class="xx-large">', '</strong>') <> 0) Then $target_source = _StringBetween($source, '<strong class="xx-large">', '</strong>') $numer = fileopen(@scriptdir & "\numer.txt", 1) FileWrite($numer, $target_source[0]) FileWrite($numer, @CRLF) FileClose($numer) $i+=1 _IEQuit($IE) Else $i+=1 _IEQuit($IE) EndIf EndFunc ;;$target_source = _StringBetween($source, '<strong class="xx-large">', '</strong>') Link to comment Share on other sites More sharing options...
Jfish Posted April 30, 2016 Share Posted April 30, 2016 Why do you refresh the page after you use loadwait? doesn't that defeat the purpose of waiting for it to load? Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
dedronek Posted April 30, 2016 Author Share Posted April 30, 2016 When I refresh page manual script sometimes starts work fine, but after some time script hangs again. I think it is problem with status IE. Link to comment Share on other sites More sharing options...
Jfish Posted April 30, 2016 Share Posted April 30, 2016 I think you need some debugging to see exactly what is happening. Right now it sounds like a bit of a guess ... Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
dedronek Posted May 1, 2016 Author Share Posted May 1, 2016 I looked on try icon and script hangs on IE.au3, Line 483, Sleep(100). Anyone can help me? Link to comment Share on other sites More sharing options...
Jfish Posted May 1, 2016 Share Posted May 1, 2016 (edited) It could be because you are only giving it 1 milisecond to check the status and to load: $iDelay [optional] Milliseconds to wait before checking status $iTimeout [optional] Period of time to wait before exiting function (default = 300000 ms aka 5 min) _IELoadWait($IE,1,1) Try ditching those two optional parameters and using the defaults (or something larger). Edit: and then to my earlier post I would remove that refresh because it will defeat the purpose of waiting (also not sure why you have "stop" ?) Edited May 1, 2016 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
dedronek Posted May 1, 2016 Author Share Posted May 1, 2016 I have solution. My problem resolved func _IELoadWaitTimeout() Thanks for your help 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