clarinets101

combobox list change based on selection of another combobox

32 posts in this topic

I'm working on a script that will allow our users to update their AD information with a nice easy to use gui interface. so far i've got things working great but i want to take it that one step extra. i can create combo boxes with no issues and have them contain all the data i want in them but what i would like to do is when a user selects their department i would like for them to have only a list of their available job titles. Where we have just over 50 departments there are probably twice as many job titles, so i would like to clean it up and make it easier on them.

Func Gui()
Local $Button_1, $msg
GUICreate("AD Update",142,260,-1,-1)

;Location - Hospital, Family Center, Surgery/Oncology, Wellness, Biscayne, Busman, Ellaville:
GUICtrlCreateLabel("Main Location: ",5,5)
$location = GUICtrlCreateCombo("Hospital",5,20,132,5, bitor($cbs_dropdownlist,$gui_ss_default_combo))
guictrlsetdata($location, "Family Center|Surgery/Oncology|Wellness Center|Biscayne|Ellaville|Busman",$dlocation)

;Department:
guictrlcreatelabel("Department: ",5,50)
$dept = guictrlcreatecombo("",5,65,132,5, bitor($cbs_dropdownlist,$gui_ss_default_combo))
guictrlsetdata($dept, "Accounting|Administration|Admitting|Anatomic Pathology|Blood Bank|Care Management|Carlton Breast Health Center|CCU|Central Staffing|Central Sterile Processing|Continuing Medical Education|Customer Service|EC Registration|Emergency Center|Environmental Services|Food and Nutrition|Foundation|GA Farmworkers Health Program Grant|General Medical II|General Stores|Guest Relations|Health Information Management|Health Works|Hematology/Oncology - Admin|Human Resources|Infection Prevention|IP Physical Therapy|IS Applications|Laboratory|Laundry & Linen|Marketing|Medical Staff Services|Middle School Nurse Program|Mother Baby|MRI|Newborn Nursery|Nuclear Medicine|Nursing Administration|OP Hospice|OP Surgery|Operating Room|Outpatient Registration|PACU|Patient Accounting|Payroll|Pharmacy|Plant Operations|Purchasing|Quality Improvement|Radiology Diagnsotic|Respiratory Therapy|Security|Sleep Center|Switchboard|Utilization Review",$ddepartment)

;Job Title:
GUICtrlCreateLabel("Job Title: ",5,95)
$job = GUICtrlCreateCombo("",5,110,132,5, bitor($cbs_dropdownlist,$gui_ss_default_combo))

;Telephone Number:
GUICtrlCreateLabel("Telephone Number: ",5,140)
$area = GUICtrlCreateInput($darea,5,155,30,20)
guictrlsetlimit(-1,3)
GUICtrlCreateLabel("-",40,157)
$prefix = GUICtrlCreateInput($dprefix,50,155,30,20)
GUICtrlSetLimit(-1,3)
GUICtrlCreateLabel("-",85,157)
$number = GUICtrlCreateInput($dnumber,95,155,40,20)
GUICtrlSetLimit(-1,4)

;Extension:
GUICtrlCreateLabel("Extension: ",5,185)
$ext = guictrlcreateinput($dext,5,200,45,20)
GUICtrlSetLimit(-1,5)




;OK Button:
;Opt("GUICoordMode", 2)
$Button_1 = guictrlcreatebutton("OK",87,225,50,30)

GUISetState(@sw_show)

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $Button_1
combo1()
EndSelect
WEnd
EndFunc

All help with this would be much appreciated. and one other thing i know there's a way to have the combo box pull from an ini file and insights in how to do that would be appreciated. end result is something that i can package up and share on our network so i would only use the ini files if it can be included and used with out having to point to a file (not sure on how to do all that but i am a google fiend) but if someone cares to share with examples on using an ini file instead of manually typing in to autoit that would be appreciated.

Thank you in advance hope all is clear.

Share this post


Link to post
Share on other sites



