caramen Posted January 7, 2021 Share Posted January 7, 2021 Show us the complete code you're using. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
AlienStar Posted January 10, 2021 Author Share Posted January 10, 2021 (edited) On 1/7/2021 at 1:06 PM, caramen said: Show us the complete code you're using. here is the main part : expandcollapse popupFunc pblsh_action() ProgressOn("progress", "in pending ...", "", @DesktopWidth - 320, @DesktopHeight - 175, $DLG_MOVEABLE) ;============================================ For $iplsh = 0 To UBound($rslt_pblsh) - 1 ;------------------------------------------ Local $ip = (100 / UBound($rslt_pblsh)) * $iplsh ProgressSet($ip, Round($ip, 0) & "% - " & $iplsh & "/" & UBound($rslt_pblsh)) ;------------------------------------------ Local $var_pblsh = StringSplit($rslt_pblsh[$iplsh], "_") ;------------------------------------------ Local $Site_loginlnk = $var_pblsh[4] Local $Sitelnk_pblshd_ex = StringSplit($Site_loginlnk, "/") Local $Sitelnk_pblshd = $Sitelnk_pblshd_ex[1] & "//" & $Sitelnk_pblshd_ex[3] ;------------------------------------------ Local $Site_pblshd_categ_ID = $var_pblsh[8] ;------------------------------------------ Local $url = $Sitelnk_pblshd & "/wp-admin/post-new.php" If $IE_sing = "" Then Local $oIE = _IECreate($url, 0, $IE_visible) $IE_sing = True Else _IENavigate($oIE, $url) EndIf ;------------------------------------------ ProcessSetPriority("iexplore.exe", 4) _CHCK_IP() _IELoadWait($oIE, 1000) ;================================================ Do Local $HTML_cntnt = _IEGetObjById($oIE, "content-html") ;------------------------------ Local $title = _IEGetObjById($oIE, "title") Local $oText = _IEGetObjById($oIE, "content") Local $Category_ID = "in-category-" & $Site_pblshd_categ_ID Local $chkbx = _IEGetObjById($oIE, $Category_ID) Local $oSubmit = _IEGetObjById($oIE, "publish") Local $oTag = _IEGetObjById($oIE, "new-tag-post_tag") Local $Featured_img_Id = _IEGetObjById($oIE, "fifu_input_url") ;----------------------------------------------- ConsoleWrite("$HTML_cntnt: " & IsObj($HTML_cntnt) & @CRLF & _ "$Visual_cntnt: " & IsObj($Visual_cntnt) & @CRLF & _ "$title: " & IsObj($title) & @CRLF & _ "$oText: " & IsObj($oText) & @CRLF & _ "$chkbx: " & IsObj($chkbx) & @CRLF & _ "$oSubmit: " & IsObj($oSubmit) & @CRLF & _ "$oTag: " & IsObj($oTag) & @CRLF & _ "$Featured_img_Id: " & IsObj($Featured_img_Id)) ;----------------------------------------------- Sleep(100) Until IsObj($HTML_cntnt) And IsObj($title) And IsObj($oText) And IsObj($chkbx) And IsObj($oSubmit) And IsObj($oTag) And IsObj($Featured_img_Id) ;================================================ If IsObj($Featured_img_Id) Then ; to ensure that FIfu plugin is installed but the other IDs must be found in classic editor _IEAction($HTML_cntnt, "click") ;----------------------------------------------- _IEFormElementSetValue($title, $Post_ttl) _IEFormElementSetValue($Featured_img_Id, $Featured_img_url) ;--------------------------------------- Local $cntnt = $Editor_Source & "<br><br><br>" & $pst_singature _IEFormElementSetValue($oText, $cntnt) ;============================================================================ _IEAction($chkbx, "click") ;------------------------------------------------ _IEFormElementSetValue($oTag, $Tags) ;------------------------------------------------ _IEAction($oSubmit, "click") ;------------------------------------------------ _IELoadWait($oIE) _CHCK_IP() ;================================================ _IELoadWait($oIE, 1000) ;================================================ ; here to get post edited link and delete link for the future Do ;------------------------------ Local $permalnk_rslt = _IEGetObjById($oIE, "sample-permalink") Local $edt_lnk = _IEGetObjById($oIE, "wp-admin-canonical") Local $permalnk_html = _IEDocReadHTML($oIE) ;------------------------------ ConsoleWrite("$permalnk_rslt: " & IsObj($permalnk_rslt) & " - " & " $edt_lnk: " & IsObj($edt_lnk) & @CRLF) Sleep(10) ;----------------------------------------------- Until IsObj($permalnk_rslt) And IsObj($edt_lnk) ;================================================ Local $del_lnk_arr = StringRegExp($permalnk_html, "" & "(?m:^).*" & 'class="submitdelete deletion"' & ".*(?:\v|$)+", 3) ;=============================================== If IsObj($permalnk_rslt) Then Local $permalnk = $permalnk_rslt.href ;=============================================== ; save post content into a txt file to restore it quickly when edit the post Local $edtpst_fopn = FileOpen($edtpst_fldr & $edtpst_Sec & "-cntnt.txt", 2 + 8) FileWrite($edtpst_fopn, $cntnt) FileClose($edtpst_fopn) ;============================================================================ IniWrite($edtpst_db, $edtpst_Sec, "Featured_IMG", $Featured_img_url) ;------------------------------- ; HERE write name of edtlinks ini file and del-links Local $edtlinks_fl = $edtpst_fldr & $edtpst_Sec & "-edtlinks.ini" IniWrite($edtlinks_fl, $iplsh, "edt_link_" & $iplsh, $edt_lnk.href) ;---------------- Local $dellinks_fl = $edtpst_fldr & $edtpst_Sec & "-dellinks.ini" Local $del_lnk = StringReplace($del_lnk_arr[0], 'class="submitdelete deletion"', "") $del_lnk = StringSplit($del_lnk, '"')[2] $del_lnk = StringReplace($del_lnk, "&", "&") IniWrite($dellinks_fl, $iplsh, "del_link_" & $iplsh, $del_lnk) ;================================================ Else MsgBox($MB_TOPMOST + $MB_ICONERROR, "error", "there is a problem in extracting edit and delete links") EndIf ;====================================================================================="" Else ;------------------------------------------------ MsgBox($MB_TOPMOST + $MB_ICONERROR, "error", "there is a problem with connecting to the site: " & $Sitelnk_pblshd & @CRLF & "check it please..." & @CRLF & _ "$title: " & IsObj($title) & @CRLF & _ "$oText: " & IsObj($oText) & @CRLF & _ "$chkbx: " & IsObj($chkbx) & @CRLF & _ "$oSubmit: " & IsObj($oSubmit) & @CRLF & _ "$oTag: " & IsObj($oTag) & @CRLF & _ "$Featured_img_Id: " & IsObj($Featured_img_Id) & @CRLF & @CRLF & _ "may the pluging below isn't installed on wordpress:" & @CRLF & _ "Featured Image from URL | FIFU") EndIf ;============================================ Next ;============================================ ProgressSet(100, "done", "") ProgressOff() EndFunc ;==>pblsh_action Func _CHCK_IP() Local $sPublicIP = _GetIP() Local $1st_chck_sign = "" ;================================================ If $sPublicIP = -1 Or $sPublicIP = "" Then ; this condition to make a sign to not refresh page when get IP until the connection has been already cut $1st_chck_sign = True EndIf ;================================================ While 1 If $sPublicIP <> -1 And $sPublicIP <> "" Then ;-------------------------------- If $1st_chck_sign = True Then _IEAction($oIE, "refresh") $1st_chck_sign = "" MsgBox(0, "alert", "Back Online :) ") EndIf ;-------------------------------- _IELoadWait($oIE) ExitLoop Else MsgBox(0, "alert", "Offline :( ") Sleep(1000) EndIf ;-------------------------------- $sPublicIP = _GetIP() ConsoleWrite("$sPublicIP: " & $sPublicIP & @CRLF) WEnd ;================================================ EndFunc ;==>_CHCK_IP also I've faced a new problem that: when the loop passes some items the script crashes then closes! Edited January 10, 2021 by AlienStar 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