Sign in to follow this  
Followers 0
Senach

Help setting gui fields

9 posts in this topic

#1 ·  Posted (edited)

Howdy all.

Ok, I'm trying to write a script that will have a gui form that can be filled in with both a dropdown and free text fields, and then have the info written to a file. With some previous help, I got that part done. Now Im trying to figure out how to have the script get the previously entered info from the file and put it back into the form. I know I have to do the IniRead command, but I wasnt sure how to do it in the gui part.

Anyway, below is what I have. Any help or pointers would be greatly appreciated.

Thank you.

CODE
#include <GUIConstants.au3>

;below is the test to see if it does pull the info from the ini file

;aisle 1

$loc1 = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1", "")

$start1 = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1", "")

$end1 = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1", "")

$loc1a = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1a", "")

$start1a = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1a", "")

$end1a = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1a", "")

$loc1b = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1b", "")

$start1b = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1b", "")

$end1b = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1b", "")

;aisle 2

$loc2 = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2", "")

$start2 = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2", "")

$end2 = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2", "")

$loc2a = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2a", "")

$start2a = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2a", "")

$end2a = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2a", "")

$loc2b = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2b", "")

$start2b = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2b", "")

$end2b = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2b", "")

GUICreate(" My GUI input acceptfile", 560,550, @DesktopWidth/2-260, @DesktopHeight/2-315, $WS_VSCROLL, 0x00000018); WS_EX_ACCEPTFILES

;GUICtrlCreateLabel("text", left, top)

GUICtrlCreateLabel("Enter information for whats down each aisle choosing the location and then entering ", 28, 10)

GUICtrlCreateLabel("the first letter of the call # for fiction or the 3 digit call # for non-fiction", 28,30)

GUICtrlCreateLabel("Use the 2nd and 3rd lines if multiple locations are on a paticular aisle.", 28,50)

;following location of the colums #,# = from left, from top

GUICtrlCreateLabel("Aisle", 10,70)

GUICtrlCreateLabel("Location", 70,70)

GUICtrlCreateLabel("Start of Aisle", 300,70)

GUICtrlCreateLabel("End of Aisle", 420,70)

;aisle xb to next aisle = 30. between sub aisle's = 25

;aisle 1

GUICtrlCreateLabel("1", 10,90)

;location

$loc1 = GUICtrlCreateCombo ("", 70,90, 200, 20)

;GuiCtrlSetData(-1, $loc1, $list_jc, "...")

GUICtrlSetData(-1,"Jaa JC Adult Audiovisual| jaas JC Adult Spanish Audiovisual| jab JC Adult Biography| jac JC Adult Science Fiction| jacf JC Adult Christian Fict| jad JC Adult Display| jaf JC Adult Fiction| jag JC Adult Graphic Novel| jai JC Adult Walk-In| jaj Periodical Prf Collection| jak JC Adult Book Club| jal JC Adult Large Print| jam JC Adult Missouri| jamg JC Adult Genealogy| jamgo JC Adult Genealogy Ovrsz| jamo JC Adult MO Oversize| jan JC Adult Nonfiction| jano JC Adult Oversize| jao JC Adult Romance| jap JC Adult Periodical| japc JC Adult Holiday Magazine| japmf JC Adult Periodical Micro-form| japn JC Adult Newspaper| jaq JC Adult Testbook| jar JC Adult Reference| jara JC Adult Ref Auto| jarb JC Adult Ref Business| jarc Business Prof Collection| jare JC Adult Ref Medical| jarg JC Adult Ref MO Genealogy| jargo JC Adult RMO Gen Oversize| jarj Asst Dir Prof Collection| jark HR Prof Collection| jarl JC Adult Ref Legal| jarm JC Adult Ref Missouri| jarmo JC Adult Ref MO Oversize| jarp JC Adult Ref Periodical| jarr JC Adult Reference Desk| jars JC Adult Ref Atlas| jart Director Prof Collection| jarta Admin Offices Prof Coll| jaru Reference Prof Collection| jarv Tech Serv Prof Collection| jarw Comp Serv Prof Collection| jarx Childrens Prof Collection| jary PR Prof Collection| jarz Circ Prof Collection| jas JC Adult Spanish| jau Inter Library Loan| jaw JC Adult Western| jay JC Adult Mystery| jpcc JC Public Computer Center| jprc JC Public Reference Computers| jtd JC Teen Display| jtf JC Teen Fiction| jtg JC Teen Graphic Book| jtk JC Teen Book Club| jtp JC Teen Periodical| jca JC Children's Audiovisual| jcb JC Children's Biography| jcce Main Child Computer Equipment| jcd JC Children's Display| jce JC Children's Easy Reader| jcf JC Children's Fiction| jcfp JC Children's Small Book| jch JC Children's Story Hour| jck JC Children's Book Club| jcm JC Children's Missouri| jcn JC Children's Nonfiction| jcp JC Children's Periodical| jcr JC Children's Reference| jcrm JC Children's Ref MO| jcs JC Children's Spanish| jct JC Children's PT| jcv JC Children's Award Book| jcx JC Children's Picture Bk| jcxb JC Children's Board Book| jcz JC Children's RSR| ", "")