clarinets101,

To link the combos I would put all the data into an ini file with this format:

[Dept 1]
Job A=1
Job B=1
[Dept 2]
Job C=1
Job D=1
[Dept 3]
etc.....

Then you can use IniReadSectionNames to get an array of all the departments for the first combo. Once a department is selected, you can use GUICtrlRead to get the section name and then use IniReadSection to get an array of the relevant jobs within that department. I did something similar here if you want to see how to code it. :)

The "=1" behind each job is just to get the correct format for an ini file, by the way. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thank you Melba23, for the most part i think i understand what you are saying and i'm trying to make since of your example script. could i may ask for a little help with the script?

Ini would look like this:

[Accounting]

Director=1

AP Reprisentative=1

Accountant=1

[Administration]

Executive Assistant=1

[Admitting]

Patient Access Specialist=1

Team Leader=1

and so on through my list from HR. Then i would save it in an ini file in the same directory as the script right? and how does that work when compiling and sharing off a network drive? Would the exe file look to the ini file automattically?

also is it possible to get an example that relates to my script. And for more clarification i've attached an example of what my gui looks like so far. end result is they select a location which i have working like i want, then they select from a long list of departments, then depending on which department they choose will be a list of different titles that change when department value changes.

post-74821-0-68028700-1352233820_thumb.p

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

clarinets101,

Please post the code you used for the GUI (why reinvent the wheel ;)) and I will provide an example for you based on the data you gave above. :)

As to the location of the ini file - you need to define the path to the ini in the script so it can be anywhere. ;)

M23

Edit: Just reread the first post - sorry! :>

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I pasted my gui code in when i opened the topic

Share this post


Link to post
Share on other sites

clarinets101,

I have saved an ini file in this format named Jobs.ini - I only entered sample jobs for the first 3 depts:

[Accounting]
Job A=1
Job B=1
Job C=1
[Administration]
Job M=1
Job N=1
Job O = 1
[Admitting]
Job X=1
Job Y=1
Job Z=1
[Anatomic Pathology]
[Blood Bank]
[Care Management]
[Carlton Breast Health Center]
[CCU][Central Staffing]
[Central Sterile Processing]
[Continuing Medical Education]
[Customer Service]
[EC Registration]
[Emergency Center]
[Environmental Services]
[Food and Nutrition]
[Foundation]
[GA Farmworkers Health Program Grant]
[General Medical II]
[General Stores]
[Guest Relations]
[Health Information Management]
[Health Works]
[Hematology/Oncology - Admin]
[Human Resources]
[Infection Prevention]
[IP Physical Therapy]
[IS Applications]
[Laboratory]
[Laundry & Linen]
[Marketing]
[Medical Staff Services]
[Middle School Nurse Program]
[Mother Baby]
[MRI]
[Newborn Nursery]
[Nuclear Medicine]
[Nursing Administration]
[OP Hospice]
[OP Surgery]
[Operating Room]
[Outpatient Registration]
[PACU]
[Patient Accounting]
[Payroll]
[Pharmacy]
[Plant Operations]
[Purchasing]
[Quality Improvement]
[Radiology Diagnsotic]
[Respiratory Therapy]
[Security]
[Sleep Center]
[Switchboard]
[Utilization Review]

And then used this code to get the data:

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>

$dlocation = "Hospital"
$ddepartment = "CCU"

$sIniPath = @ScriptDir & "Jobs.ini"

; Read the section names - they are the departments <<<<<<<<<<<<<<<<<<<<<<<<<<<<
$aDept = IniReadSectionNames($sIniPath)
; Convert to a string for loading in the combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$sDept = ""
For $i = 1 To $aDept[0]
    $sDept &= "|" & $aDept[$i]
Next

Gui()

