AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

creating an application to manage a large list of people
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Idaho_angler



Joined: 29 Oct 2007
Posts: 14

PostPosted: Wed Feb 25, 2009 10:39 pm    Post subject: creating an application to manage a large list of people Reply with quote

Hi all and thanks in advance for any help


Please bear with me b/c I am not sure of the lingo. I want to try something that you might consider simple. I want to take create a GUI application that has 4 equal quadrants or maybe even 6 quadrants with a total size of 530x580. In the upper left it will have a column of 400 people. I want to click on the 1st person and see in the upper right corner his handicap, in the lower left corner his home course and in the lower right corner his telephone number. I would ideally like to have more information that just that but I assume you get the idea.

I would love to also put a “find” window to search for a person name in the upper left quadrant, hit “find” or “ok” and go that person.

I hope this makes some sense.

Is this something that Smart GUI can do?


Thanks,
Back to top
View user's profile Send private message
evan



Joined: 19 Feb 2009
Posts: 125

PostPosted: Wed Feb 25, 2009 11:10 pm    Post subject: Reply with quote

probably IniRead/Write will be a good idea if u want to organize things neat and tight
Code:
[Evan]
sex=Male
Phone=123-123-1234
City=Houston

but for speed-wise (for 400 lists, it shouldnt make noticeable difference), create a list like:
Code:
Evan|Male|123-123-1234|Houston

then stringsplit it
this method is faster because on the first run, the program already stores all necessary variable in memory, so the output should be instance compare to IniRead, u read the value when u call it

make a list and display it all on listview first
we will see ur code and edit it accordingly
find function is not hard at all, it just involve gLabel and IfInString commands
Back to top
View user's profile Send private message
evan



Joined: 19 Feb 2009
Posts: 125

PostPosted: Thu Feb 26, 2009 4:40 am    Post subject: Reply with quote

i got some free time and wrote this:
Code:
FileRead, OutputVar, %A_desktop%\list.txt

Loop, parse, OutputVar, `n, `r 

StringSplit, Array, A_LoopField , |
namelist = %namelist%`n%array1%
%array1%age = %array2%
%array1%phone = %array3%
%array1%sex = %array4%
}


base on the stored text is in the following format:
Code:

;Name|age|phone|sex|
Mary|16|1307325277|female|
Peter|19|1244816008|male|
Casey|26|1406874741|female|
John|20|1177261634|male|
Sally|14|1348039485|female|
Winnie|18|1389722843|female|

the above script will store all the variables that u need for the listview
example:
Code:

Maryage=16
Maryphone=1307325277
Marrysex=female
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Feb 26, 2009 7:56 am    Post subject: Reply with quote

why not csv?
Back to top
Idaho_angler



Joined: 29 Oct 2007
Posts: 14

PostPosted: Thu Feb 26, 2009 3:35 pm    Post subject: Reply with quote

evan wrote:
i got some free time and wrote this:
Code:
FileRead, OutputVar, %A_desktop%\list.txt

Loop, parse, OutputVar, `n, `r 

StringSplit, Array, A_LoopField , |
namelist = %namelist%`n%array1%
%array1%age = %array2%
%array1%phone = %array3%
%array1%sex = %array4%
}


base on the stored text is in the following format:
Code:

;Name|age|phone|sex|
Mary|16|1307325277|female|
Peter|19|1244816008|male|
Casey|26|1406874741|female|
John|20|1177261634|male|
Sally|14|1348039485|female|
Winnie|18|1389722843|female|

the above script will store all the variables that u need for the listview
example:
Code:

Maryage=16
Maryphone=1307325277
Marrysex=female


thank you --

I assume that I C&P the code and save as test.ahk to desktop and the other as list.txt on desktop.
I get the error message "illegal charater" ";Nameage"

sorry - I am very green
Back to top
View user's profile Send private message
Drugwash



Joined: 07 Sep 2008
Posts: 921
Location: Ploiesti, RO

PostPosted: Thu Feb 26, 2009 3:49 pm    Post subject: Reply with quote

There's no check in the script to remove comments from the text file. What you see in green in the second codebox ( ;Name|age|phone|sex| ) is a comment that should be removed; it's only there for you to understand what each field represents.
_________________
AHK tools by Drugwash
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Idaho_angler



Joined: 29 Oct 2007
Posts: 14

PostPosted: Thu Feb 26, 2009 4:31 pm    Post subject: Reply with quote

Drugwash wrote:
There's no check in the script to remove comments from the text file. What you see in green in the second codebox ( ;Name|age|phone|sex| ) is a comment that should be removed; it's only there for you to understand what each field represents.


thanks -- if that was in the script it would be ignore b/c of the ";" correct but since it is in the txt file it creates the error, right?

so can you make that work? I have two files saved to my desktop

