Search the Community
Showing results for tags 'matching'.
-
I read various threads and theories regarding two string matching and convert matching value into Percentage. there are some algorithms to calculate similarity like Lowenstein, but sometimes you need more then that So, I written this code, and you will use it at your convenience script matches two strings with word by word OR character by character also match by case OR non case format you can also find difference with (100 – Result) If any suggestion then please write here #include <Array.au3> #include <File.au3> #include <Math.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> $sStr01 = "My string Software v1.0" $sStr02 = "My String Software v1.1" ConsoleWrite("Standard: " & _StringMatchPercent($sStr01, $sStr02) & @CRLF) ; Return Standard: 95.65 ConsoleWrite("Case ON (Char lvl): " & _StringMatchPercent($sStr01, $sStr02, 1, 0) & @CRLF) ; Return "Case ON (Char lvl): 91.3" ConsoleWrite("Case ON (word lvl): " & _StringMatchPercent($sStr01, $sStr02, 1, 1) & @CRLF) ; Return "Case ON (word lvl): 50" ConsoleWrite("Case Off (Char lvl): " & _StringMatchPercent($sStr01, $sStr02, 0, 0) & @CRLF) ; Return "Case Off (Char lvl): 95.65" ConsoleWrite("Case Off (word lvl): " & _StringMatchPercent($sStr01, $sStr02, 0, 1) & @CRLF) ; Return "Case Off (word lvl): 75" Func _StringMatchPercent($FirstString = "", $SecondString = "", $iCaseSense = 0, $iMatchByWord = 0) ;~ ($iCaseSense : [0 = not case sensitive [, 1 = case sensitive]]) ;~ $iSplitByWord : [0 = Match Character by Character [, 1 = Match word by Word]] ;~ ### Check/Set function header parameters Local $sMatchBy = ($iMatchByWord = 0) ? "" : " " Local $inCaseSense = ($iCaseSense = 0) ? 0 : 1 If $FirstString = "" Or $SecondString = "" Then Return "0" Local $aFirstArray = StringSplit($FirstString, $sMatchBy, 2) _ArraySort($aFirstArray) ; Sort Array to Ascending Order ;~ _ArrayDisplay($aFirstArray,"Show First Array") Local $aSecondArray = StringSplit($SecondString, $sMatchBy, 2) _ArraySort($aSecondArray) ; Sort Array to Ascending Order ;~ _ArrayDisplay($aSecondArray,"Show Second Array") Local $inSL = 0 ;Second Level matching starting Point Local $iMatchCount = 0 Local $sMatchArg = 0 ; Now Matching Every First Array Element to Second Array Element For $iFL = 0 To UBound($aFirstArray) - 1 ; $iPL = Represent First Array Position For $iSL = $inSL To UBound($aSecondArray) - 1 ; $iSL = Second Array Position $inSL = Second Array Checking Start from If StringCompare($aFirstArray[$iFL], $aSecondArray[$iSL], $inCaseSense) = 0 Then ; If Both Element Matched $iMatchCount += 1 ; Match Count get +1 $inSL = $iSL + 1 ; Set New Starting Position for Second Array ExitLoop ; Exit Loop for checking next element EndIf Next Next Local $iMax = _Max(UBound($aFirstArray), UBound($aSecondArray)) ; Finding Large Array for Calculation Return Round((($iMatchCount <> 0) ? (($iMatchCount / $iMax) * 100) : 0), 2) EndFunc
-
How to use the date and time in Microsoft Excel and use it find to find it in Windows explorer under date modified(date and time) if it matches then extract that picture and paste it in Microsoft Excel. I know have to use FileGetTime() but not sure how to do. Please help me. Thank you.
- 2 replies
-
- datemodified
- file_explorer
-
(and 2 more)
Tagged with:
-
hi , I have written a script to simulate keypresses and click on some windows The work is repetitive. Here I activate 'foobar' and click on a place in it then press few down arrow keys . Then some keypresses in 'reboot' window ... (1)It sometimes happen that am external window pops up taking focus away from action being performed by script . As a result ,say, 'reboot' window does not appear . How should I bring scipt to run from beginning (of while loop) again ? (2)I used window info tool to find coordinates of place to click . Is it possible that window info tool keeps updating mouse coordinate even when I do not drag its finder ? (3)I would also like to add functionality to do an action on window 'new IP' , if found , in the infinite while loop . Please give directions. Thanks. #include <AutoItConstants.au3> HotKeySet("{ESC}", "dummy") AutoItSetOption("WinTitleMatchMode",2); Local $hWnd, $x, $y, $pos, $reponse While 1 $hWnd = WinGetHandle("foobar") $pos = WinGetPos($hWnd) $x = 360 ; $y = 77 ; WinActivate($hWnd) MouseClick("left", $pos[0] + $x, $pos[1] + $y) Send("{DOWN}") WinWaitActive($hWnd) Send("{DOWN}") WinWaitActive($hWnd) Send("{DOWN}") WinWaitActive($hWnd) Send("{DOWN}") WinWaitActive($hWnd) Send("{DOWN}") Send("{DOWN}") WinWaitActive($hWnd) WinWaitActive($hWnd) Send("{ENTER}") $reboot_window = WinWait("Reboot") WinWaitActive($reboot_window) Send("{TAB}") WinWaitActive($reboot_window) Send("{SPACE}") WinWaitActive($reboot_window) Send("{TAB}") WinWaitActive($reboot_window) Send("{DOWN}") Send("{DOWN}") WinWaitActive($reboot_window) Send("{TAB}") WinWaitActive($reboot_window) Send("{DOWN}") WinWaitActive($reboot_window) Send("{TAB}") WinWaitActive($reboot_window) Send("{SPACE}") Sleep(1000) $response = WinGetHandle("Reboot") $pos = WinGetPos($response) $x = 168 ; 530-362 $y = 258 ; 376-118 WinActivate($response) MouseClick("left", $pos[0] + $x, $pos[1] + $y) Sleep(50000) WEnd Func dummy() EndFunc ;==>dummy