Leaderboard
Popular Content
Showing content with the highest reputation on 07/20/2019 in all areas
-
I think the problem is that the innertext is OUTSIDE the "checkmark". The classname should be "item". Modify it accordingly and add an ExitLoop after the click...1 point
-
Try changing the line to: If $oDiv.className = "checkmark" And StringStripWS($oDiv.innerText, 7) = "Noch nicht veröffentlicht" Then Also use ConsoleWrite to show the text for example: nb: This will show any white space between the "XXXX" ConsoleWrite("XXXX" & $oDiv.innerText & "XXXX" & @CRLF)1 point
-
Try something like: nb: Untested #include <IE.au3> Global $oIE = _IECreate("url") If IsObj($oIE) Then $oDivs = _IETagNameGetCollection($oIE, "div") If IsObj($oDivs) Then For $oDiv In $oDivs If IsObj($oDiv) Then If $oDiv.className = "checkmark" And $oDiv.innerText = "Noch nicht veröffentlicht" Then _IEAction($oDiv, "click") EndIf EndIf Next EndIf EndIf1 point
-
Here is a cut down version of the code above, the color functions you're using are for the entire Listview not Listview Items, also the $L_ItemID is returning the index of the Listview not the handle. #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <Misc.au3> #include "GUIListViewEx.au3" Opt( "GUIOnEventMode", 1 ) Global Const $Gc_Title = "Test" Global $L_Stat, $L_Error, $L_LVExID, $L_ItemID Global $L_LVStyle = BitOr($LVS_LIST, $LVS_ALIGNLEFT, $LVS_SHOWSELALWAYS, $LVS_SINGLESEL) Global $L_LVExStyle = BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES, $LVS_EX_FLATSB, $LVS_EX_TRACKSELECT) Global $G_VidToolGUI = GUICreate("VidToolGUI", 600, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "Gi_ExitClick", $G_VidToolGUI) Global $G_LViewID = GUICtrlCreateListView( "Name", 0, 0, 600, 300, $L_LVStyle, $L_LVExStyle ) GUICtrlSetFont( $G_LViewID, 16, $FW_NORMAL, $GUI_FONTNORMAL, "Anonymous Pro", $PROOF_QUALITY ) $L_LVExID = _GUIListViewEx_Init( $G_LViewID, "", 0, Default, False, 32+64+256 ) $L_Stat = _GUIListViewEx_SetEditStatus( $L_LVExID, "*", 0 ) ; No editing ;~ Add Listview Items ;~ Odd Numbered Row Items Aqua BackGround ;~ Even Numbered Row Items Red Text For $i = 0 To 9 GUICtrlCreateListViewItem("Listview Item Text " & $i, $G_LViewID) If Mod($i, 2) = False Then GUICtrlSetBkColor(-1, $COLOR_AQUA) Else GUICtrlSetColor(-1, $COLOR_RED) EndIf Next GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func Gi_ExitClick() Exit EndFunc1 point
-
Simple Robocopy with Progressbar
FrancescoDiMuro reacted to ModemJunki for a topic
auf Englistch ... but really the locale can be used to make a translation for any language ... I add the parameter "$s_Lng" - and anyone can make new language for the GUI. Default German because, of course .. it is. 😁 #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $s_Lng = RegRead("HKEY_USERS\.DEFAULT\Control Panel\International", "LocaleName") ; to determine locale robocopy("c:\tools", "d:\tools", "c:\tools\logfile.txt", "copy") ; example only Func readlog($logfilepath, ByRef $bytes, ByRef $lines) $bytes = 0 $logfile = FileOpen($logfilepath, 0) $lines = -1 ; number of files = number of lines in logfile -1 While 1 $line = FileReadLine($logfile) If @error Then ExitLoop $lines += 1 $position = StringInStr($line, @TAB, 0, -1) If $position > 0 Then $tmpbytes = StringLeft($line, $position - 1) $tmpbytes = StringStripWS($tmpbytes, 3) $tmpbytes = Int($tmpbytes) $bytes += $tmpbytes EndIf WEnd FileClose($logfile) EndFunc ;==>readlog Func robocopy($source, $destination, $logfilepath, $params) ConsoleWrite($source & ", " & $destination & ", " & $logfilepath & ", " & $params & @CRLF) Local $totalbytes = 0 Local $totalfiles = 0 Local $donebytes = 0 Local $donefiles = 0 ; check if pathes end with a \ then remove it If StringRight($source, 1) = "\" Then $source = StringLeft($source, StringLen($source) - 1) If StringRight($destination, 1) = "\" Then $destination = StringLeft($destination, StringLen($destination) - 1) Switch $params Case "mirror" $params = "/mir /mt /np /ndl /nc /bytes /njh /njs /e" Case "copy" $params = "/mt /np /ndl /nc /bytes /njh /njs /e" EndSwitch RunWait(@ComSpec & ' /c ' & 'robocopy.exe "' & $source & '" "' & $destination & '" ' & $params & ' /log:"' & $logfilepath & '" /l', @TempDir, @SW_HIDE) readlog($logfilepath, $totalbytes, $totalfiles) If $totalbytes = 0 Then Exit $str_total_bytes = StringRegExpReplace($totalbytes, '(\A\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))', '\1.') $str_total_files = StringRegExpReplace($totalfiles, '(\A\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))', '\1.') Select Case StringInStr($s_Lng, "en") ConsoleWrite("Total Bytes: " & $str_total_bytes & @CRLF) ConsoleWrite("Total Files: " & $str_total_files & @CRLF) Case Else ConsoleWrite("Gesamte Bytes: " & $str_total_bytes & @CRLF) ConsoleWrite("Gesamte Files: " & $str_total_files & @CRLF) EndSelect $Form1 = GUICreate("RoboCopy GUI", 580, 180, 192, 124) Select Case StringInStr($s_Lng, "en") GUICtrlCreateLabel("Source", 16, 12, 36, 17) Case Else GUICtrlCreateLabel("Quelle", 16, 12, 36, 17) EndSelect $quelle = GUICtrlCreateInput("", 60, 8, 500, 21) GUICtrlSetState($quelle, $GUI_DISABLE) Select Case StringInStr($s_Lng, "en") GUICtrlCreateLabel("Target", 16, 44, 36, 17) Case Else GUICtrlCreateLabel("Ziel", 16, 44, 36, 17) EndSelect $ziel = GUICtrlCreateInput("", 60, 40, 500, 21) GUICtrlSetState($ziel, $GUI_DISABLE) $lbl_files = GUICtrlCreateLabel("", 16, 72, 560, 17) $Progress1 = GUICtrlCreateProgress(16, 88, 544, 25) $lbl_bytes = GUICtrlCreateLabel("", 16, 120, 560, 17) $Progress2 = GUICtrlCreateProgress(16, 136, 544, 25) GUISetState(@SW_SHOW) GUICtrlSetData($quelle, $source) GUICtrlSetData($ziel, $destination) FileDelete($logfilepath) $pid = Run(@ComSpec & ' /c ' & 'robocopy.exe "' & $source & '" "' & $destination & '" ' & $params & ' /log:"' & $logfilepath & '"', @TempDir, @SW_HIDE) While ProcessExists($pid) Sleep(500) readlog($logfilepath, $donebytes, $donefiles) $str_done_bytes = StringRegExpReplace($donebytes, '(\A\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))', '\1.') $str_done_files = StringRegExpReplace($donefiles, '(\A\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))', '\1.') $percent_bytes = $donebytes * 100 / $totalbytes $percent_files = $donefiles * 100 / $totalfiles Select Case StringInStr($s_Lng, "en") ConsoleWrite("Bytes Copied: " & $str_done_bytes & ", percent complete: " & $percent_bytes & "%" & @CRLF) ConsoleWrite("Files Copied: " & $str_done_files & ", percent complete: " & $percent_files & "%" & @CRLF) GUICtrlSetData($Progress1, $percent_bytes) GUICtrlSetData($Progress2, $percent_files) GUICtrlSetData($lbl_bytes, $str_done_bytes & " of " & $str_total_bytes & " (" & StringFormat("%.2f", $percent_bytes) & "%)") GUICtrlSetData($lbl_files, $str_done_files & " of " & $str_total_files & " (" & StringFormat("%.2f", $percent_files) & "%)") Case Else ConsoleWrite("Erledigte Bytes: " & $str_done_bytes & ", entspricht : " & $percent_bytes & "%" & @CRLF) ConsoleWrite("Erledigte Files: " & $str_done_files & ", entspricht : " & $percent_files & "%" & @CRLF) GUICtrlSetData($Progress1, $percent_bytes) GUICtrlSetData($Progress2, $percent_files) GUICtrlSetData($lbl_bytes, $str_done_bytes & " von " & $str_total_bytes & " (" & StringFormat("%.2f", $percent_bytes) & "%)") GUICtrlSetData($lbl_files, $str_done_files & " von " & $str_total_files & " (" & StringFormat("%.2f", $percent_files) & "%)") EndSelect WEnd EndFunc ;==>robocopy robocopy("c:\test", "d:\x", @TempDir & "\robocopy.log", "copy")1 point