Hello,
I would like to know how can I code in my script a editbox or combobox to display the text input history.
It's a IP/Connexion tool and the user type the IP/Host in an editbox and i want an history so the user can select an IP typed before.
Thank you in advance for the help !
Best regards.
[SOLVED] Recent type text (history)
[SOLVED] Recent type text (history)
Last edited by Peace1 on 19 Apr 2015, 08:15, edited 1 time in total.
Re: [HELP] Recent type text (history)
Code: Select all
Gui, Add, ComboBox, w300 vCB1,
Gui, Add, Button, gOk vB1, Ok
Gui, Show
return
GuiClose:
GuiEscape:
ExitApp
Ok:
Gui, Submit, NoHide
History .= CB1 "|"
Sort, History, U D|
MsgBox, Current selection = %CB1%
GuiControl, , CB1, |%History%
return
Re: [HELP] Recent type text (history)
Hi kon !
Pretty good thank you for this great example, just do the work !!
Do you think it's possible to keep this history after closing the script ? In this way is the user close the script he can access to the history another time.
Thank you very much for the help i appreciate it !
Best regards.
Pretty good thank you for this great example, just do the work !!
Do you think it's possible to keep this history after closing the script ? In this way is the user close the script he can access to the history another time.
Thank you very much for the help i appreciate it !
Best regards.
Re: [HELP] Recent type text (history)
You will need to write the history to a file and load the file when the script starts.
Some useful commands for reading/writing files are: FileAppend, FileRead, FileDelete, IniRead, and IniWrite
Some useful commands for reading/writing files are: FileAppend, FileRead, FileDelete, IniRead, and IniWrite
Re: [HELP] Recent type text (history)
OK I will try to use those functions with an INI file, thank you to put le on the right way !kon wrote:You will need to write the history to a file and load the file when the script starts.
Some useful commands for reading/writing files are: FileAppend, FileRead, FileDelete, IniRead, and IniWrite
Another question, do you think it's possible to show/complete the text typed by the user. I mean if the user type for example xxx.xxx.xxx and then yyy.xxx.xxx The combobox can show/complete the text when the user type again xxx. And in a second time add a clear button history.
Is like the same use of Teamviewer when you try to connect to another computer.
Big thank you in advance for your reply.
Have a good day, best regards.
Re: [HELP] Recent type text (history)
Hi i'm back again !
I found this little snippet and do you think is possible to adapt it to work only with a combobox or editbox ? And have the possibility to delete on item if the user want or clear history !
Source : http://www.autohotkey.com/board/topic/2 ... entry49491
Thank you, regards.
I found this little snippet and do you think is possible to adapt it to work only with a combobox or editbox ? And have the possibility to delete on item if the user want or clear history !
Source : http://www.autohotkey.com/board/topic/2 ... entry49491
Thank you, regards.
Re: [HELP] Recent type text (history)
I haven't studied your code but this might be the easiest "plug & play" solution to adapt in to your script http://www.autohotkey.com/board/topic/6 ... iedit-v02/
Re: [HELP] Recent type text (history)
Hi ! Thank you for the link, i take a look in the code and we are close to my request, i tried to change some lines a put an ComboBox but the result is not really what i want.Invité wrote:I haven't studied your code but this might be the easiest "plug & play" solution to adapt in to your script http://www.autohotkey.com/board/topic/6 ... iedit-v02/
I see this code AutoComplete by Uberi and i would like something like that but not so complicate ^^
Something like that :
BTW thank you for the help !
Regards.
Re: [HELP] Recent type text (history)
This is what I use regularly, adopted it here so that you can use up/down and when you press enter it copies the selection to search field. Not entirely what you're after I think but for that you would need a second gui floating near the filter field showing the results that match your typed text. Perhaps this code is enough to get you started, the search bit is short, most of the code just handles the up/down keys.
Code: Select all
iplist=
(join`n
123.123.0.174
127.0.0.1
192.168.0.123
4.4.4.5
6.6.6.6
7.8.9.0
12.15.17.78
)
GUITitle=IPSearch
StartList:=""
loop, parse, iplist, `n
StartList .= A_LoopField "|"
Gui, Search:Destroy
Gui, Search:Add, Text, x5 y8 w45 h15, &Filter:
Gui, Search:Add, Edit, gGetText vGetText x50 y5 w150 h20 +Left,
Gui, Search:Add, ListBox, x50 y30 w150 h150 vChoice, %StartList%
Gui, Search:Add, Button, default hidden gSearchChoice, OK ; so we can easily press enter
Gui, Search:Show, h200 w595, %GUITitle%
Return
GetText:
Gui, Search:Submit, NoHide
Loop, Parse, StartList, |
{
re:="iUms)" GetText
if InStr(GetText,A_Space) ; prepare regular expression to ensure search is done independent on the position of the words
re:="iUms)(?=.*" RegExReplace(GetText,"iUms)(.*)\s","$1)(?=.*") ")"
if RegExMatch(A_LoopField,re)
UpdatedStartList .= A_LoopField "|"
}
GuiControl, Search:, ListBox1, |%UpdatedStartList%
GetText=
UpdatedStartList=
Return
SearchChoice:
Gui, Search:Submit, NoHide
if (Choice = "")
{
ControlFocus, ListBox1, A
ControlSend, ListBox1, {down}, A
}
Gui, Search:Submit, NoHide
GuiControl, Search:,GetText,%Choice%
Return
#IfWinActive, IPSearch
Up::
SendMessage, 0x188, 0, 0, ListBox1, %GUITitle% ; 0x188 is LB_GETCURSEL (for a ListBox).
PreviousPos:=ErrorLevel+1
ControlSend, ListBox1, {Up}, %GUITitle%
SendMessage, 0x18b, 0, 0, ListBox1, %GUITitle% ; 0x18b is LB_GETCOUNT (for a ListBox).
ItemsInList:=ErrorLevel
SendMessage, 0x188, 0, 0, ListBox1, %GUITitle% ; 0x188 is LB_GETCURSEL (for a ListBox).
ChoicePos:=ErrorLevel+1
If (ChoicePos = PreviousPos)
{
SendMessage, 0x18b, 0, 0, ListBox1, %GUITitle% ; 0x18b is LB_GETCOUNT (for a ListBox).
SendMessage, 390, (Errorlevel-1), 0, ListBox1, %GUITitle% ; LB_SETCURSEL = 390
}
Return
Down::
SendMessage, 0x188, 0, 0, ListBox1, %GUITitle% ; 0x188 is LB_GETCURSEL (for a ListBox).
PreviousPos:=ErrorLevel+1
SendMessage, 0x18b, 0, 0, ListBox1, %GUITitle% ; 0x18b is LB_GETCOUNT (for a ListBox).
ItemsInList:=ErrorLevel
ControlSend, ListBox1, {Down}, %GUITitle%
SendMessage, 0x188, 0, 0, ListBox1, %GUITitle% ; 0x188 is LB_GETCURSEL (for a ListBox).
ChoicePos:=ErrorLevel+1
If (ChoicePos = PreviousPos)
SendMessage, 390, 0, 0, ListBox1, %GUITitle% ; LB_SETCURSEL = 390 - position 'one'
Return
#IfWinActive
SearchGuiClose:
SearchGuiEscape:
Gui, Search:Destroy
Return
Re: [HELP] Recent type text (history)
Hi,Invité wrote:This is what I use regularly, adopted it here so that you can use up/down and when you press enter it copies the selection to search field. Not entirely what you're after I think but for that you would need a second gui floating near the filter field showing the results that match your typed text. Perhaps this code is enough to get you started, the search bit is short, most of the code just handles the up/down keys.Code: Select all
iplist= (join`n 123.123.0.174 127.0.0.1 192.168.0.123 4.4.4.5 6.6.6.6 7.8.9.0 12.15.17.78 ) GUITitle=IPSearch StartList:="" loop, parse, iplist, `n StartList .= A_LoopField "|" Gui, Search:Destroy Gui, Search:Add, Text, x5 y8 w45 h15, &Filter: Gui, Search:Add, Edit, gGetText vGetText x50 y5 w150 h20 +Left, Gui, Search:Add, ListBox, x50 y30 w150 h150 vChoice, %StartList% Gui, Search:Add, Button, default hidden gSearchChoice, OK ; so we can easily press enter Gui, Search:Show, h200 w595, %GUITitle% Return GetText: Gui, Search:Submit, NoHide Loop, Parse, StartList, | { re:="iUms)" GetText if InStr(GetText,A_Space) ; prepare regular expression to ensure search is done independent on the position of the words re:="iUms)(?=.*" RegExReplace(GetText,"iUms)(.*)\s","$1)(?=.*") ")" if RegExMatch(A_LoopField,re) UpdatedStartList .= A_LoopField "|" } GuiControl, Search:, ListBox1, |%UpdatedStartList% GetText= UpdatedStartList= Return SearchChoice: Gui, Search:Submit, NoHide if (Choice = "") { ControlFocus, ListBox1, A ControlSend, ListBox1, {down}, A } Gui, Search:Submit, NoHide GuiControl, Search:,GetText,%Choice% Return #IfWinActive, IPSearch Up:: SendMessage, 0x188, 0, 0, ListBox1, %GUITitle% ; 0x188 is LB_GETCURSEL (for a ListBox). PreviousPos:=ErrorLevel+1 ControlSend, ListBox1, {Up}, %GUITitle% SendMessage, 0x18b, 0, 0, ListBox1, %GUITitle% ; 0x18b is LB_GETCOUNT (for a ListBox). ItemsInList:=ErrorLevel SendMessage, 0x188, 0, 0, ListBox1, %GUITitle% ; 0x188 is LB_GETCURSEL (for a ListBox). ChoicePos:=ErrorLevel+1 If (ChoicePos = PreviousPos) { SendMessage, 0x18b, 0, 0, ListBox1, %GUITitle% ; 0x18b is LB_GETCOUNT (for a ListBox). SendMessage, 390, (Errorlevel-1), 0, ListBox1, %GUITitle% ; LB_SETCURSEL = 390 } Return Down:: SendMessage, 0x188, 0, 0, ListBox1, %GUITitle% ; 0x188 is LB_GETCURSEL (for a ListBox). PreviousPos:=ErrorLevel+1 SendMessage, 0x18b, 0, 0, ListBox1, %GUITitle% ; 0x18b is LB_GETCOUNT (for a ListBox). ItemsInList:=ErrorLevel ControlSend, ListBox1, {Down}, %GUITitle% SendMessage, 0x188, 0, 0, ListBox1, %GUITitle% ; 0x188 is LB_GETCURSEL (for a ListBox). ChoicePos:=ErrorLevel+1 If (ChoicePos = PreviousPos) SendMessage, 390, 0, 0, ListBox1, %GUITitle% ; LB_SETCURSEL = 390 - position 'one' Return #IfWinActive SearchGuiClose: SearchGuiEscape: Gui, Search:Destroy Return
Sorry to reply you with late but i was very busy this last weeks...
I tried your code but i have the same problem as AutoComplete's Uberi script. Perhaps someone more skilled than me can give me the good solution
Here is my post where i explain my problem !
Thank you in advance, regards.
Re: [HELP] Recent type text (history)
I don't see that behaviour - so I suggest you close all scripts and just run AutoComplete on its own (or my script above) and I doubt you will see it - my guess is something else is interfering - you will have to figure out what that something is ...
Re: [HELP] Recent type text (history)
Hi,Invité wrote:I don't see that behaviour - so I suggest you close all scripts and just run AutoComplete on its own (or my script above) and I doubt you will see it - my guess is something else is interfering - you will have to figure out what that something is ...
I followed your advices and try all scripts again after reboot my computer so no other script was running.
I downloaded again AutoComplete and your script run them on it own !
The problem still here, i give you some screenshot so you can see it. In your script is the same case. I hope you can help me with this little issue. I tried to contact Uberi but at the moment i don't have any response...
As you can see if i type 123 or 11 that show me two results but i only want that show me the correspondence for the start of typed word. I feel it's looking in whole of a match all words.
My goal is to manage the code of Uberi because this is the one I integrated in my project.
Regards.
Re: [HELP] Recent type text (history)
I see what you mean know you want to search only from the start not anywhere in the word.
Changing https://github.com/Uberi/Autocomplete/b ... e.ahk#L355 to Pattern := CurrentWord should take care of that.
Changing https://github.com/Uberi/Autocomplete/b ... e.ahk#L355 to Pattern := CurrentWord should take care of that.
Re: [HELP] Recent type text (history)
Well you have understand what i mean but your solution is not working.Invité wrote:I see what you mean know you want to search only from the start not anywhere in the word.
Changing https://github.com/Uberi/Autocomplete/b ... e.ahk#L355 to Pattern := CurrentWord should take care of that.
If i type u05 then in the suggestion frame there is no more suggestion...
I tried many things but i can't manage it
I think it's at this line but not sure : https://github.com/Uberi/Autocomplete/b ... e.ahk#L365
Regards.
Re: [HELP] Recent type text (history)
Works for me - are you sure you REPLACED the line? The line Pattern := RegExReplace(CurrentWord,"S).","$0.*") should be completely removed from the code and replaced by my line above - the regexreplace is what makes it match what you type anywhere in the words you are searching because of the $0.* replacement pattern.
See http://imgur.com/F8Cy9qd I type u05 and there is only one match.
See http://imgur.com/F8Cy9qd I type u05 and there is only one match.
Re: [HELP] Recent type text (history)
Yes of course i replaced the line by the one you give me. I have the same result like you but it's not that i want.Invité wrote:Works for me - are you sure you REPLACED the line? The line Pattern := RegExReplace(CurrentWord,"S).","$0.*") should be completely removed from the code and replaced by my line above - the regexreplace is what makes it match what you type anywhere in the words you are searching because of the $0.* replacement pattern.
See http://imgur.com/F8Cy9qd I type u05 and there is only one match.
Ideally i want in the suggestion the the entire word and not only "u05". If i type u05 i would like that appear "u05929".
I hope you see what i mean thank you
Edit: Thank to maestrith who found the solution !
-
- Posts: 58
- Joined: 18 Feb 2015, 15:06
Who is online
Users browsing this forum: Bing [Bot], Marium0505, mcl and 351 guests