Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/02/2017 in all areas

  1. The two following quotes are from here. In the "Verbs that act after backtracking " section, we have:- "....where (*SKIP) was encountered. (*SKIP) signifies that whatever text was matched leading up to it cannot be part of a successful match." In the "Lookahead assertions" section we have :- "If you want to force a matching failure at some point in a pattern, the most convenient way to do it is with (?!) because an empty string always matches, so an assertion that requires there not to be an empty string must always fail. The backtracking control verb (*FAIL) or (*F) is a synonym for (?!). " The successfully matched text before the backtracking control verb, "(*SKIP)", is forced into a matching failure using "(*FAIL)", or "(*F)", or "(?!)". As the RE pattern is applied to the rest of the test string from left to right and top to bottom, all the text that does not match the pre-"*SKIP", or pre-"|" part of the RE pattern is match with the Post-"|", or, the "post-or" part of the RE pattern. Using StringRegExpReplace() function, all text that is matched is replaced with "" (nothing). That is, the matched text is deleted, and the forced unmatched text is not deleted. The only reason I answered this post was to further investigate mikell's "brilliantly created" RE pattern from here. Thanks mikell. @kylomas The problem with the For-Next loop is after the first search, or loop, the lines that do not have the first search string in them are deleted. For a line to survive all the searches in the loop, that line would need to have all search strings in that particular line.
    2 points
  2. I answered your first PM, but I didn't answer the rest of your PMs because I have no answer. I don't know how to get the menu item name from such a menu ID. It's my impression that you simply cannot get the the menu item name from this menu ID. But I have not investigated it. It's also my impression that the menu ID is simply hardcoded in a switch/case statement in the code and that's the link between the menu ID and the rest of the code. But maybe I'm wrong. In my example about the Shell Context Menu I'm using the IContextMenu interface to create the context menu. But I'm not using the menu ID as input. I'm using the file name as input. The name of the file that you right click. Or a list of file names if you are right clicking a group of files in a selection. Or an empty file list if you are right clicking in empty space. My example does not give you a link between the menu ID and the menu item name.
    1 point
  3. RunWait returns the exit code, not the PID. You just need that on it's own, without the sleeps or ProcessWaitClose...or change RunWait to Run. Some processes also spawn additional processes, so you might have to get, and then wait, for that PID, but that's probably not the case here.
    1 point
  4. What is the specific case/scenario you are trying to work this with? There is apparently no one-size fits all solution how this is done, so knowing exactly the effort you are dealing with will help us help you better. Hopefully it is with something anyone can access and troubleshoot in their own and then hopefully someone will investigate and dedicate the time to assist you.
    1 point
  5. mikell

    SPLIT .CSV

    ? $sFilePath = @ScriptDir & "\test.csv" SplitCSVtoNewFile($sFilePath, "September") Func SplitCSVtoNewFile($sFilePath, $var) Local $content = FileRead($sFilePath) $new = StringRegExpReplace($content, '(?m)^\Q' & $var & '\E.*\R?(*SKIP)(*F)|^.*\R?', "") $hFile = FileOpen(@ScriptDir & "\" & $var & ".csv", 2) FileWrite($hFile, $new) FileClose($hFile) EndFunc This SRER deletes all lines which don't begin with the wanted starting characters
    1 point
×
×
  • Create New...