names.ahk and list.txt --- when I double-click the names.ahk -- nothing happens. what am I missing?

thanks
Back to top
View user's profile Send private message
evan



Joined: 19 Feb 2009
Posts: 125

PostPosted: Thu Feb 26, 2009 4:47 pm    Post subject: Reply with quote

all i did is combine the list.txt, read list.txt function and listview gui
full working code:
Code:
OutputVar=
(
Mary|16|1307325277|female|
Peter|19|1244816008|male|
Casey|26|1406874741|female|
John|20|1177261634|male|
Sally|14|1348039485|female|
Winnie|18|1389722843|female|
)
Loop, parse, OutputVar, `n, `r
{
StringSplit, Array, A_LoopField , |
namelist = %namelist%`n%array1%
%array1%age = %array2%
%array1%phone = %array3%
%array1%sex = %array4%
}
Gui, Add, Edit, r1 vSearchWord gSearch,
Gui, Add, ListView, r15 w300 grid gMyListView, Name (double click me)
Loop, parse, namelist, `n, `r
{
if A_loopfield !=
LV_Add("", A_LoopField)
}
Gui, show
return
MyListView:
if A_GuiEvent = DoubleClick
{
LV_GetText(RowText, A_EventInfo)
age:=%RowText%age
phone:=%RowText%phone
sex:=%RowText%sex
msgbox, name:%RowText%`nage:%age%`nphone:%phone%`nsex:%sex%
}
return
Search:
Gui, submit, nohide
LV_Delete()
Loop, parse, namelist, `n, `r
{
StringGetPos, pos, A_loopfield, %SearchWord%
If pos = 0
{
if A_loopfield !=
LV_Add("", A_loopfield)
}
}
return


Last edited by evan on Thu Feb 26, 2009 5:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
Idaho_angler



Joined: 29 Oct 2007
Posts: 14

PostPosted: Thu Feb 26, 2009 5:13 pm    Post subject: Reply with quote

very cool -- and that is extremely close to what I am lookign to achieve


I obviously have a lot to learn and I appreciate your patience.

Here is the screen shot GUI and the code for the GUI.



Gui, Add, GroupBox, x9 y25 w500 h260 ,
Gui, Add, ListView, x14 y53 w240 h180 , Name
Gui, Add, ListView, x264 y53 w240 h180 , Age
Gui, Add, Text, x14 y243 w79 h13 , Find Person :
Gui, Add, Edit, x103 y240 w140 h21 ,
Gui, Add, Button, x253 y240 w27 h23 , OK
Gui, Add, GroupBox, x9 y291 w500 h230 ,
Gui, Add, ListView, x14 y311 w240 h200 , Sex
Gui, Add, ListView, x264 y311 w240 h200 , Phone Number
; Generated using SmartGUI Creator 4.0
Gui, Show, x343 y152 h528 w520,

I want to take the data : name age phone number sex (Mary|16|1307325277|female|) from list.txt and place it in each ListView. When I click the ListView name, I want to only see the data for that person in each other ListView.

Thanks and please tell me if this is a long and arduous task.
Back to top
View user's profile Send private message
evan



Joined: 19 Feb 2009
Posts: 125

PostPosted: Thu Feb 26, 2009 5:15 pm    Post subject: Reply with quote

i just update the last script with searching function, please check
Back to top
View user's profile Send private message
Idaho_angler



Joined: 29 Oct 2007
Posts: 14

PostPosted: Thu Feb 26, 2009 5:34 pm    Post subject: Reply with quote

evan wrote:
i just update the last script with searching function, please check


that is very cool -- now I just need to figure out how to modify to look and work like the screen shot above


thank you very much! it is a great start for me!


ok -- where is this symbol on my keyboard -- "|"
Back to top
View user's profile Send private message
evan



Joined: 19 Feb 2009
Posts: 125

PostPosted: Thu Feb 26, 2009 5:38 pm    Post subject: Reply with quote

right to [ ] keys
Back to top
View user's profile Send private message
Idaho_angler



Joined: 29 Oct 2007
Posts: 14

PostPosted: Thu Feb 26, 2009 5:43 pm    Post subject: Reply with quote

evan wrote:
right to [ ] keys



many thanks --

how hard would it be to change the GUI from what you made to what I posted in my screen shot?
Back to top
View user's profile Send private message
Idaho_angler



Joined: 29 Oct 2007
Posts: 14

PostPosted: Thu Feb 26, 2009 8:31 pm    Post subject: Reply with quote

can anyone help me get the data

Mary|16|1307325277|female| to show up in this GUI



thanks
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Fri Feb 27, 2009 4:04 am    Post subject: Reply with quote

Idaho_angler wrote:
can anyone help me get the data


Where is the data?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group