;GUICtrlCreateInput ( "text", left, top [, width [, height [, style [, exStyle]]]] )

;start of aisle

$start1 = GUICtrlCreateInput ( "", 300, 90, 100, 20)

GUICtrlSetState(-1,$GUI_DROPACCEPTED)

;end of aisle

$end1 = GUICtrlCreateInput ("", 420, 90, 100, 20)

;aisle 1a

GUICtrlCreateLabel("1a", 20,115)

;location

$loc1a = GUICtrlCreateCombo ("", 70,115, 200, 20)

GUICtrlSetData(-1,"Jaa JC Adult Audiovisual| jaas JC Adult Spanish Audiovisual| jab JC Adult Biography| jac JC Adult Science Fiction| jacf JC Adult Christian Fict| jad JC Adult Display| jaf JC Adult Fiction| jag JC Adult Graphic Novel| jai JC Adult Walk-In| jaj Periodical Prf Collection| jak JC Adult Book Club| jal JC Adult Large Print| jam JC Adult Missouri| jamg JC Adult Genealogy| jamgo JC Adult Genealogy Ovrsz| jamo JC Adult MO Oversize| jan JC Adult Nonfiction| jano JC Adult Oversize| jao JC Adult Romance| jap JC Adult Periodical| japc JC Adult Holiday Magazine| japmf JC Adult Periodical Micro-form| japn JC Adult Newspaper| jaq JC Adult Testbook| jar JC Adult Reference| jara JC Adult Ref Auto| jarb JC Adult Ref Business| jarc Business Prof Collection| jare JC Adult Ref Medical| jarg JC Adult Ref MO Genealogy| jargo JC Adult RMO Gen Oversize| jarj Asst Dir Prof Collection| jark HR Prof Collection| jarl JC Adult Ref Legal| jarm JC Adult Ref Missouri| jarmo JC Adult Ref MO Oversize| jarp JC Adult Ref Periodical| jarr JC Adult Reference Desk| jars JC Adult Ref Atlas| jart Director Prof Collection| jarta Admin Offices Prof Coll| jaru Reference Prof Collection| jarv Tech Serv Prof Collection| jarw Comp Serv Prof Collection| jarx Childrens Prof Collection| jary PR Prof Collection| jarz Circ Prof Collection| jas JC Adult Spanish| jau Inter Library Loan| jaw JC Adult Western| jay JC Adult Mystery| jpcc JC Public Computer Center| jprc JC Public Reference Computers| jtd JC Teen Display| jtf JC Teen Fiction| jtg JC Teen Graphic Book| jtk JC Teen Book Club| jtp JC Teen Periodical| jca JC Children's Audiovisual| jcb JC Children's Biography| jcce Main Child Computer Equipment| jcd JC Children's Display| jce JC Children's Easy Reader| jcf JC Children's Fiction| jcfp JC Children's Small Book| jch JC Children's Story Hour| jck JC Children's Book Club| jcm JC Children's Missouri| jcn JC Children's Nonfiction| jcp JC Children's Periodical| jcr JC Children's Reference| jcrm JC Children's Ref MO| jcs JC Children's Spanish| jct JC Children's PT| jcv JC Children's Award Book| jcx JC Children's Picture Bk| jcxb JC Children's Board Book| jcz JC Children's RSR| ", "")

;GUICtrlCreateInput ( "text", left, top [, width [, height [, style [, exStyle]]]] )

;start of aisle

$start1a = GUICtrlCreateInput ( "", 300, 115, 100, 20)

GUICtrlSetState(-1,$GUI_DROPACCEPTED)

;end of aisle

$end1a = GUICtrlCreateInput ("", 420, 115, 100, 20)

;aisle 1b

GUICtrlCreateLabel("1b", 20,140)

;location

$loc1b = GUICtrlCreateCombo ("", 70,140, 200, 20)

