-
-
Save sl5net/ba5aef19f44fe68204ccb6c96e7c96e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
o := "someThing else greetings. Recommended for performance and compatibility with future AutoHotkey releases." | |
contend := "anotherThing for oma" | |
n := getAutoKeywords(o ,contend ) | |
ToolTip,% n " =n" ,690 ,1 | |
Sleep,1000 | |
Reload | |
;/¯¯¯¯ getAutoKeywords ¯¯ 181106121229 ¯¯ 06.11.2018 12:12:29 ¯¯\ | |
getAutoKeywords(ByRef oldKeywords, ByRef words){ | |
; AddWord rootDoObj.createKeys https://g-intellisense.myjetbrains.com/youtrack/issues?q=project:%20g-IntelliSense#issueId=GIS-65 | |
newKeyWords := oldKeywords " " words | |
firstWord := "" ; backup if founds nothing | |
addKeysMAX := 4 | |
minLength := 4 | |
camelCaseOr := "([^A-Z]?)([A-Z][a-z]+)" | |
normalOr := "()([\W_-][a-z]+)" | |
regEx := "(?:(" camelCaseOr "|" normalOr "))" | |
; Clipboard := regEx ; (?:(([^A-Z]?)([A-Z][a-z]+)|()([\W_-][a-z]+))) | |
StartingPosition := 2 | |
addedKeysCounter := 0 | |
Array := [] ; or Array := Array() | |
while(foundPos := RegexMatch( " " newKeyWords, "O)" regEx, Match, StartingPosition - 1 )){ | |
StartingPosition := Match.Pos(1) + Match.Len(1) | |
if(addedKeysCounter >= addKeysMAX) | |
break | |
preCar1 := Match.Value(2) | |
preCar2 := Match.Value(3) | |
;if(preCar1=="|" || preCar2=="|") | |
; break | |
if(Match.Value(4)) | |
keyTemp := Match.Value(4) | |
else if(Match.Value(3)) | |
keyTemp := Match.Value(3) | |
else if(Match.Value(2)) | |
keyTemp := Match.Value(2) | |
s:= "" | |
loop,4 | |
s .= A_Index ":" Match.Value(A_Index) "#" | |
; MsgBox,% s "(" A_ThisFunc ":" A_LineNumber " " RegExReplace(A_LineFile, ".*\\") ")" | |
trim_keyTemp := trim(keyTemp," `t`r`n") | |
if(0) | |
MsgBox,% ">" trim_keyTemp "< (" A_ThisFunc ":" A_LineNumber " " RegExReplace(A_LineFile, ".*\\") ")" | |
if(!HasVal(Array,trim_keyTemp)){ | |
if(!firstWord) | |
firstWord := trim_keyTemp | |
if(minLength <= strlen(trim_keyTemp)) | |
Array.Push(trim_keyTemp) ; Append this line to the array. | |
ArrayCount++ | |
} | |
; MsgBox,% keyTemp | |
} | |
newKeyWords := "" | |
Loop % ArrayCount | |
{ | |
; element := Array%A_Index% | |
element := Array[A_Index] | |
; MsgBox % "Element number " . A_Index . " is " . Array%A_Index% | |
newKeyWords .= element " " | |
} | |
if(!newKeyWords := rTrim(newKeyWords)) | |
if(!newKeyWords := firstWord) | |
newKeyWords := "without keywords" | |
; MsgBox % "Element number " . A_Index . " is " . Array%A_Index% | |
if(0 && InStr(A_ComputerName,"SL5")) | |
; feedbackMsgBox(RegExReplace(A_LineFile,".*\\") ">" . A_LineNumber, "newKeyWords=" newKeyWords ) | |
return newKeyWords | |
} | |
;\____ getAutoKeywords __ 181106121233 __ 06.11.2018 12:12:33 __/ | |
;/¯¯¯¯ HasVal ¯¯ 181116205402 ¯¯ 16.11.2018 20:54:02 ¯¯\ | |
HasVal(haystack, needle) { ; return index | |
if !(IsObject(haystack)) || (haystack.Length() = 0) | |
return 0 | |
for index, value in haystack | |
{ | |
if (value = needle) | |
return index | |
} | |
return 0 | |
} | |
;\____ HasVal __ 181116205406 __ 16.11.2018 20:54:06 __/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment