Advertisement
Guest User

ahkPatternBro

a guest
May 22nd, 2016
1,433
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  3. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  4. NewPattern := ""
  5. PatternWorking := Object()
  6. lastPattern := Object()
  7.  
  8. FileSelectFile, patternFile, 3
  9. FileRead, AllPatterns, %patternFile%
  10. AllPatterns:=RegExReplace(AllPatterns, "`r`n", "delimit")
  11. Patterns := StrSplit(AllPatterns, "delimit")
  12.  
  13.  
  14. for i, e in Patterns
  15. {
  16.     loopPattern := StrSplit(Patterns[i], [A_Space])
  17.     for index, element in loopPattern
  18.     {
  19.         if (lastPattern[index] == "")
  20.             continue
  21.  
  22.         if (PatternWorking[index] == "??")
  23.             continue
  24.        
  25.         if ( (loopPattern[index] == lastPattern[index]) )
  26.         {
  27.             PatternWorking.Remove(index)
  28.             PatternWorking.Insert(index, loopPattern[index])
  29.             PatternWorking.Insert(" ")
  30.         }
  31.         if ( (loopPattern[index] != lastPattern[index]) && (loopPattern[index] != PatternWorking[index]) )
  32.         {
  33.             PatternWorking.Remove(index)
  34.             PatternWorking.Insert(index, "??")
  35.             PatternWorking.Insert(" ")
  36.         }  
  37.     }
  38.     lastPattern := loopPattern
  39. }
  40. for i, e in PatternWorking
  41. {
  42.     NewPattern .= Patternworking[i]
  43.     NewPattern .= " "
  44. }
  45. NewPattern:=RegExReplace(NewPattern,"` +","` ")
  46. Gui, +Resize
  47. Gui, Show, xCenter yCenter h200 w500, sigmaker
  48. Gui, Add, Edit, ReadOnly vPatternEdit, % NewPattern
  49. Gui, Add, Button, , Copy to Clipboard
  50. return
  51.  
  52. ButtonCopytoClipboard:
  53. GuiControlGet, PatternEditContent,, PatternEdit
  54. Clipboard := PatternEditContent
  55. return
  56.  
  57. GuiClose:
  58. ExitApp
  59. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement