AutoHotkey Community

It is currently May 26th, 2012, 10:28 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 27th, 2009, 8:02 am 
SKAN wrote:
Idaho_angler wrote:
can anyone help me get the data


Where is the data?


text file


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2009, 8:03 am 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
I wrote that -- sorry I wasn't logged in

the data can be from a text file.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2009, 2:32 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
This thread somehow gave me the impulse to build a sort of an address book. The job is pretty tedious since I already came up with a lot of info fields to fill in and the data file will grow very large (dunno how to work with SQL DB or the like).

Anyway, to your script: I wonder why you'd want a listview for each individual info retrieved from the contact? I'd rather just add the age, sex and phone number as text fields to the right of the names list and have them displayed on contact selection.

Code:
________________________
|                       | age: <value>
|                       | sex: <value>
|                       | phone no: <value>
|_______________________|
________________________
[_______________________] <- search field

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2009, 4:28 pm 
Offline

Joined: October 29th, 2007, 11:57 pm
Posts: 14
thanks for the reply. I am open to suggestions as to the best approach. I am just trying to figure out the best approach to achieve placing data into 4 or more different windows. I am not married to Listview, in fact I really have no idea the best approach. I just want to be able to have the upper left window show the master list. When I double click on the name, I want data put into the 3 other windows.

I am looking for a template to do this for name|age|phone #|sex

or for organizing my x-mas list
or my next fundraiser.
or my hockey team and the carpool information.
anything.....

I know that there are databases for this but I thought it would be fun to see how it worked using AHKS.


thanks


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

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
Would this be satisfying for you?
Code:
FileRead, OutputVar, names.txt
Loop, parse, OutputVar, `n, `r
{
StringSplit, Array, A_LoopField , |
namelist = %namelist%`n%array1%
%array1%age = %array2%
%array1%phone = %array3%
%array1%sex = %array4%
}
Gui, Add, ListView, x 10 y10 r15 w200 grid gMyListView, Name (double click me)
Gui, Add, Edit, r1 w200 vSearchWord gSearch,
Gui, Add, Text, x220 y10 w40, Age:
Gui, Add, Text, xp y+2 wp, Sex:
Gui, Add, Text, xp y+2 wp, Phone:
Gui, Add, Text, x265 y10 w100 vage,
Gui, Add, Text, xp wp y+2 vsex,
Gui, Add, Text, xp wp y+2 vphone,
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
GuiControl,, age, %age%
GuiControl,, sex, %sex%
GuiControl,, phone, %phone%
;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

GuiClose:
ExitApp

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


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

Joined: November 19th, 2008, 12:06 am
Posts: 101
wowwwww that is wicked nice ^^^ it works prefectly.

how long did that take you to code?

i might even use it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 28th, 2009, 12:47 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
Not much, but I didn't time it. Anybody's free to use it. Enjoy! ;)

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 15th, 2009, 3:23 am 
Offline

Joined: December 25th, 2008, 3:59 am
Posts: 3
I used the code from the above example but I would like to add some different things to it but can't figure out how. What I would like is to have a box with a database of names and have a search box to be able to search for individual names and click on the name it found as I type and then display the person contact info in another box. I would like to be able to copy and paste the contact information. Like I said I used the above code and have most of the part but can't figure out how to do the rest. Below is how I modified the code but I would like it to look like the screen shot below. Any help is greatly appreciated.

Image


Code:
FileRead, OutputVar, names.txt
Loop, parse, OutputVar, `n, `r
{
StringSplit, Array, A_LoopField , |
namelist = %namelist%`n%array1%
%array1%address = %array2%
%array1%name = %array3%
%array1%ebayid = %array4%
%array1%city = %array5%
%array1%state = %array6%
%array1%zip = %array7%
}
Gui, Show, x219 y214 h277 w500, New GUI Window
Gui, Add, ListView, x 10 y10 r15 w200 grid gMyListView, Name (double click me)
Gui, Add, Edit, r1 w200 vSearchWord gSearch,
Gui, Add, Text, x230 y108 w41 h13 , Address:
Gui, Add, Text, x230 y78 w41 h13 , Ebay ID:
Gui, Add, Text, x230 y93 w41 h13 , Name:
Gui, Add, Text, x230 y123 w41 h13 , City:
Gui, Add, Text, x230 y138 w41 h13 , State:
Gui, Add, Text, x230 y153 w41 h13 , Zip:
Gui, Add, Text, x279 y108 w300 h13 vaddress,
Gui, Add, Text, x279 y78 w300 h13 vebayid,
Gui, Add, Text, x279 y93 w300 h13 vname,
Gui, Add, Text, x279 y123 w300 h13 vcity,
Gui, Add, Text, x279 y138 w300 h13 vstate,
Gui, Add, Text, x279 y153 w300 h13 vzip,

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)
address:=%RowText%address
name:=%RowText%name
ebayid:=%RowText%ebayid
city:=%RowText%city
state:=%RowText%state
zip:=%RowText%zip
GuiControl,, address, %address%
GuiControl,, ebayid, %ebayid%
GuiControl,, name, %name%
GuiControl,, city, %city%
GuiControl,, state, %state%
GuiControl,, zip, %zip%
;msgbox, name:%RowText%`naddress:%address%`nname:%name%`nebayID:%ebayID%`ncity:%city%`nstate:%state%`nzip:%zip%
}
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