GUICtrlSetData(-1,"Jaa JC Adult Audiovisual| jaas JC Adult Spanish Audiovisual| jab JC Adult Biography| jac JC Adult Science Fiction| jacf JC Adult Christian Fict| jad JC Adult Display| jaf JC Adult Fiction| jag JC Adult Graphic Novel| jai JC Adult Walk-In| jaj Periodical Prf Collection| jak JC Adult Book Club| jal JC Adult Large Print| jam JC Adult Missouri| jamg JC Adult Genealogy| jamgo JC Adult Genealogy Ovrsz| jamo JC Adult MO Oversize| jan JC Adult Nonfiction| jano JC Adult Oversize| jao JC Adult Romance| jap JC Adult Periodical| japc JC Adult Holiday Magazine| japmf JC Adult Periodical Micro-form| japn JC Adult Newspaper| jaq JC Adult Testbook| jar JC Adult Reference| jara JC Adult Ref Auto| jarb JC Adult Ref Business| jarc Business Prof Collection| jare JC Adult Ref Medical| jarg JC Adult Ref MO Genealogy| jargo JC Adult RMO Gen Oversize| jarj Asst Dir Prof Collection| jark HR Prof Collection| jarl JC Adult Ref Legal| jarm JC Adult Ref Missouri| jarmo JC Adult Ref MO Oversize| jarp JC Adult Ref Periodical| jarr JC Adult Reference Desk| jars JC Adult Ref Atlas| jart Director Prof Collection| jarta Admin Offices Prof Coll| jaru Reference Prof Collection| jarv Tech Serv Prof Collection| jarw Comp Serv Prof Collection| jarx Childrens Prof Collection| jary PR Prof Collection| jarz Circ Prof Collection| jas JC Adult Spanish| jau Inter Library Loan| jaw JC Adult Western| jay JC Adult Mystery| jpcc JC Public Computer Center| jprc JC Public Reference Computers| jtd JC Teen Display| jtf JC Teen Fiction| jtg JC Teen Graphic Book| jtk JC Teen Book Club| jtp JC Teen Periodical| jca JC Children's Audiovisual| jcb JC Children's Biography| jcce Main Child Computer Equipment| jcd JC Children's Display| jce JC Children's Easy Reader| jcf JC Children's Fiction| jcfp JC Children's Small Book| jch JC Children's Story Hour| jck JC Children's Book Club| jcm JC Children's Missouri| jcn JC Children's Nonfiction| jcp JC Children's Periodical| jcr JC Children's Reference| jcrm JC Children's Ref MO| jcs JC Children's Spanish| jct JC Children's PT| jcv JC Children's Award Book| jcx JC Children's Picture Bk| jcxb JC Children's Board Book| jcz JC Children's RSR| ", "")

;GUICtrlCreateInput ( "text", left, top [, width [, height [, style [, exStyle]]]] )

;start of aisle

$start1b = GUICtrlCreateInput ( "", 300, 140, 100, 20)

GUICtrlSetState(-1,$GUI_DROPACCEPTED)

;end of aisle

$end1b = GUICtrlCreateInput ("", 420, 140, 100, 20)

;aisle 2

GUICtrlCreateLabel("2", 10,170)

;location

$loc2 = GUICtrlCreateCombo ("", 70,170, 200, 20)

GUICtrlSetData(-1,"Jaa JC Adult Audiovisual| jaas JC Adult Spanish Audiovisual| jab JC Adult Biography| jac JC Adult Science Fiction| jacf JC Adult Christian Fict| jad JC Adult Display| jaf JC Adult Fiction| jag JC Adult Graphic Novel| jai JC Adult Walk-In| jaj Periodical Prf Collection| jak JC Adult Book Club| jal JC Adult Large Print| jam JC Adult Missouri| jamg JC Adult Genealogy| jamgo JC Adult Genealogy Ovrsz| jamo JC Adult MO Oversize| jan JC Adult Nonfiction| jano JC Adult Oversize| jao JC Adult Romance| jap JC Adult Periodical| japc JC Adult Holiday Magazine| japmf JC Adult Periodical Micro-form| japn JC Adult Newspaper| jaq JC Adult Testbook| jar JC Adult Reference| jara JC Adult Ref Auto| jarb JC Adult Ref Business| jarc Business Prof Collection| jare JC Adult Ref Medical| jarg JC Adult Ref MO Genealogy| jargo JC Adult RMO Gen Oversize| jarj Asst Dir Prof Collection| jark HR Prof Collection| jarl JC Adult Ref Legal| jarm JC Adult Ref Missouri| jarmo JC Adult Ref MO Oversize| jarp JC Adult Ref Periodical| jarr JC Adult Reference Desk| jars JC Adult Ref Atlas| jart Director Prof Collection| jarta Admin Offices Prof Coll| jaru Reference Prof Collection| jarv Tech Serv Prof Collection| jarw Comp Serv Prof Collection| jarx Childrens Prof Collection| jary PR Prof Collection| jarz Circ Prof Collection| jas JC Adult Spanish| jau Inter Library Loan| jaw JC Adult Western| jay JC Adult Mystery| jpcc JC Public Computer Center| jprc JC Public Reference Computers| jtd JC Teen Display| jtf JC Teen Fiction| jtg JC Teen Graphic Book| jtk JC Teen Book Club| jtp JC Teen Periodical| jca JC Children's Audiovisual| jcb JC Children's Biography| jcce Main Child Computer Equipment| jcd JC Children's Display| jce JC Children's Easy Reader| jcf JC Children's Fiction| jcfp JC Children's Small Book| jch JC Children's Story Hour| jck JC Children's Book Club| jcm JC Children's Missouri| jcn JC Children's Nonfiction| jcp JC Children's Periodical| jcr JC Children's Reference| jcrm JC Children's Ref MO| jcs JC Children's Spanish| jct JC Children's PT| jcv JC Children's Award Book| jcx JC Children's Picture Bk| jcxb JC Children's Board Book| jcz JC Children's RSR| ", "")

