I'm using ctrl+c to copy text to the clipboard, then I paste it to a txt file, I sort it and remove all duplicates. But now I need to count them as ,red1, red2, etc. at the eol. But I can't find how to add it.
so I get 10 Address's 1 to 10, at the end I want to add ",red%x%" to the end, where x is a counter.
result would be,
Address here,red1
Address there,red2
Address overthere,red3
...
Here is what I got.
Code: Select all
SPEED = 2 ; mouse movement speed
MOUSE_OVER_DELAY = 20 ; delay after mouse moved
CLIPBOAD_DELAY = 50 ; delay after ctrl + c pressed
TOP_RIGHT_CORNER_X = 30 ; Top right X coordinate of stash
TOP_RIGHT_CORNER_Y = 235 ; Top right Y coordinate of stash
_InvOffsetX = 50
_InvOffsetY = 50
a::
t = red
Gosub GET_ADDRESS ; OK
Gosub SORT_IT ; NOK
return
GET_ADDRESS:
i = 1
while (i < 33){
j = 1
clipboard := ""
while (j < 33){
MouseMove, TOP_RIGHT_CORNER_X + _InvOffsetX*(j-1), TOP_RIGHT_CORNER_Y + _InvOffsetY*(i-1), SPEED
Sleep, MOUSE_OVER_DELAY
Send ^c
Sleep, CLIPBOAD_DELAY
if (clipboard == ""){
}
else{
var := RegExReplace(clipboard, "s)---..*$|^.*?\R|\R") ;remove all but two first lines, remove first line, remove enter.
FileAppend,
(
%var%`n
), %t%.txt
}
j := j + 1
}
i := i + 1
}
return
SORT_IT:
x = 0
FileRead, Contents, %t%.txt
if not ErrorLevel
{
Sort, Contents, u
FileAppend, %Contents%, %t%.txt
;add red%x% to eol here.
FileAppend,
(
`n
), classes.txt
Contents = ; Free the memory.
}
return
Loop, read, start, %t%.txt
{
x++
loop, parse, A_LoopReadLine, %A_Tab%
{
if(A_Index==`r`n){
,red%x%`r`n=%A_LoopField%
}
}
FileAppend, %start%, %t%.txt
But I can't get it to work. Anyone know a simple way to add this?