Func Gui()

    Local $dlocation, $ddepartment, $darea, $dprefix, $dnumber, $dext

    GUICreate("AD Update", 142, 260, -1, -1)

    ;Location - Hospital, Family Center, Surgery/Oncology, Wellness, Biscayne, Busman, Ellaville:
    GUICtrlCreateLabel("Main Location: ", 5, 5)
    $location = GUICtrlCreateCombo("", 5, 20, 132, 5, BitOR($cbs_dropdownlist, $gui_ss_default_combo))
    GUICtrlSetData($location, "Hospital|Family Center|Surgery/Oncology|Wellness Center|Biscayne|Ellaville|Busman", $dlocation)

    ;Department:
    GUICtrlCreateLabel("Department: ", 5, 50)
    $dept = GUICtrlCreateCombo("", 5, 65, 132, 5, BitOR($cbs_dropdownlist, $gui_ss_default_combo))
    GUICtrlSetState($dept, $GUI_DISABLE) ; Disable the combo until a location is chosen <<<<<<<<<<<<<<<<<<<<
    GUICtrlSetData($dept, $sDept) ; Load the department names <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ;Job Title:
    GUICtrlCreateLabel("Job Title: ", 5, 95)
    $job = GUICtrlCreateCombo("", 5, 110, 132, 5, BitOR($cbs_dropdownlist, $gui_ss_default_combo))
    GUICtrlSetState($job, $GUI_DISABLE) ; Disbale the combo unitl a dept is chosen and the jobs are loaded

    ;Telephone Number:
    GUICtrlCreateLabel("Telephone Number: ", 5, 140)
    $area = GUICtrlCreateInput($darea, 5, 155, 30, 20, $ES_NUMBER) ; now you can only enter digits <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    GUICtrlSetLimit(-1, 3)
    GUICtrlCreateLabel("-", 40, 157)
    $prefix = GUICtrlCreateInput($dprefix, 50, 155, 30, 20, $ES_NUMBER)
    GUICtrlSetLimit(-1, 3)
    GUICtrlCreateLabel("-", 85, 157)
    $number = GUICtrlCreateInput($dnumber, 95, 155, 40, 20, $ES_NUMBER)
    GUICtrlSetLimit(-1, 4)

    ;Extension:
    GUICtrlCreateLabel("Extension: ", 5, 185)
    $ext = GUICtrlCreateInput($dext, 5, 200, 45, 20, $ES_NUMBER)
    GUICtrlSetLimit(-1, 5)

    ;OK Button:
    $Button_1 = GUICtrlCreateButton("OK", 87, 225, 50, 30)

    GUISetState(@SW_SHOW)

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $Button_1

            Case $location
                GUICtrlSetState($dept, $GUI_ENABLE) ; Enable the dept combo <<<<<<<<<<<<<<<<<<<

            Case $dept
                ; Read the dept combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                $sSelectedDept = GUICtrlRead($dept)
                ; Read the jobs in that section <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                $aAvailJobs = IniReadSection($sIniPath, $sSelectedDept)
                ; If there are jobs then convert to a string <<<<<<<<<<<<<<<<<<<<<<<<<<<
                If IsArray($aAvailJobs) Then
                    $sAvailJobs = ""
                    For $i = 1 To $aAvailJobs[0][0]
                        $sAvailJobs &= "|" & $aAvailJobs[$i][0]
                    Next
                    ; Load and enable the combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                    GUICtrlSetData($job, $sAvailJobs)
                    GUICtrlSetState($job, $GUI_ENABLE)
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>Gui

Look for the <<<<<<<<<<<<<<<< lines - I made some other changes as well. ;)

Please ask if anything is unclear. :)

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Holy Cow!!! this is awesome, i got it working thanks to all your examples. I did not use the disable gui until previous is selected though. One more thing and i promise i'll leave the forum alone for a while. in seeing the convenience of using ini files i would like to use one for the locations. Something like:

[Hospital]

street=123 name st

city=city

state=st

zip=12345

and populate the ini for each location then have the script pull the data from the ini based on the location selected then set the values of it to variables:

