when I try 7, it adds the menu text 'Add Inputdata to beginning', not input data to the beginning.
How can I fix it ? Thank you for your help in advance.
Code: Select all
MyMenu := Menu()
MyMenu.Add("1. Remove the inputdata", RemoveInputdata)
MyMenu.Add("2. Remove the lines with inputdata", RemoveLinesWithInputdata)
MyMenu.Add("3. Remove Left with inputdata", RemoveLeftWithInputdata)
MyMenu.Add("4. Remove left without inputdata", KeepLeftWithInputdata)
MyMenu.Add("7. Add Inputdata to beginning", AddToBeginning)
Capslock & f:: {
A_Clipboard := ""
Sleep 100
Send('^c') ; option 2
ClipWait
global userinput := Inputbox("Enter Text", "Inputbox")
If (userinput = "") ; If blank/cancel pressed
Return
MyMenu.Show() ; MyMenu 표시
Sleep 100 ;
Send('^v')
}
RemoveInputdata(userInput, *) { ; Case 1
RegExEscape(str) {
return StrReplace(str, "[]\/.*+?()|^${}", "`$&")
}
A_Clipboard := RegExReplace(A_Clipboard, ".*" . RegExEscape(userInput) . ".*", "")
}
RemoveLinesWithInputdata(userInput, *) { ; case 2
A_Clipboard := RegExReplace(A_Clipboard, "mUO.*\Q" userInput "\E.*", "")
}
RemoveLeftWithInputdata(userInput, *) { ; case 3
A_Clipboard := RegExReplace(A_Clipboard,"mUO`a).*?\Q" userInput "\E", "")
}
KeepLeftWithInputdata(userInput, *) { ; case 4
A_Clipboard := RegExReplace(A_Clipboard,"`aim)^.*(\Q" userInput "\E)","$1")
}
AddToBeginning(userInput, *) { ; case 7
Loop parse, A_Clipboard, "`n", "`r" {
prefix_apl := userInput . A_LoopField . "`n"
outcome .= prefix_apl
Sleep 50
}
A_Clipboard := outcome
}