Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/29/2016 in all areas

  1. I think you're not reading my answers... #include <ProcessConstants.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> Global Const $sTag_PROCESS_BASIC_INFORMATION = "int ExitStatus;ptr PebBaseAddress;ptr AffinityMask;ptr BasePriority;ulong UniqueProcessId;ulong InheritedFromUniqueProcessId;" Local $iPID = Run("Danyfirex.exe") ;Get process PID ConsoleWrite("PID: " & $iPID & @CRLF) Local $hProcess = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, 0, $iPID) ;Open process ConsoleWrite("hProcess: " & $hProcess & @CRLF) Local $tPBI = DllStructCreate($sTag_PROCESS_BASIC_INFORMATION) Local $aRet = DllCall('ntdll.dll', 'int', 'NtQueryInformationProcess', 'handle', $hProcess, 'dword', 0, 'ptr', DllStructGetPtr($tPBI), 'ulong', DllStructGetSize($tPBI), 'ulong*', 0) ConsoleWrite($tPBI.UniqueProcessId & @CRLF) ConsoleWrite($tPBI.PebBaseAddress & @CRLF) _WinAPI_CloseHandle($hProcess) Saludos
    2 points
  2. I'll leave this open until Thursday UK time. That gives three more days for any late entries. Perhaps you can come up with a new approach or improve on the ideas put forward already. One thing is for certain: there are some talented individuals around here and so far the discussion has been of value in many ways. I am constantly learning new things from you people!
    2 points
  3. i never got the hang of RegExp... the score is based on the longest successive substring, which in this case: phone: 00441619346534 query: 00441619346434 (don't you just love monospace fonts? ) now, 11 characters out of 14 is (rounded to) 79%. assuming what we're assuming about typos (i.e. they should be ignored), i feel that a match score of 79% is more sound them 93%. @czardas? also what i failed to highlight, is that once the array contains match scores, it can be sorted - which makes it quite easy for the end user to distinguish between the results. one can easily overlook the dissimilarity demonstrated above, but when they see it's only 79%, they will (hopefully) double-check. especially when - which is more troubling - the match score for 0161 934 6534 is only 71%. the 79% match score takes into account both sides of the query string, which as i mentioned, can (and should) be disabled, so the 71% match score becomes the only result, which happens to be the required result. it scores low because the query is so long. perhaps i should cross-check the shorter string against the longer one, whichever they may be. ... ok, i introduced the cross-check. now the 71% match score reevaluates to 91%. yey! also, another match score that was 85% now reevaluates to 100%, as it should - it matches the query 0015417543012 to the phone +1-541-754-3012. double yey! this is the updated code: #include <Array.au3> #include <Math.au3> ; tester input Global $aPhone = [ _ '+262 692 12 03 00', '1800 251 996', '+1 994 951 0197', _ '091 535 98 91 61', '2397865', '08457 128276', _ '348476300192', '05842 361774', '0-800-022-5649', _ '15499514891', '0096 363 0949', '04813137349', _ '06620 220168', '07766 554433', '047 845 44 22 94', _ '0435 773 4859', '(01) 882 8565', '00441619346434', _ '09314 367090', '0 164 268 0887', '0590995603', _ '991', '0267 746 3393', '064157526153', _ '0 719 829 7756', '+1-541-754-3012', '+441347543010', _ '03890 978398', '(31) 10 7765420', '020 8568 6646', _ '0161 934 6534', '0 637 915 1283', '+44 207 882 8565', _ '0800 275002', '0750 646 9746', '982-714-3119', _ '000 300 74 52 40', '023077529227', '1 758 441 0611', _ '0183 233 0151', '02047092863', '+44 20 7946 0321', _ '04935 410618', '048 257 67 60 79'] Global $aQuery = [ _ '882 8565', _ '123 8762', _ '7543010', _ '07843 543287', _ '00441619346534', _ '+44208', _ '0015417543012'] Global $iScoreThreshold = 0.7 Global $bCheckBothSides = True ; declare a global var to temporarily stote the match score for any specific match Global $iScore ; declare the match results array: rows = phone numbers, columns = queries Global $aMatch[UBound($aPhone) + 1][UBound($aQuery) + 1] ; populate headers (rows and columns) and strip non-numeric characters For $iPhone = 0 To UBound($aPhone) - 1 $aMatch[$iPhone + 1][0] = _StringStripNonNumeric($aPhone[$iPhone]) Next For $iQuery = 0 To UBound($aQuery) - 1 $aMatch[0][$iQuery + 1] = _StringStripNonNumeric($aQuery[$iQuery]) Next ; match For $iPhone = 1 To UBound($aMatch) - 1 For $iQuery = 1 To UBound($aMatch, 2) - 1 $iScore = _Max(_StringMatch($aMatch[$iPhone][0], $aMatch[0][$iQuery], $bCheckBothSides), _StringMatch($aMatch[0][$iQuery], $aMatch[$iPhone][0], $bCheckBothSides)) If $iScore > $iScoreThreshold Then $aMatch[$iPhone][$iQuery] = String(Round($iScore * 100)) & '%' Next Next ; re-populate headers with original values for display For $iPhone = 0 To UBound($aPhone) - 1 $aMatch[$iPhone + 1][0] = $aPhone[$iPhone] Next For $iQuery = 0 To UBound($aQuery) - 1 $aMatch[0][$iQuery + 1] = $aQuery[$iQuery] Next ; display match results _ArrayDisplay($aMatch) ; functions Func _StringStripNonNumeric($sString) Local $sResult = '' For $i = 1 To StringLen($sString) If StringIsDigit(StringMid($sString, $i, 1)) Then $sResult &= StringMid($sString, $i, 1) Next Return $sResult EndFunc ;==>_StringStripNonNumeric Func _StringMatch($sString, $sSubstr, $bCheckBothSides) Local $iScoreMax = 0 Local $iScoreNow = 0 Local $iScorePerChar = 1 / StringLen($sSubstr) ; check end-first For $i = StringLen($sSubstr) To 1 Step -1 $iScoreNow = $iScorePerChar * $i If StringInStr($sString, StringRight($sSubstr, $i)) And $iScoreNow > $iScoreMax Then $iScoreMax = $iScoreNow Next If $bCheckBothSides Then ; check start-first For $i = StringLen($sSubstr) To 1 Step -1 $iScoreNow = $iScorePerChar * $i If StringInStr($sString, StringLeft($sSubstr, $i)) And $iScoreNow > $iScoreMax Then $iScoreMax = $iScoreNow Next EndIf ; done Return $iScoreMax EndFunc ;==>_StringMatch oh, and let's round the percentage. no-one cares for the 0.86% in the 92.86%. just put 93%, ok? why not? the query number appears in both phones in exact.
    1 point
  4. You are right and that's why I said not to bother with it unless you want to. Any number starting with +44208 is in London. I would only expect numbers that match 0208 xxx xxxx or +44208... in the results. You should probably also allow 0011 44 208 xxx xxxx and similar.
    1 point
  5. as i think after a small testing phase, the MsgBox will be removed for success, it's the same way as mine. And also with MsgBox the difference isn't so big to speak from a other way.
    1 point
  6. I think you are searcing for GuiCtrlSetData. Please use the code-tags ("<>") next time: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) ;Global &Source, &Destination Global $Source Global $FileSelectFolder1 Global $FileSelectFolder #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Copy Folder", 615, 438, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") $Copy = GUICtrlCreateButton("Copy", 184, 208, 161, 49) GUICtrlSetOnEvent(-1, "CopyClick") $SourceButton = GUICtrlCreateButton("SourceButton", 48, 40, 137, 41) GUICtrlSetOnEvent(-1, "SourceButtonClick") $DestButton = GUICtrlCreateButton("DestButton", 48, 104, 137, 41) GUICtrlSetOnEvent(-1, "DestButtonClick") $Progress1 = GUICtrlCreateProgress(104, 320, 425, 49) $Source = GUICtrlCreateInput("Source", 240, 48, 321, 21) GUICtrlSetOnEvent(-1, "SourceChange") $Destination = GUICtrlCreateInput("Destination", 240, 120, 305, 21) GUICtrlSetOnEvent(-1, "DestinationChange") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func CopyClick() EndFunc ;==>CopyClick Func DestButtonClick() Local Const $sMessage = "Select a folder" ; Display an open dialog to select a file. Local $sFileSelectFolder1 = FileSelectFolder($sMessage, "") If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.") Else ; Display the selected folder. MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder1) GUICtrlSetData($Destination,$sFileSelectFolder1) ;<=========== EndIf EndFunc ;==>DestButtonClick Func DestinationChange() EndFunc ;==>DestinationChange Func Form1Close() EndFunc ;==>Form1Close Func Form1Maximize() EndFunc ;==>Form1Maximize Func Form1Minimize() EndFunc ;==>Form1Minimize Func Form1Restore() EndFunc ;==>Form1Restore Func SourceButtonClick() Local Const $sMessage = "Select a folder" ; Display an open dialog to select a file. Local $sFileSelectFolder = FileSelectFolder($sMessage, "") If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.") Else ; Display the selected folder. MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder) GUICtrlSetData($Source,$sFileSelectFolder) ;<========= EndIf EndFunc ;==>SourceButtonClick Func SourceChange() EndFunc ;==>SourceChange Func Source() EndFunc ;==>Source
    1 point
  7. Glad I could help
    1 point
  8. As you redeclare $aResult in the func, you create a new var which will work only inside the func, reason why _ArrayExtract worked ... inside the func CountRow() used the $aResult declared as Global at the top of the script, and this one remained empty. You might check this using _ArrayDisplay or so
    1 point
  9. Please try to remove the "Local" before $aResult in the func test()
    1 point
  10. hear, hear! i am still in mind that the solution should be a general one, rather than needing to accommodate for each and every domestic and international country-per-country telephone numbers formats, past, present and future. and if, per problem description, typos are not to be considered, then the "string difference" methods (suggested by jchd post #47 in SQLite, and presented in AutoIt by stamandster in post #62) is an overkill, and quite a heavy one. especially since - as i demonstrate hereunder - typos can be accommodated for (to some extent) by specifying a more lenient match score. about the optional task presented in post #4: +44208.....missing numbers [optional task] i assume this was not thought thru, since if you search for that, you end up with a LOT of numbers... if this is indeed the intention, then i elaborate on my suggestion at post #36 to form this: #include <Array.au3> ; tester input Global $aPhone = [ _ '+262 692 12 03 00', '1800 251 996', '+1 994 951 0197', _ '091 535 98 91 61', '2397865', '08457 128276', _ '348476300192', '05842 361774', '0-800-022-5649', _ '15499514891', '0096 363 0949', '04813137349', _ '06620 220168', '07766 554433', '047 845 44 22 94', _ '0435 773 4859', '(01) 882 8565', '00441619346434', _ '09314 367090', '0 164 268 0887', '0590995603', _ '991', '0267 746 3393', '064157526153', _ '0 719 829 7756', '+1-541-754-3012', '+441347543010', _ '03890 978398', '(31) 10 7765420', '020 8568 6646', _ '0161 934 6534', '0 637 915 1283', '+44 207 882 8565', _ '0800 275002', '0750 646 9746', '982-714-3119', _ '000 300 74 52 40', '023077529227', '1 758 441 0611', _ '0183 233 0151', '02047092863', '+44 20 7946 0321', _ '04935 410618', '048 257 67 60 79'] Global $aQuery = [ _ '882 8565', _ '123 8762', _ '7543010', _ '07843 543287', _ '00441619346534', _ '+44208', _ '0015417543012'] Global $iScoreThreshold = 0.7 Global $bCheckBothSides = True ; declare a global var to temporarily stote the match score for any specific match Global $iScore ; declare the match results array: rows = phone numbers, columns = queries Global $aMatch[UBound($aPhone) + 1][UBound($aQuery) + 1] ; populate headers (rows and columns) and strip non-numeric characters For $iPhone = 0 To UBound($aPhone) - 1 $aMatch[$iPhone + 1][0] = _StringStripNonNumeric($aPhone[$iPhone]) Next For $iQuery = 0 To UBound($aQuery) - 1 $aMatch[0][$iQuery + 1] = _StringStripNonNumeric($aQuery[$iQuery]) Next ; match For $iPhone = 1 To UBound($aMatch) - 1 For $iQuery = 1 To UBound($aMatch, 2) - 1 $iScore = _StringMatch($aMatch[$iPhone][0], $aMatch[0][$iQuery], $bCheckBothSides) If $iScore > $iScoreThreshold Then $aMatch[$iPhone][$iQuery] = String(Round($iScore * 100)) & '%' Next Next ; re-populate headers with original values for display For $iPhone = 0 To UBound($aPhone) - 1 $aMatch[$iPhone + 1][0] = $aPhone[$iPhone] Next For $iQuery = 0 To UBound($aQuery) - 1 $aMatch[0][$iQuery + 1] = $aQuery[$iQuery] Next ; display match results _ArrayDisplay($aMatch) ; functions Func _StringStripNonNumeric($sString) Local $sResult = '' For $i = 1 To StringLen($sString) If StringIsDigit(StringMid($sString, $i, 1)) Then $sResult &= StringMid($sString, $i, 1) Next Return $sResult EndFunc ;==>_StringStripNonNumeric Func _StringMatch($sString, $sSubstr, $bCheckBothSides) Local $iScoreMax = 0 Local $iScoreNow = 0 Local $iScorePerChar = 1 / StringLen($sSubstr) ; check end-first For $i = StringLen($sSubstr) To 1 Step -1 $iScoreNow = $iScorePerChar * $i If StringInStr($sString, StringRight($sSubstr, $i)) And $iScoreNow > $iScoreMax Then $iScoreMax = $iScoreNow Next If $bCheckBothSides Then ; check start-first For $i = StringLen($sSubstr) To 1 Step -1 $iScoreNow = $iScorePerChar * $i If StringInStr($sString, StringLeft($sSubstr, $i)) And $iScoreNow > $iScoreMax Then $iScoreMax = $iScoreNow Next EndIf ; done Return $iScoreMax EndFunc ;==>_StringMatch note that checking the start of the string can be disabled by setting $bCheckBothSides = False, and the score threshold can also be set. i've set it to 0.7, which i find adequate to the given data sets - other data sets will probably benefit from different threshold values, although i believe not too different. note: this version shows the match score (in percentage) instead of just the "MATCH!" notice. run it, let me know what you think. EDIT: i delegate you to run it, since the _ArrayDisplay GUI is too big to fit in a screenshot...
    1 point
  11. Gianni

    Issue with Intranet

    @bloopie ... just a wild guess... look also to the ie settings to ensure thath it doesn't read an old web page from a cache memory instead of from the real web server. eventually try to empty all the data stored in the explorer's cache.
    1 point
  12. Thank you ( may be out of context, but I'm still laughing )
    1 point
  13. That is a problem. For the rest, you have no idea where the number originated. I thought I had made that clear in the first post. If someone travels around the globe, they may have contacts with duplicate phone number entries. On the other hand, if someone doesn't travel abroad, they won't include country codes (sometimes there is no area code). If these people use an application to search for a phone number, you could simply use StringInStr(). However, many people find phone numbers on the Internet and add them to databases etc... So there is a potential need to automate recognition. Naturally there will always be some false positives.
    1 point
  14. This is what you want and a simplistic example #include <HotString.au3> HotStringSet("Specified Barcode{enter}", MyFunc) While 1 Sleep(10) WEnd Func MyFunc() Send("{Up}") Send("^{a}") Send("{Delete}") EndFunc (A more reliable option would probably be to use an _Excel_* function but I've never used the Excel UDF)
    1 point
  15. An example file is always better... here is one remember to fill in these lines: Global $sServerName = "server name" ; ==> fill in Global $sUsername = "user name" ; ==> fill in Global $sPassword = "user password" ; ==> fill in Global $iServerPort = 22 ; ==> fill in optionally, default should be 22, not 0 as far as i know Global $cRemoteDir = "/some remote paths" ; ==> fill in and create a 'test.txt' file in your script folder. Update 12/12/2013 cleanup up example SFTPEx example - Generic.au3
    1 point
×
×
  • Create New...