$street = iniread....(street) not sure what the exact commands would be but i hope you catch my drift.

if i can get this final "polish" on the script i will have a jam up AD update utility that can be used throughout my organization and at different locations because to use at a different location they would just update ini info.

once again M23 you are the best and have been the most help to me on these forums and i really do appreciate it. When i get the script finished and cleaned up i will send you the whole thing so you can check it out and hell use it yourself if you want ... even though you could probably write something better in your sleep lol.

Share this post


Link to post
Share on other sites

clarinets101,

I am glad you found the example useful. :)

As to the other ini, it is extremely simple. Create the ini file as you have suggested (it will need to be separate from the other one) and then use IniRead to get the values along these lines:

; Get the chosen location data like this
$dlocation = GUICtrlRead($location)

; And then read the ini file
$street = IniRead(sPath_Of_Ini_File, $dlocation, "street", "Error")

Now the variable $street holds the value stored in the ini for that location - or "Error" if it was not found. ;)

Do ask again if you have any problems implementing it. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I am very sorry i really don't mean to bug you but you are just very helpful. One last thing ... I swear (hopefully) is how would i search the location ini file for existing values. as it sits right now if the user account has valid data in it then the drop down menus have the selections already in them. but now i would like to have the script check the existing street address and based on what it is set the default location.

example:

address entered into AD 123 ABC st

ini file:

[location1]

street=123 cba st

[location2]

street=123 abc st

i poll the existing data and set a variable for the data.

$astreet = _ad_getobjectattribute(@username, "department")

so now i need to search the ini file for a key that matches the variable $astreet and set $dlocation = to it's section tiltle.

I have a general idea of how i need to do it but the commands i'm not the clearest on ... still learning.

Thank you so much for all your help

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

clarinets101,

No need to apologise. :)

I would do something like this:

Ini file ("Locations.ini"):

[location1]
street=123 abc st

[location2]
street=123 mno st

[location3]
street=123 xyz st

And associated script:

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>

$sLocation_Ini = @ScriptDir & "\Location.ini"

; Read locations (we already do this sort of thing in the other script)
$aLocations = IniReadSectionNames($sLocation_Ini)
; And convert them to a string to put in the combo
$sLocations = ""
For $i = 1 To $aLocations[0]
    $sLocations &= "|" & $aLocations[$i]
Next

; Now let us assume that you have an existing address
$sAddress = "123 MNO St"

; We need to search for that in the inifile and determine the section in which iti is found - so we look through each section in turn
; First set a blank default
$dlocation = ""
; Now see what is stored in each section as the address
For $i = 1 To $aLocations[0]
    ; Uppercase everything to make it all case-insensitive
    ConsoleWrite(StringUpper(IniRead($sLocation_Ini, $aLocations[$i], "street", "Error")) & " - " & StringUpper($sAddress) & @CRLF)
    If StringUpper(IniRead($sLocation_Ini, $aLocations[$i], "street", "Error")) = StringUpper($sAddress) Then
        ; We have found the section which contains the address
        $dlocation = $aLocations[$i]
        ; No point in searching any more
        ExitLoop
    EndIf
Next
; Now $dlocation is set to either the location or is an empty string if the address was not found

Gui()

Func Gui()

    Local $ddepartment, $darea, $dprefix, $dnumber, $dext

    GUICreate("AD Update", 142, 260, -1, -1)

    GUICtrlCreateLabel("Main Location: ", 5, 5)
    $location = GUICtrlCreateCombo("", 5, 20, 132, 5, BitOR($cbs_dropdownlist, $gui_ss_default_combo))
    ; Here we set the full set of locations into the combo - but set the default to the preselected one (if it exists)
    GUICtrlSetData($location, $sLocations, $dlocation)

    GUISetState(@SW_SHOW)

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

EndFunc   ;==>Gui

I hope the comments are clear enough - but you know what to do if they are not. :)

M23

