Leaderboard
Popular Content
Showing content with the highest reputation on 03/19/2021 in all areas
-
Regex: remove all duplicate lines from a sorted file
TheXman reacted to AspirinJunkie for a topic
Sure - what's the problem with this? That's what leuce wanted: But your result could also be achieved with a slightly shorter pattern: $sNew = StringRegExpReplace(FileRead("testfile.txt"), '(?ms)^(\V+)$\R(?=.*\1)', '') ConsoleWrite($sNew)1 point -
Repeating Regex Pattern
FrancescoDiMuro reacted to seadoggie01 for a topic
$regexp = "((?:.+\R){5})" Something like this makes sense if you want to capture the whole paragraph at a time. The inside non-capturing group gets a whole line and a newline, and the outer group captures 5 of them at once. Also, if you need help with Regular Expressions, RegEx101.com has nice explanations and a cool way to share RegEx --> https://regex101.com/r/7Ma34B/1 Sorry for being a day late @FrancescoDiMuro, but I'll chase @mikell away!1 point -
_GDIPlus_ImageLoadFromFile() meaning of @error = 10 and @extended = 3
FrancescoDiMuro reacted to pixelsearch for a topic
When I downloaded the pic you indicated us (nextcloud link) then it was saved under this name : 1024-680.jpg Anyway, I could resize it without error to the new dimensions you indicated. Concerning the error you're talking about : I already encountered this error when the image can be opened without error (i.e. _GDIPlus_ImageLoadFromFile succeeds) but it can't be resized. I treat this kind of picture like this, even if there are other pictures waiting to be resized. ... $hImage_resized = _GDIPlus_ImageResize($hImage, $iX_resized, $iY_resized) If @error Then ; damaged image (tried it: @error = 4 and @extended =0) $iKeep_error = @error $iKeep_extended = @extended If Not ($iKeep_error = 4 And $iKeep_extended = 0) Then _Quit("_GDIPlus_ImageResize", $sFileName, $iKeep_error, $iKeep_extended) Else ; $iKeep_error = 4 And $iKeep_extended = 0 : damaged image _GDIPlus_ImageDispose($hImage) $aSummary[6][0] += 1 ; skipped (resize error : damaged image) $aSummary[6][2] &= $iNum_img & "," ContinueLoop ; treat next image EndIf EndIf ... ;==================================================== Func _Quit($sError_title, $sError_msg, $iKeep_error, $iKeep_extended) ; bad error MsgBox($MB_TOPMOST, "Error : " & $sError_title, _ $sError_msg & @CRLF & @CRLF & _ "@error = " & $iKeep_error & " @extended = " & $iKeep_extended) _Exit() EndFunc ; _Quit() ;==================================================== Func _Exit() ToolTip("") AdlibStop() ;~ SplashOff() _GDIPlus_ImageDispose($hImage_resized) _GDIPlus_ImageDispose($hResized_1st_backup) _GDIPlus_ImageDispose($hImage_backup) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() If $hGUI_Preview Then GUIDelete($hGUI_Preview) If $hGUI_Background Then GUIDelete($hGUI_Background) GUIDelete($hGUI_Main) DllClose($hShell32) ; used by _WinAPI_DragQueryFileEx2() Exit EndFunc ; _Exit() These image errors are really tricky, glad for you that it works now, you'll sure find why it didn't work the 1st time, it's just a matter of... time1 point -
Again, I am not interested whether or not they allow it and am only interested whether this goes against our forum rules: So... Is this script part of process that goes against this rule?1 point
-
Fine, BUT I need an answer first that clearly explains that this isn't against OUR forum rules, which means it needs to be explained how that is the case.1 point
-
Don't know what that means.... try explaining it to somebody that doesn't play games and is way over 50. Not important to me.1 point
-
Forgive me, but I am not a gamer, so what does that mean for this not being against our forumrules?1 point
-
Ok... had a quick look at the basics and it is the "For $i = 1 To $CharCount " loop that takes all the time, but... lets start with another question: This all sounds very much like you are processing Game information... So I am back to my original question: What is the goal of this script and the new extracted file?1 point
-
Ok, Got the full set now and see how it is currently working .... more later1 point
-
Soon ... when you are in another group, which I will put you in after this message. Not really, only partially. It is still very vague. So what about you make all files available to run this script so we can test/understand/see if it can be made more efficient? The script is now posted but there is still a binary.au3 include in there that is not standard! We also would need an input file to be able to test and maybe some guidelines how to run it? Jos1 point
-
Again ... why? ( not what!) I understand that English in not your own language, so hope you understand the question, but I like to understand why you are processing this binary information.1 point
-
mmm yes that much I already understood , but currently fail to understand why at this moment. So I am interested in the goals/result of this script!1 point
-
Already corrected my statement (wrong example), but how about you explain what it is we are trying to get working (faster) here as it all look pretty strange to me?1 point
-
And why loop in first example is For $Table = 0 To 400 While in second example is For $Table = 0 To 4 And why do you assign repeatedly to the same variables For $Exports = 1 To $itemCount $stringIndex_ClassName = _BinaryToInt16(_BinaryRead(2)) $ObjectFlags = _BinaryToInt16(_BinaryRead(2)) $parentID = _BinaryToInt32(_BinaryRead(4)) $dataSize = _BinaryToInt32(_BinaryRead(4)) $dataOffset = _BinaryToInt32(_BinaryRead(4)) $template = _BinaryToInt32(_BinaryRead(4)) $CRC32 = _BinaryToInt32(_BinaryRead(4)) Next1 point
-
You say this is actually working? This part doesn't test for a hex code of 4 characters but in stead for a literal string, so doubt that if is ever true.1 point
-
Fastest way to read and work with a binary file - (Locked)
Invicore reacted to JockoDundee for a topic
So these programs actually work correctly, but are just slow? Where’s all the code, like _BinarySetPos, and other functions? Where’s the sample input file? Why the -1 here: $File_R = FileRead($File, -1)1 point -
Pal, Peter's AutoIt functions Library
Earthshine reacted to PeterVerbeek for a topic
Version 1.25 released, New is _GUIResize() to resize according to the size given in GUICreate() which is the client size of a window. An absolute or delta (relative) size can be given. Also new are _IsBit() for testing a bit and _BitSet() for setting/unsetting a bit. Also new: _Decimals() returns the decimal part (after the point) of a number.1 point -
merging duplicated data
Shark007 reacted to FrancescoDiMuro for a topic
@Shark007 Use an array to store the names, and use a "global" function to call all the other functions in a loop (untested): ; Call the function once General() Func General() Local $arrNames[] = ["Brenda", "Jim", "Frank", "Karen", "Steve"], _ $strName ; Iterate through the names For $strName in $arrNames ; Calls the functions here unlock($strName) kind($strName) Next EndFunc1 point -
Repeating Regex Pattern
InclusiveExclusion reacted to mikell for a topic
BTW I suppose that when saying 'repeating regex patterns' you meant something like this $regexp = "(.+)(?=\R){5}" But the example you chose is not the best one for this because in this case the 'repeating' feature is automatic so such a syntax is useless1 point -
Here what your code could be if I understand you correctly : #Include "wd_core.au3" #Include "wd_helper.au3" #Include <Excel.au3> #Include <Array.au3> Local $sDesiredCapabilities = SetupChrome() _WD_Startup() Local $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "file://C:\\Applications\\AutoIt\\WebDriver\\HTML Examples\\Table.html") _WD_LoadWait($sSession) Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='test']") ConsoleWrite ("Table " & $sElement & @CRLF) Local $aArray1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".//td[contains(.,'Title')]", $sElement, True) For $i = 0 to UBound($aArray1) - 1 $aArray1[$i] = _WD_ElementAction($sSession, $aArray1[$i], 'text') Next _ArrayDisplay($aArray1) Local $aElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, ".//a[@class='testlink']", $sElement, True) _ArrayDisplay($aElement) Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\test.xlsx") Local $aArray2 = _Excel_RangeRead($oWorkbook, Default,"B2:B6") _Excel_Close($oExcel) _ArrayDisplay($aArray2) ; search from Excel array cells into Chrome table Local $iIdx For $i = 0 To UBound($aArray2) - 1 $iIdx = _ArraySearch($aArray1, $aArray2[$i]) If @error Then ContinueLoop ConsoleWrite ("Found at " & $iIdx & @CRLF) _WD_ElementAction($sSession, $aElement[$iIdx], 'click') Next ;_WD_DeleteSession($sSession) ;_WD_Shutdown() Local $aDir = _FileListToArrayRec(@TempDir, "scoped_dir*;chrome_*", $FLTAR_FOLDERS, $FLTAR_NORECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) Sleep(2000) For $i = 1 To $aDir[0] DirRemove($aDir[$i], $DIR_REMOVE) Next Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') Return '{"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"w3c":true,' & _ '"excludeSwitches":["enable-automation"],"useAutomationExtension":false}}}}' EndFunc ;==>SetupChrome1 point
-
@jelly By default, _WD_WaitElement doesn't return the found element. You will need to change your code to this -- $cNameClick=_WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,"//*[@class='rtPlus']", Default, Default, Default, Default, True) You didn't provide enough information to know if the above is all that's required to make your script function. If you need further help, then please post additional details, such as -- website involved Results from Scite output panel Etc Regards, Dan P.S. Welcome to the forum1 point
-
You should read your excel sheet starting at row 2 since you have a title. Look at _WD_FindElement there is a starting element (4th parameter), I think you will need it...1 point
-
Unable to handle IE SaveAs Notification bar
SurajJadhav reacted to Nine for a topic
Please use this tool when you post code. Here what I am using : Const $sFileName = "C:\Apps\Temp\Test.txt" ; full path FileDelete($sFileName) Local $hWnd= _IEPropertyGet ($oIE, "hwnd") Local $hCtrl = ControlGetHandle ($hWnd, "", "DirectUIHWND1") ConsoleWrite ("Control = " & $hCtrl & @CRLF) If Not $hCtrl Then Exit MsgBox ($MB_SYSTEMMODAL, "", "Unable to find DL control") WinActivate ($hWnd) WinWaitActive($hWnd) ControlSend ($hWnd, "", $hCtrl, "{F6}{TAB}") Sleep (800) ControlSend ($hWnd, "", $hCtrl, "{DOWN 2}{ENTER}") $hDlg = WinWait("Enregistrer sous") ConsoleWrite ($hDlg & @CRLF) Sleep(1000) $hFile = ControlGetHandle($hDlg, "", "Edit1") ConsoleWrite ($hFile & @CRLF) ControlSetText($hDlg, "", $hFile, $sFileName) ControlClick($hDlg, "", "Button1") ; wait till the DL is finished Do Sleep(100) Until FileGetSize($sFileName) Sleep (1000) ; to hide the download window WinActivate($hWnd) ControlSend($hWnd, "", $hCtrl, "{F6}") Sleep(300) ControlSend($hWnd, "", $hCtrl, "{ESC}") Sleep(1000) ;_IEQuit ($oIE) You will need to change title of the Save As Dialog Window...1 point -
It is an old thread, but it is better to keep some reference points if some are interested who come by. There 3 important functions to define in vlc extension: descriptor(), activate(), deactivate() Plus this to write to console: vlc.msg.info("Salam") Here some examples from official source code: - https://github.com/videolan/vlc/tree/master/share/lua/ Also it is good to make a look on others add-on code many are in lua. - https://addons.videolan.org/browse/cat/ Hello World: function descriptor() return { title = "Simple", version = "0.1", author = "Blue", shortdesc = "XYZ Loader", description = "Loads XYZ and apply on the fly", capabilities = {} } end local prefix = "[XYZ] " function activate() vlc.msg.info(prefix .. "activated!") local elapsedDuration = vlc.var.get(vlc.object.input(), "time") local timeAsString = tostring(elapsedDuration/1000000) vlc.msg.info(prefix .. timeAsString) end function deactivate() vlc.msg.info(prefix .. "deactivated!") end1 point
-
Ok... I am done putting energy in this thread... it could be legit ..or not ... but can't be bothered anymore... Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team0 points