GuiClose:
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 15th, 2009, 12:43 pm 
Offline

Joined: August 13th, 2006, 6:45 am
Posts: 355
Location: Germany
MrPDIsMe wrote:
I used the code from the above example but I would like to add some different things to it but can't figure out how.

Hi, this is my suggestion:
Code:
;for testing without file
outputvar =
(
a|a1|a2|a3|a4|a5|a6
b|b1|b2|b3|b4|b5|b6
)
FileRead, OutputVar, names.txt

Loop, parse, OutputVar, `n, `r
{
StringSplit, Array, A_LoopField , |
no++
namelist = %namelist%`n%array1%|%no%
#%no%#address = %array2%
#%no%#name = %array3%
#%no%#ebayid = %array4%
#%no%#city = %array5%
#%no%#state = %array6%
#%no%#zip = %array7%
}
Gui, Show, x219 y214 h277 w500, New GUI Window
Gui, Add, ListView, x 10 y10 r15 w200 grid gMyListView, Name (double click me)|No
Gui, Add, Edit, r1 w200 vSearchWord gSearch,
;Gui, Add, Text, x230 y108 w41 h13 , Address:
Gui, Add, Text, x230 y78 w41 h13 , Ebay ID:
;Gui, Add, Text, x230 y93 w41 h13 , Name:
;Gui, Add, Text, x230 y123 w41 h13 , City:
;Gui, Add, Text, x230 y138 w41 h13 , State:
;Gui, Add, Text, x230 y153 w41 h13 , Zip:
Gui, Add, Text, x230 y183 w41 h13 , Info:
;Gui, Add, Text, x279 y108 w300 h13 vaddress,
Gui, Add, Text, x279 y78 w300 h13 vebayid,
;Gui, Add, Text, x279 y93 w300 h13 vname,
;Gui, Add, Text, x279 y123 w300 h13 vcity,
;Gui, Add, Text, x279 y138 w300 h13 vstate,
;Gui, Add, Text, x279 y153 w300 h13 vzip,
Gui, Add, Text, x279 y183 w300 h52 vinfo ginfo,

Loop, parse, namelist, `n, `r
{
if A_loopfield !=
{
stringsplit, Contact, a_loopfield, |
LV_Add("", Contact1, Contact2)
}
}
LV_ModifyCol(1, 200)
LV_ModifyCol(2, 0)
Gui, show
return

MyListView:
if A_GuiEvent = DoubleClick
{
LV_GetText(RowText, A_EventInfo, 2)
address:=#%RowText%#address
name:=#%RowText%#name
ebayid:=#%RowText%#ebayid
city:=#%RowText%#city
state:=#%RowText%#state
zip:=#%RowText%#zip
GuiControl,, address, %address%
GuiControl,, ebayid, %ebayid%
GuiControl,, name, %name%
GuiControl,, city, %city%
GuiControl,, state, %state%
GuiControl,, zip, %zip%
guicontrol,, info, %name%`n%address%`n%city%  %state%  %zip%
;msgbox, name:#%RowText%#`naddress:%address%`nname:%name%`nebayID:%ebayID%`ncity:%city%`nstate:%state%`nzip:%zip%
}
return

info:
clipboard = %name%`n%address%`n%city%  %state%  %zip%
msgbox, %name%`n%address%`n%city%  %state%  %zip%`n`nis copied to clipboard
return

Search:
Gui, submit, nohide
LV_Delete()
Loop, parse, namelist, `n, `r
{
StringGetPos, pos, A_loopfield, %SearchWord%
If pos = 0
{
if A_loopfield !=
{
stringsplit, Contact, a_loopfield, |
LV_Add("", Contact1, Contact2)
}
}
LV_ModifyCol(1, 200)
LV_ModifyCol(2, 0)
}
return

GuiClose:
ExitApp
I changed the naming of the used array to avoid problems with "invalid variable", if the names contain spaces or other invalid characters (invalid for variable names). I use a second column in the listview with the associated number and made it invisible.

A click on the new Info Box puts its content into the clipboard for further use.

Hubert


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2009, 10:28 am 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
For best results in all situations, the Info box should be a RichEdit control and the data should be both input and stored as UTF-8 (for compatibility with most Windows versions but mainly for Unicode capability - foreign names and/or addresses). Unfortunately, I cannot provide a working example since I'll still be away from my environment for at least a month or two, but anybody willing can take a look at the cRichEdit wrapper.


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 Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: AndyJenk, Bing [Bot], JSLover, Miguel, patgenn123, rbrtryn and 68 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