Edited by Melba23
Reinserted missing "\" character

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Dude, you are the bomb.com. It's all working beautifully and this will make things easier on us as an IT department. Thank you so much i have learned a lot from you that i will hope to use in the future. I love AutoIT and have been able to do a lot with it. this is the first script of this magnitude i have written and you have made it very enjoyable. I love when people are helpful on forums and not condescending, we all have our skill sets and some are less than others and the only way to pick them up is to ask.

Thank you a lot and i will "clean" up the script and send you a copy.

Share this post


Link to post
Share on other sites

clarinets101,

Delighted I could help - I always enjoy helping professional organisations use AutoIt. Just post the final script here (suitably sanitised if necessary) so that others can use it as an example in the future. :)

And there are any slush funds in the IT department, then a donation to help with the forum server costs is always welcome - every little helps. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I am trying to do a similar kind of thing as clarinets101. I first tried to run the script that is provided here just to check the functionality, how it works . The script throws an error for me stating

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\605512\Downloads\New folder\GUIComboBoxInsertion.au3"    
"C:\Users\605512\Downloads\New folder\GUIComboBoxInsertion.au3" (14) : ==> Subscript used on non-accessible variable.:
$sDept &= "|" & $aDept[$i]
$sDept &= "|" & $aDept^ ERROR
>Exit code: 1    Time: 0.653

Please if anyone could explain as I am not able to understand this error.

Thank You

Share this post


Link to post
Share on other sites

Jess,

A forum update some time ago stripped all "\" characters from existing posted code. I have now amended my post to reinsert the character.

M23 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

@Melba23

I am sorry but I could not get, which post is amended.

 

:)

Share this post


Link to post
Share on other sites

Jess,

The code in post #10 - which says "Reinserted missing "\" character".

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yes I have tried that script as well . It also throws a similar error

For $i = 1 To $aLocations[0]
For $i = 1 To $aLocations^ ERROR
>Exit code: 1    Time: 1.125

 

Share this post


Link to post
Share on other sites

Jess,

Do you have the location.ini file I also detailed in that post in the same folder?

Jess


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yes, I have that file . I have given the path for that file in 

$sLocation_Ini

Share this post


Link to post
Share on other sites

Jess,#

Sorry, I have just realised that the code in post #10 is only a small section of the larger problem. Here is amended code from post #6 which actually has linked combos:

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>

$dlocation = "Hospital"
$ddepartment = "CCU"

$sIniPath = @ScriptDir & "\Jobs.ini"

; Read the section names - they are the departments <<<<<<<<<<<<<<<<<<<<<<<<<<<<
$aDept = IniReadSectionNames($sIniPath)
; Convert to a string for loading in the combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$sDept = ""
For $i = 1 To $aDept[0]
    $sDept &= "|" & $aDept[$i]
Next

Gui()