;GUICtrlCreateInput ( "text", left, top [, width [, height [, style [, exStyle]]]] )

;start of aisle

$start2 = GUICtrlCreateInput ( "", 300, 170, 100, 20)

GUICtrlSetState(-1,$GUI_DROPACCEPTED)

;end of aisle

$end2 = GUICtrlCreateInput ("", 420, 170, 100, 20)

;aisle 2a

GUICtrlCreateLabel("2a", 20,195)

;location

$loc2a = GUICtrlCreateCombo ("", 70,195, 200, 20)

GUICtrlSetData(-1,"Jaa JC Adult Audiovisual| jaas JC Adult Spanish Audiovisual| jab JC Adult Biography| jac JC Adult Science Fiction| jacf JC Adult Christian Fict| jad JC Adult Display| jaf JC Adult Fiction| jag JC Adult Graphic Novel| jai JC Adult Walk-In| jaj Periodical Prf Collection| jak JC Adult Book Club| jal JC Adult Large Print| jam JC Adult Missouri| jamg JC Adult Genealogy| jamgo JC Adult Genealogy Ovrsz| jamo JC Adult MO Oversize| jan JC Adult Nonfiction| jano JC Adult Oversize| jao JC Adult Romance| jap JC Adult Periodical| japc JC Adult Holiday Magazine| japmf JC Adult Periodical Micro-form| japn JC Adult Newspaper| jaq JC Adult Testbook| jar JC Adult Reference| jara JC Adult Ref Auto| jarb JC Adult Ref Business| jarc Business Prof Collection| jare JC Adult Ref Medical| jarg JC Adult Ref MO Genealogy| jargo JC Adult RMO Gen Oversize| jarj Asst Dir Prof Collection| jark HR Prof Collection| jarl JC Adult Ref Legal| jarm JC Adult Ref Missouri| jarmo JC Adult Ref MO Oversize| jarp JC Adult Ref Periodical| jarr JC Adult Reference Desk| jars JC Adult Ref Atlas| jart Director Prof Collection| jarta Admin Offices Prof Coll| jaru Reference Prof Collection| jarv Tech Serv Prof Collection| jarw Comp Serv Prof Collection| jarx Childrens Prof Collection| jary PR Prof Collection| jarz Circ Prof Collection| jas JC Adult Spanish| jau Inter Library Loan| jaw JC Adult Western| jay JC Adult Mystery| jpcc JC Public Computer Center| jprc JC Public Reference Computers| jtd JC Teen Display| jtf JC Teen Fiction| jtg JC Teen Graphic Book| jtk JC Teen Book Club| jtp JC Teen Periodical| jca JC Children's Audiovisual| jcb JC Children's Biography| jcce Main Child Computer Equipment| jcd JC Children's Display| jce JC Children's Easy Reader| jcf JC Children's Fiction| jcfp JC Children's Small Book| jch JC Children's Story Hour| jck JC Children's Book Club| jcm JC Children's Missouri| jcn JC Children's Nonfiction| jcp JC Children's Periodical| jcr JC Children's Reference| jcrm JC Children's Ref MO| jcs JC Children's Spanish| jct JC Children's PT| jcv JC Children's Award Book| jcx JC Children's Picture Bk| jcxb JC Children's Board Book| jcz JC Children's RSR| ", "")

;GUICtrlCreateInput ( "text", left, top [, width [, height [, style [, exStyle]]]] )

;start of aisle

$start2a = GUICtrlCreateInput ( "", 300, 195, 100, 20)

GUICtrlSetState(-1,$GUI_DROPACCEPTED)

;end of aisle

$end2a = GUICtrlCreateInput ("", 420, 195, 100, 20)

;aisle 2b

GUICtrlCreateLabel("2b", 20,220)

;location

$loc2b = GUICtrlCreateCombo ("", 70,220, 200, 20)

