AlienStar Posted May 17, 2018 Share Posted May 17, 2018 (edited) hello everybody I make a script to auto publish posts on wordpress blog firstly the script works fine but suddenly the function Local $oIE =_IECreate($url) opened a blank web page instead of my url , and up to now the problem is found with this error : --> IE.au3 T3.0-1 Error from function _IENavigate, $_IESTATUS_COMError (-2147352567) please help me Edited May 17, 2018 by AlienStar Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2018 Share Posted May 17, 2018 Looks like you are running an older version of Autoit. What version are you running? Can you try updating to the latest version? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 17, 2018 Author Share Posted May 17, 2018 I use v3.3.12.0 Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2018 Share Posted May 17, 2018 That's fairly old. I believe this bug is resolved in the latest versions. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 17, 2018 Author Share Posted May 17, 2018 I've updated to the latest version then it sends me this error "C:\Program Files (x86)\AutoIt3\Include\IE.au3" (272) : ==> The requested action with this object has failed.: $oObject.navigate($sUrl) $oObject^ ERROR ->00:52:31 AutoIt3.exe ended.rc:1 +>00:52:31 AutoIt3Wrapper Finished. >Exit code: 1 Time: 6.098 Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2018 Share Posted May 17, 2018 Please show us your code or at least a reproducer script so that we can get a better understanding of why this is occurring. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 17, 2018 Author Share Posted May 17, 2018 (edited) here is my full code expandcollapse popup#include <IE.au3> #include <array.au3> #Include <File.au3> #include <MsgBoxConstants.au3> local $files = _FileListToArrayRec(@ScriptDir, "*.txt", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT) for $i = 1 to UBound($files)-1 ;------------------------------------------------ Local $content = FileRead($files[$i]) ;------------------------------------------------ Local $url = "https://engnajjar.wordpress.com/wp-admin/post-new.php?content="&_URIEncode($content) Local $oIE =_IECreate($url);,0,0) ;------------------------------------------------ _IELoadWait($oIE) ;------------------------------------------------ Local $title = _IEGetObjById($oIE, "title") ;$ttlcntnt content title Local $ttlcntnt = FileReadLine($files[$i], 1) if StringLen($ttlcntnt)=0 Then $ttlcntnt = FileReadLine($files[$i], 2) EndIf _IEFormElementSetValue($title, $ttlcntnt) ;------------------------------------------------ TrayTip($i&"/"&(UBound($files) - 1), $ttlcntnt ,0) ;------------------------------------------------ $ip = (100/UBound($files))*$i ProgressSet($ip, "%" &Round($ip,0) & " | " &$i &"/"&UBound($files)) ;------------------------------------------------ Local $Category_ID = "in-category-2" Local $chkbx = _IEGetObjById($oIE, $Category_ID ) _IEAction($chkbx, "click") ;------------------------------------------------ Local $oSubmit = _IEGetObjById($oIE,"publish") Local $oTag = _IEGetObjById($oIE,"new-tag-post_tag") ;------------------------------------------------ Local $Tags_arr[0] $ttlcntnt = StringSplit($ttlcntnt," ") for $t in $ttlcntnt _ArrayAdd($Tags_arr,$t) Next ;-------------- Local $Tags = "" for $tg = UBound($Tags_arr)-1 to 1 step -1 $Tags =$Tags&", "&$Tags_arr[$tg] next $Tags = StringTrimLeft($Tags ,1) ;-------------- _IEFormElementSetValue($oTag, $Tags) ;------------------------------------------------ _IEAction($oSubmit, "click") ;------------------------------------------------ _IELoadWait($oIE) ;------------------------------------------------ _IEQuit($oIE) ProcessClose("iexplore.exe") next ProgressSet(100, "Done", "Complete") ProgressOff() Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"") Local $nChar $sData="" For $i = 1 To $aData[0] ; ConsoleWrite($aData[$i] & @CRLF) $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar,2) EndSwitch Next Return $sData EndFunc Edited May 17, 2018 by AlienStar Link to comment Share on other sites More sharing options...
AlienStar Posted May 17, 2018 Author Share Posted May 17, 2018 I just wanna know why it works fine before , then it stopped !! Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2018 Share Posted May 17, 2018 IDK. But you're missing an ampersand in this line -- Local $url = "https://engnajjar.wordpress.com/wp-admin/post-new.php?content="_URIEncode($content) and there also appears to be an issue with this line ($post_Category is undefined) -- Local $Category_ID = "in-category-"&$post_Category AlienStar 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 17, 2018 Author Share Posted May 17, 2018 Just now, Danp2 said: IDK. But you're missing an ampersand in this line -- Local $url = "https://engnajjar.wordpress.com/wp-admin/post-new.php?content="_URIEncode($content) and there also appears to be an issue with this line ($post_Category is undefined) -- Local $Category_ID = "in-category-"&$post_Category I put $content in my code , you can see it again Local $content = FileRead($files[$i]) also for $post_Category I get it by inputbox so I delete it then set a number instead of $post_Category you can re-read my code after editing Link to comment Share on other sites More sharing options...
AlienStar Posted May 17, 2018 Author Share Posted May 17, 2018 sorry when I copied the code I've forgotten "&" before the function _URIEncode($content) I've edited the reply Link to comment Share on other sites More sharing options...
Danp2 Posted May 17, 2018 Share Posted May 17, 2018 Does the error occur on the initial pass of your For loop? If not, then you may want to change your logic to only call _IECreate / _IEQuit once (outside of your For loop). You would then call _IENavigate in place of _IECreate (inside the For loop). Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 17, 2018 Author Share Posted May 17, 2018 I've detected the problem the error is related to the function _URIEncode($content) because of the content of the text file the new text files contain a lot of "-" as lines like this : XXXXXXXX tel: 0123456789 Fax: 0123456789 ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ ـ and these "-" make the error thanks my friend @Danp2 for this discussion 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