AutoHotkey Community

It is currently May 26th, 2012, 5:08 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: February 25th, 2009, 11:39 pm 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
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,


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 12:10 am 
Offline

Joined: February 19th, 2009, 6:44 pm
Posts: 125
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 5:40 am 
Offline

Joined: February 19th, 2009, 6:44 pm
Posts: 125
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 8:56 am 
why not csv?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 4:35 pm 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 4:49 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
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 (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 5:31 pm 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 5:47 pm 
Offline

Joined: February 19th, 2009, 6:44 pm
Posts: 125
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 February 26th, 2009, 6:15 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 6:13 pm 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
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.

Image

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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 6:15 pm 
Offline

Joined: February 19th, 2009, 6:44 pm
Posts: 125
i just update the last script with searching function, please check


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 6:34 pm 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
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 -- "|"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 6:38 pm 
Offline

Joined: February 19th, 2009, 6:44 pm
Posts: 125
right to [ ] keys


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 6:43 pm 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 9:31 pm 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
can anyone help me get the data

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

Image

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2009, 5:04 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Idaho_angler wrote:
can anyone help me get the data


Where is the data?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Miguel, rbrtryn and 70 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group