GUICtrlSetData(-1,"Jaa JC Adult Audiovisual| jaas JC Adult Spanish Audiovisual| jab JC Adult Biography| jac JC Adult Science Fiction| jacf JC Adult Christian Fict| jad JC Adult Display| jaf JC Adult Fiction| jag JC Adult Graphic Novel| jai JC Adult Walk-In| jaj Periodical Prf Collection| jak JC Adult Book Club| jal JC Adult Large Print| jam JC Adult Missouri| jamg JC Adult Genealogy| jamgo JC Adult Genealogy Ovrsz| jamo JC Adult MO Oversize| jan JC Adult Nonfiction| jano JC Adult Oversize| jao JC Adult Romance| jap JC Adult Periodical| japc JC Adult Holiday Magazine| japmf JC Adult Periodical Micro-form| japn JC Adult Newspaper| jaq JC Adult Testbook| jar JC Adult Reference| jara JC Adult Ref Auto| jarb JC Adult Ref Business| jarc Business Prof Collection| jare JC Adult Ref Medical| jarg JC Adult Ref MO Genealogy| jargo JC Adult RMO Gen Oversize| jarj Asst Dir Prof Collection| jark HR Prof Collection| jarl JC Adult Ref Legal| jarm JC Adult Ref Missouri| jarmo JC Adult Ref MO Oversize| jarp JC Adult Ref Periodical| jarr JC Adult Reference Desk| jars JC Adult Ref Atlas| jart Director Prof Collection| jarta Admin Offices Prof Coll| jaru Reference Prof Collection| jarv Tech Serv Prof Collection| jarw Comp Serv Prof Collection| jarx Childrens Prof Collection| jary PR Prof Collection| jarz Circ Prof Collection| jas JC Adult Spanish| jau Inter Library Loan| jaw JC Adult Western| jay JC Adult Mystery| jpcc JC Public Computer Center| jprc JC Public Reference Computers| jtd JC Teen Display| jtf JC Teen Fiction| jtg JC Teen Graphic Book| jtk JC Teen Book Club| jtp JC Teen Periodical| jca JC Children's Audiovisual| jcb JC Children's Biography| jcce Main Child Computer Equipment| jcd JC Children's Display| jce JC Children's Easy Reader| jcf JC Children's Fiction| jcfp JC Children's Small Book| jch JC Children's Story Hour| jck JC Children's Book Club| jcm JC Children's Missouri| jcn JC Children's Nonfiction| jcp JC Children's Periodical| jcr JC Children's Reference| jcrm JC Children's Ref MO| jcs JC Children's Spanish| jct JC Children's PT| jcv JC Children's Award Book| jcx JC Children's Picture Bk| jcxb JC Children's Board Book| jcz JC Children's RSR| ", "")

;GUICtrlCreateInput ( "text", left, top [, width [, height [, style [, exStyle]]]] )

;start of aisle

$start2b = GUICtrlCreateInput ( "", 300, 220, 100, 20)

GUICtrlSetState(-1,$GUI_DROPACCEPTED)

;end of aisle

$end2b = GUICtrlCreateInput ("", 420, 220, 100, 20)

;end button

$btn = GUICtrlCreateButton ("Ok", 20, 485, 60, 20)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $btn

exitloop

EndSelect

Wend

;

;below is test for using ini files commands iniwrite iniread

;IniWrite ( "filename", "section", "key", "value" )

;IniRead ( "filename", "section", "key", "default" )

;examples

;IniWrite("Variables.ini","Main","Data",$Data)

;To get it back later just do.

;$Data = IniRead("Variables.ini","Main","Data","")

;

;aisle 1

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1", GUICtrlRead($loc1))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1", GUICtrlRead($start1))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1", GUICtrlRead($end1))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1a", GUICtrlRead($loc1a))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1a", GUICtrlRead($start1a))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1a", GUICtrlRead($end1a))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1b", GUICtrlRead($loc1b))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1b", GUICtrlRead($start1b))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1b", GUICtrlRead($end1b))

;aisle 2

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2", GUICtrlRead($loc2))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2", GUICtrlRead($start2))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2", GUICtrlRead($end2))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2a", GUICtrlRead($loc2a))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2a", GUICtrlRead($start2a))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2a", GUICtrlRead($end2a))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2b", GUICtrlRead($loc2b))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2b", GUICtrlRead($start2b))

IniWrite("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2b", GUICtrlRead($end2b))

PS: I know that most of this scrip is very basic compared to some of the stuff Ive seen here on the forums, so forgive me. Im learning Autoit its just taking me a bit longer than I thought it would. :)

Edited by Senach

"The three rules of the Librarians of Time and Space are: 1) Silence; 2) Books must be returned no later than the date last shown; and 3) Do not interfere with the nature of causality." Terry Pratchett - The Light Fantastic

Share this post


Link to post
Share on other sites



Sure don't want your post dropping off into oblivion without any help!

First, you've read the ini data into variables with the same name as your actual controls...don't do that. Use this instead:

$loc1data = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1", "")
$start1data = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1", "")
$end1data = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1", "")
$loc1adata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1a", "")
$start1adata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1a", "")
$end1adata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1a", "")
$loc1bdata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "loc1b", "")
$start1bdata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "start1b", "")
$end1bdata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle1", "end1b", "")