Func Gui()

    Local $dlocation, $ddepartment, $darea, $dprefix, $dnumber, $dext

    GUICreate("AD Update", 142, 260, -1, -1)

    ;Location - Hospital, Family Center, Surgery/Oncology, Wellness, Biscayne, Busman, Ellaville:
    GUICtrlCreateLabel("Main Location: ", 5, 5)
    $location = GUICtrlCreateCombo("", 5, 20, 132, 5, BitOR($cbs_dropdownlist, $gui_ss_default_combo))
    GUICtrlSetData($location, "Hospital|Family Center|Surgery/Oncology|Wellness Center|Biscayne|Ellaville|Busman", $dlocation)

    ;Department:
    GUICtrlCreateLabel("Department: ", 5, 50)
    $dept = GUICtrlCreateCombo("", 5, 65, 132, 5, BitOR($cbs_dropdownlist, $gui_ss_default_combo))
    GUICtrlSetState($dept, $GUI_DISABLE) ; Disable the combo until a location is chosen <<<<<<<<<<<<<<<<<<<<
    GUICtrlSetData($dept, $sDept) ; Load the department names <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ;Job Title:
    GUICtrlCreateLabel("Job Title: ", 5, 95)
    $job = GUICtrlCreateCombo("", 5, 110, 132, 5, BitOR($cbs_dropdownlist, $gui_ss_default_combo))
    GUICtrlSetState($job, $GUI_DISABLE) ; Disbale the combo unitl a dept is chosen and the jobs are loaded

    ;Telephone Number:
    GUICtrlCreateLabel("Telephone Number: ", 5, 140)
    $area = GUICtrlCreateInput($darea, 5, 155, 30, 20, $ES_NUMBER) ; now you can only enter digits <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    GUICtrlSetLimit(-1, 3)
    GUICtrlCreateLabel("-", 40, 157)
    $prefix = GUICtrlCreateInput($dprefix, 50, 155, 30, 20, $ES_NUMBER)
    GUICtrlSetLimit(-1, 3)
    GUICtrlCreateLabel("-", 85, 157)
    $number = GUICtrlCreateInput($dnumber, 95, 155, 40, 20, $ES_NUMBER)
    GUICtrlSetLimit(-1, 4)

    ;Extension:
    GUICtrlCreateLabel("Extension: ", 5, 185)
    $ext = GUICtrlCreateInput($dext, 5, 200, 45, 20, $ES_NUMBER)
    GUICtrlSetLimit(-1, 5)

    ;OK Button:
    $Button_1 = GUICtrlCreateButton("OK", 87, 225, 50, 30)

    GUISetState(@SW_SHOW)

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $Button_1

            Case $location
                GUICtrlSetState($dept, $GUI_ENABLE) ; Enable the dept combo <<<<<<<<<<<<<<<<<<<

            Case $dept
                ; Read the dept combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                $sSelectedDept = GUICtrlRead($dept)
                ; Read the jobs in that section <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                $aAvailJobs = IniReadSection($sIniPath, $sSelectedDept)
                ; If there are jobs then convert to a string <<<<<<<<<<<<<<<<<<<<<<<<<<<
                If IsArray($aAvailJobs) Then
                    $sAvailJobs = ""
                    For $i = 1 To $aAvailJobs[0][0]
                        $sAvailJobs &= "|" & $aAvailJobs[$i][0]
                    Next
                    ; Load and enable the combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                    GUICtrlSetData($job, $sAvailJobs)
                    GUICtrlSetState($job, $GUI_ENABLE)
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>Gui

And here is the associated jobs.ini (note only the first 3 sections have jobs to find) which you need to have in the same folder:

[Accounting]
Job A=1
Job B=1
Job C=1
[Administration]
Job M=1
Job N=1
Job O = 1
[Admitting]
Job X=1
Job Y=1
Job Z=1
[Anatomic Pathology]
[Blood Bank]
[Care Management]
[Carlton Breast Health Center]
[CCU][Central Staffing]
[Central Sterile Processing]
[Continuing Medical Education]
[Customer Service]
[EC Registration]
[Emergency Center]
[Environmental Services]
[Food and Nutrition]
[Foundation]
[GA Farmworkers Health Program Grant]
[General Medical II]
[General Stores]
[Guest Relations]
[Health Information Management]
[Health Works]
[Hematology/Oncology - Admin]
[Human Resources]
[Infection Prevention]
[IP Physical Therapy]
[IS Applications]
[Laboratory]
[Laundry & Linen]
[Marketing]
[Medical Staff Services]
[Middle School Nurse Program]
[Mother Baby]
[MRI]
[Newborn Nursery]
[Nuclear Medicine]
[Nursing Administration]
[OP Hospice]
[OP Surgery]
[Operating Room]
[Outpatient Registration]
[PACU]
[Patient Accounting]
[Payroll]
[Pharmacy]
[Plant Operations]
[Purchasing]
[Quality Improvement]
[Radiology Diagnsotic]
[Respiratory Therapy]
[Security]
[Sleep Center]
[Switchboard]
[Utilization Review]

That code works fine for me.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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