;aisle 2
$loc2data = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2", "")
$start2data = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2", "")
$end2data = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2", "")
$loc2adata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2a", "")
$start2adata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2a", "")
$end2adata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2a", "")
$loc2bdata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "loc2b", "")
$start2bdata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "start2b", "")
$end2bdata = IniRead("C:\scripts\megamap\mapscripts\test.ini", "aisle2", "end2b", "")oÝ÷ ØÚ0§ʭæ­{*.­Úè¥Ú0ȧ²×vì¥ç"(§ØZ¶Ø^uçÚº[lzW¶*'Ê®¢Ú®¢Ø"½è­¶¦è¦¸µê®¢ÚÞiÚ®¢×Zµ¨§²×u*-ébçèZ0x4ß©hsoÝ÷ ÚÇÛaz·¶Ø^zwM£!z|¨¹ÊÞjײ¢êâ­n^²¯z+mëÚ®&èhاØ^y×Zµ¨§²×vêºjºR£Mú²Ö«·X¬uçâç[É«­¢+ØÀÌØíÍÑÉÐÄôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÀÌØíÍÑÉÐÅÑ°ÌÀÀ°äÀ°ÄÀÀ°ÈÀ¤oÝ÷ ٩ݲ'-ën²IèÂ'ò¢êî)í¢Úè¹¹^ßsÒ:'§v©ç¡ö¾'¦ëm+%w«mjÛazÚ)¡ü¨º»®*mjëh×6Global $IniLocation="C:\scripts\megamap\mapscripts\test.ini"oÝ÷ ÚØ^ø§uëÞ¯,!z·¢*.®Ç+pêÞOv±Êâ¦Û4÷i©§Ovªlr¸©¶Í=Ú׬¶)â²0²ê^ÅÇ©µú+¶­~*ì¶X§y©Ý­êeiÇ¢·­«­¢+ØÀÌØí%¹¥1½Ñ¥½¸
(Find and Replace = Ctrl+h). Much cleaner, and if you need to change where the ini is, you only have to change it one place.

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

EDIT: Onto his, when using a variable, make sure that it would be like this:

Global $Ini="C:\scripts\megamap\mapscripts\test.ini"

IniRead($Ini)

It's much easier to use a variable than to use a whole string, happy scripting!

Share this post


Link to post
Share on other sites

EDIT: Onto his, when using a variable, make sure that it would be like this:

Global $Ini="C:\scripts\megamap\mapscripts\test.ini"

IniRead($Ini)

It's much easier to use a variable than to use a whole string, happy scripting!

swift, isn't that what the find and replace would do?

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

swift, isn't that what the find and replace would do?

Yeah, I was just explaining in a little more information for the new guy. :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thank you! I feel like having a Hommer Dooh! moment, I should have realized I need different names for the incoming variables.

Anyway, I see what I have to do now. Thank you again! Getting back into coding is harder than I thought itd be, but these forums, and your alls willingness to help have been a godsend! *bow*

PS: Any and all advice is more than welcome! :)

Edited by Senach

"The three rules of the Librarians of Time and Space are: 1) Silence; 2) Books must be returned no later than the date last shown; and 3) Do not interfere with the nature of causality." Terry Pratchett - The Light Fantastic

Share this post


Link to post
Share on other sites

Hi, as a general observation to tidy and shorten your code a bit more you could maybe declare the combobox data in a variable and use the 1 variable to fill all the comboboxes.

I only say this cause it looks like all the comboboxes have the exact same data in them.

If your not wanting general users to change or add data to the comboboxes you may want to set the combobox style to $CBS_DROPDOWNLIST. This way the user can select items in the combobox but they can't type any entries in.

If on occassion you find items in the combo may need to be added, changed or updated then maybe you could store the combo data in a seperate txt file instead and load the combo data from the file when you launch the gui.

Doing this would mean you wouldn't have to edit the scripts source every time an item needs to be changed or added and general users could modify the txt file to edit the combo list as needed.

(Handy if your going to compile your script in to an exe)

Here's a partial example of your code using what I mentioned:

Copy and save this as combo.txt in in the scripts directory:

CODE
Jaa JC Adult Audiovisual

jaas JC Adult Spanish Audiovisual

jab JC Adult Biography

jac JC Adult Science Fiction

jacf JC Adult Christian Fict

jad JC Adult Display

jaf JC Adult Fiction

jag JC Adult Graphic Novel

jai JC Adult Walk-In

jaj Periodical Prf Collection

jak JC Adult Book Club

jal JC Adult Large Print

jam JC Adult Missouri

jamg JC Adult Genealogy

jamgo JC Adult Genealogy Ovrsz

jamo JC Adult MO Oversize

jan JC Adult Nonfiction

jano JC Adult Oversize

jao JC Adult Romance

jap JC Adult Periodical

japc JC Adult Holiday Magazine

japmf JC Adult Periodical Micro-form

japn JC Adult Newspaper

jaq JC Adult Testbook

jar JC Adult Reference

jara JC Adult Ref Auto

jarb JC Adult Ref Business

jarc Business Prof Collection

jare JC Adult Ref Medical

jarg JC Adult Ref MO Genealogy

jargo JC Adult RMO Gen Oversize

jarj Asst Dir Prof Collection

jark HR Prof Collection

jarl JC Adult Ref Legal

jarm JC Adult Ref Missouri

jarmo JC Adult Ref MO Oversize

jarp JC Adult Ref Periodical

jarr JC Adult Reference Desk

jars JC Adult Ref Atlas

jart Director Prof Collection

jarta Admin Offices Prof Coll

jaru Reference Prof Collection

jarv Tech Serv Prof Collection

jarw Comp Serv Prof Collection

jarx Childrens Prof Collection

jary PR Prof Collection

jarz Circ Prof Collection

jas JC Adult Spanish

jau Inter Library Loan

jaw JC Adult Western

jay JC Adult Mystery

jpcc JC Public Computer Center

jprc JC Public Reference Computers

jtd JC Teen Display

jtf JC Teen Fiction

jtg JC Teen Graphic Book

jtk JC Teen Book Club

jtp JC Teen Periodical

jca JC Children's Audiovisual

jcb JC Children's Biography

jcce Main Child Computer Equipment

jcd JC Children's Display

jce JC Children's Easy Reader

jcf JC Children's Fiction

jcfp JC Children's Small Book

jch JC Children's Story Hour

jck JC Children's Book Club

jcm JC Children's Missouri

jcn JC Children's Nonfiction

jcp JC Children's Periodical

jcr JC Children's Reference

jcrm JC Children's Ref MO

jcs JC Children's Spanish

jct JC Children's PT

jcv JC Children's Award Book

jcx JC Children's Picture Bk

jcxb JC Children's Board Book

jcz JC Children's RSR

Run this code in the same directory as combo.txt file you saved from above

#include <GUIConstants.au3>

GUICreate(" My GUI input acceptfile", 560,550, @DesktopWidth/2-260, @DesktopHeight/2-315, $WS_VSCROLL, 0x00000018); WS_EX_ACCEPTFILES
GUICtrlCreateLabel("Enter information for whats down each aisle choosing the location and then entering" & _ 
                    @LF & "the first letter of the call # for fiction or the 3 digit call # for non-fiction" & _
                    @LF & "Use the 2nd and 3rd lines if multiple locations are on a paticular aisle.", 28, 10)

GUICtrlCreateLabel("Aisle", 10,70)
GUICtrlCreateLabel("Location", 70,70)
GUICtrlCreateLabel("Start of Aisle", 300,70)
GUICtrlCreateLabel("End of Aisle", 420,70)

;aisle 1
GUICtrlCreateLabel("1", 10,90)
$loc1 = GUICtrlCreateCombo ("", 70,90, 200, 20, BitOr($CBS_DROPDOWNLIST,$WS_VSCROLL))
GUICtrlSetData(-1, FillCombo(), "")
$start1 = GUICtrlCreateInput ( "", 300, 90, 100, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
$end1 = GUICtrlCreateInput ("", 420, 90, 100, 20)

;aisle 1a
GUICtrlCreateLabel("1a", 20,115)
$loc1a = GUICtrlCreateCombo ("", 70,115, 200, 20, BitOr($CBS_DROPDOWNLIST,$WS_VSCROLL))
GUICtrlSetData(-1, FillCombo(), "")
$start1a = GUICtrlCreateInput ( "", 300, 115, 100, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
$end1a = GUICtrlCreateInput ("", 420, 115, 100, 20)

;aisle 1b
GUICtrlCreateLabel("1b", 20,140)
$loc1b = GUICtrlCreateCombo ("", 70,140, 200, 20, BitOr($CBS_DROPDOWNLIST,$WS_VSCROLL))
GUICtrlSetData(-1, FillCombo(), "")
$start1b = GUICtrlCreateInput ( "", 300, 140, 100, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
$end1b = GUICtrlCreateInput ("", 420, 140, 100, 20)

;aisle 2
GUICtrlCreateLabel("2", 10,170)
$loc2 = GUICtrlCreateCombo ("", 70,170, 200, 20, BitOr($CBS_DROPDOWNLIST,$WS_VSCROLL))
GUICtrlSetData(-1, FillCombo(), "")
$start2 = GUICtrlCreateInput ( "", 300, 170, 100, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
$end2 = GUICtrlCreateInput ("", 420, 170, 100, 20)

;aisle 2a
GUICtrlCreateLabel("2a", 20,195)
$loc2a = GUICtrlCreateCombo ("", 70,195, 200, 20, BitOr($CBS_DROPDOWNLIST,$WS_VSCROLL))
GUICtrlSetData(-1, FillCombo(), "")
$start2a = GUICtrlCreateInput ( "", 300, 195, 100, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
$end2a = GUICtrlCreateInput ("", 420, 195, 100, 20)

;aisle 2b
GUICtrlCreateLabel("2b", 20,220)
$loc2b = GUICtrlCreateCombo ("", 70,220, 200, 20, BitOr($CBS_DROPDOWNLIST,$WS_VSCROLL))
GUICtrlSetData(-1, FillCombo(), "")
$start2b = GUICtrlCreateInput ( "", 300, 220, 100, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
$end2b = GUICtrlCreateInput ("", 420, 220, 100, 20)

$btn = GUICtrlCreateButton ("Ok", 20, 485, 60, 20)
GUISetState ()

While 1 
    $msg = GUIGetMsg()
    Switch $msg
        Case $btn, $GUI_EVENT_CLOSE 
            exitloop
    EndSwitch
Wend

Func FillCombo()
    Local $FR = FileRead(@ScriptDir & "\combo.txt")
    Return StringReplace($FR, @CRLF, "|")
EndFunc

Share this post


Link to post
Share on other sites

Thanks Smashly! I tried something like that in an earlier version doing an #include variables.au3 thing, but I tried to be too fancy with it and it just would never write to the file correctly. So I went back to the long messy code. But now that the whole script is working, Ill tighten it up with this. :)


"The three rules of the Librarians of Time and Space are: 1) Silence; 2) Books must be returned no later than the date last shown; and 3) Do not interfere with the nature of causality." Terry Pratchett - The Light Fantastic

Share this post


Link to post
Share on other sites

Hi, your welcome.

Here's an example shortening your code for the control creation and it'll save and load the last settings used in the gui on exit and load those last settings on startup

#include <GUIConstants.au3>
#include <Array.au3>
Global $Ini = @ScriptDir & "\settings.ini"
Global $Combo[7], $Start[7], $End[7], $iX = 10, $cY = 90, $SSL = StringSplit("1|1a|1b|2|2a|2b", "|")
GUICreate(" My GUI input acceptfile", 560,550, @DesktopWidth/2-260, @DesktopHeight/2-315, -1, 0x00000018); WS_EX_ACCEPTFILES
GUICtrlCreateLabel("Enter information for whats down each aisle choosing the location and then entering" & _ 
                    @LF & "the first letter of the call # for fiction or the 3 digit call # for non-fiction" & _
                    @LF & "Use the 2nd and 3rd lines if multiple locations are on a paticular aisle.", 28, 10)

GUICtrlCreateLabel("Aisle", 10,70)
GUICtrlCreateLabel("Location", 70,70)
GUICtrlCreateLabel("Start of Aisle", 300,70)
GUICtrlCreateLabel("End of Aisle", 420,70)

For $i = 1 To 6
    If $i = 4 Then $cY = 170
    If $i = 4 Then $iX = 10
    If $i <> 1 And $i <> 4 Then $iX = 20 
    GUICtrlCreateLabel($SSL[$i], $iX, $cY + 3)
    $Combo[$i] = GUICtrlCreateCombo("", 70, $cY, 200, 20, BitOr($CBS_DROPDOWNLIST,$WS_VSCROLL))
    GUICtrlSetData(-1, FillCombo(), "")
    $Start[$i] = GUICtrlCreateInput ("", 300, $cY, 100, 20)
    GUICtrlSetState(-1,$GUI_DROPACCEPTED)
    $End[$i] = GUICtrlCreateInput ("", 420, $cY, 100, 20)
    $cY += 25
Next    
$SSL = 0

$btn = GUICtrlCreateButton ("Ok", 20, 485, 60, 20)
GUISetState ()

Load()

While 1 
    $msg = GUIGetMsg()
    Switch $msg
        Case $btn, $GUI_EVENT_CLOSE
            Save()
            exitloop
    EndSwitch
Wend

Func FillCombo()
    Local $FR = FileRead(@ScriptDir & "\combo.txt")
    Return StringReplace($FR, @CRLF, "|")
EndFunc 

Func Load()
    Local $IRSN = IniReadSectionNames($ini), $sCnt = 0
    If @error Then Return
    For $i = 1 To $IRSN[0]
        Local $IRS = IniReadSection($ini, $IRSN[$i]), $nCnt
        If @error Then Return
        For $j = 1 To 3
            GUICtrlSetData($Combo[$j + $sCnt], $IRS[$j + $nCnt][1])
            GUICtrlSetData($Start[$j + $sCnt], $IRS[$j + $nCnt + 1][1])
            GUICtrlSetData($End[$j + $sCnt], $IRS[$j + $nCnt + 2][1])
            $nCnt += 2
        Next
        $nCnt = 0
        $sCnt += 3
    Next    
EndFunc

Func Save()
    Local $Section = "aisle1"
    For $i = 1 To 6
        If $i > 3 Then $Section = "aisle2"
        IniWrite($Ini, $Section, "Location" & $i, GUICtrlRead($Combo[$i]))
        IniWrite($Ini, $Section, "Start" & $i, GUICtrlRead($Start[$i]))
        IniWrite($Ini, $Section, "End" & $i, GUICtrlRead($End[$i]))
    Next    
EndFunc

Cheers

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0