Sign in to follow this  
Followers 0
surreal

help with syntax

22 posts in this topic

#1 ·  Posted (edited)

im righting a program that will update our symantec clients depending on what location they enter. i was wondering if my below example is the correct syntax. it seems to work, its just before i start inputting over a hundred sites i wanted to make sure i was doing this the correct way or best way. thanks for the help...

what im mainly looking for is the = "" or "" or "" or "" then

ElseIF GUICtrlRead($Combo_City) = "Athens" or "Braselton" or "Chattanooga" or "Knoxville" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
                                   FileInstall("GRC\GRC_TN.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TN.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)

d@ve

Edited by surreal

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try a Select - Case statement instead... it will read a lot easier.

$s_Combo_City = GUICtrlRead($Combo_City)
Select
    Case $s_Combo_City = "Athens"
        _DoTheDeleteThing()
    Case $s_Combo_City = "Braselton"
        _DoTheDeleteThing()
    Case $s_Combo_City = "Chattanooga"
        _DoTheDeleteThing()
    Case $s_Combo_City = "Knoxville"
        _DoTheDeleteThing()
    Case Else
        ;do something else
EndSelect

Func _DoTheDeleteThing()
    FileDelete($Cert & "\*.DAT")
    FileDelete($Cert & "\*.cer")
    FileInstall("GRC\GRC_TN.DAT", $GRC & "\GRC.DAT", 1)
    FileInstall("CER\TN.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
EndFunc   ;==>_DoTheDeleteThing

[edit] typo in code

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Syntax is:

If GUICtrlRead($Combo_City) = "Athens" or GUICtrlRead($Combo_City) = "Braselton" or GUICtrlRead($Combo_City) = "Chattanooga" or GUICtrlRead($Combo_City) = "Knoxville" Then

For longer lists you could also use something like:

If StringInStr("|Athens|Braselton|Chattanooga|Knoxville|","|" & GUICtrlRead($Combo_City) & "|") Then

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

or:

Switch GUICtrlRead($Combo_City)
    case "Athens", "Braselton", "Chattanooga", "Knoxville"
        
        FileDelete($Cert & "\*.DAT")
        FileDelete($Cert & "\*.cer")
        FileInstall("GRC\GRC_TN.DAT", $GRC & "\GRC.DAT", 1)
        FileInstall("CER\TN.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
        
EndSwitch

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

thanks for the help so far. is it ok to use a case within a case? this is already in a case, i just pasted part of it, my main thing is to keep this working and clean. we have about 200 servers that i need to included, with around 300 cities. some cities use the same server.

im thinking this one looks right

If GUICtrlRead($Combo_City) = "Athens" or GUICtrlRead($Combo_City) = "Braselton" or GUICtrlRead($Combo_City) = "Chattanooga" or GUICtrlRead($Combo_City) = "Knoxville" Then

it just does not seem that clean? thanks again.

d@ve

Edited by surreal

Share this post


Link to post
Share on other sites

The only problem with that one is that you are using multiple calls to GUICtrlRead() I would recommend doing what I did in my code and only read from the control once.

$s_Combo_City = GUICtrlRead($Combo_City)
If $s_Combo_City = "Athens" or $s_Combo_City = "Braselton" or $s_Combo_City = "Chattanooga" or $s_Combo_City = "Knoxville" Then ...

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

i have two dropdown list state and city. if they pick the state it will change the city list. so $Combo_City will be the selected city.

#NoTrayIcon
#AutoIt3Wrapper_icon=symantec.ico
#include <GUIConstants.au3>


$Form = GUICreate("Company Name", 344, 152, 596, 471)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form, "int", 1000, "long", 0x00040010)

$Group = GUICtrlCreateGroup("Symantec AntiVirus Server Update", 8, 8, 329, 137)

$Header = GUICtrlCreateLabel("Please choose the location (or the closest to the user)", 24, 32, 257, 17)

$Label_State = GUICtrlCreateLabel("State:", 24, 55, 32, 17)
$Combo_State = GUICtrlCreateCombo("", 24, 72, 137, 25)
        GUICtrlSetData(-1,"California|Colorado|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Massachusetts|Nevada|Pennsylvania

|Tennessee|Texas", "Colorado")
        GUISetState ()  

$Label_City = GUICtrlCreateLabel("City:", 184, 55, 24, 17)
$Combo_City = GUICtrlCreateCombo("", 184, 72, 137, 25)
        GUICtrlSetData(-1,"Broomfield|295 Tech Center", "Broomfield")
        GUISetState ()

$Version = GUICtrlCreateLabel("v8.1", 307, 127, 29, 17)
$Button_Submit = GUICtrlCreateButton("Submit", 136, 104, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()

$GRC = "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5"
$Cert = "C:\Program Files\Symantec AntiVirus\pki\roots"


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Combo_State
        If GUICtrlRead($Combo_State) = "California" Then
           GUICtrlSetData($Combo_City, "","")
           GUICtrlSetData($Combo_City, "Altadena|Buena Park|Los Angeles", "Altadena")
           
        ElseIF GUICtrlRead($Combo_State) = "Colorado" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Broomfield|295 Tech Center", "Broomfield")
           
        ElseIF GUICtrlRead($Combo_State) = "Georgia" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Braselton|Marietta", "Braselton")

        ElseIF GUICtrlRead($Combo_State) = "Hawaii" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Honolulu", "Honolulu")
           
        ElseIF GUICtrlRead($Combo_State) = "Idaho" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Boise", "Boise")

        ElseIF GUICtrlRead($Combo_State) = "Illinois" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Batavia|Franklin Park|Huntley|Melrose Park|Rockford", "Batavia")
           
        ElseIF GUICtrlRead($Combo_State) = "Indiana" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Driggs", "Driggs")
           
        ElseIF GUICtrlRead($Combo_State) = "Iowa" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "LeMars", "LeMars")
           
        ElseIF GUICtrlRead($Combo_State) = "Massachusetts" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Franklin|Lynn", "Franklin")
           
        ElseIF GUICtrlRead($Combo_State) = "Nevada" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Reno", "Reno")         
                   
        ElseIF GUICtrlRead($Combo_State) = "Pennsylvania" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Sharpsville", "Sharpsville")           

        ElseIF GUICtrlRead($Combo_State) = "Tennessee" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Athens|Chattanooga|Knoxville", "Athens")    

        ElseIF GUICtrlRead($Combo_State) = "Texas" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Dallas|Oak Farms|Schepps Dairy Dallas|Schepps Dairy Houston|Sulphur Springs", "Dallas") 
               
           EndIf
           
Case $Button_Submit        
        If GUICtrlRead($Combo_City) = "Altadena" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_AD.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\AD.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Buena Park" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_BP.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\BP.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Los Angeles" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_CA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CA.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Broomfield" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_CO.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CO.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "295 Tech Center" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_CO.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CO.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Marietta" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_MT.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\MT.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Honolulu" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_HI.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\HI.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Boise" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_ID.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\ID.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Batavia" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_BT.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\BT.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Franklin Park" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_FP.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\FP.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Huntley" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_IL.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\IL.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Rockford" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_RF.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\RF.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "LeMars" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_IA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\IA.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Franklin" or "Lynn" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_MA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\MA.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Reno" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_NV.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\NV.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Sharpsville" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_PA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\PA.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Athens" or "Braselton" or "Chattanooga" or "Knoxville" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_TN.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TN.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Dallas" or "Driggs" or "Melrose Park" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_TX.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TX.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Oak Farms" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_OF.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\OF.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Schepps Dairy Dallas" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_SD.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SD.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Schepps Dairy Houston" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_SH.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SH.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF GUICtrlRead($Combo_City) = "Sulphur Springs" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_SS.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SS.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        EndIF
        
Sleep(1000)
            GUIDelete()
MsgBox(48, "Company Name", "Update Was Successfully, Please give time for Symantec to contact the New Server")

Exit
EndSwitch
WEnd
Exit

Share this post


Link to post
Share on other sites

And yes you can nest multiple select/case and/or switch/case statements within each other... just make sure to nest them properly.

Also seriously consider the Function usage that I showed you.. any time you are being repetitive in the code it usually makes sense to make a function out of it.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

thanks again guys. spookmeister is the below code the was your are suggesting?

#NoTrayIcon
#AutoIt3Wrapper_icon=symantec.ico
#include <GUIConstants.au3>


$Form = GUICreate("Company Name", 344, 152, 596, 471)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form, "int", 1000, "long", 0x00040010)

$Group = GUICtrlCreateGroup("Symantec AntiVirus Server Update", 8, 8, 329, 137)

$Header = GUICtrlCreateLabel("Please choose the location (or the closest to the user)", 24, 32, 257, 17)

$Label_State = GUICtrlCreateLabel("State:", 24, 55, 32, 17)
$Combo_State = GUICtrlCreateCombo("", 24, 72, 137, 25)
        GUICtrlSetData(-1,"California|Colorado|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Massachusetts|Nevada|Pennsylvania

|Tennessee|Texas", "Colorado")
        GUISetState ()  

$Label_City = GUICtrlCreateLabel("City:", 184, 55, 24, 17)
$Combo_City = GUICtrlCreateCombo("", 184, 72, 137, 25)
        GUICtrlSetData(-1,"Broomfield|295 Tech Center", "Broomfield")
        GUISetState ()

$Version = GUICtrlCreateLabel("v8.1", 307, 127, 29, 17)
$Button_Submit = GUICtrlCreateButton("Submit", 136, 104, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()

$GRC = "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5"
$Cert = "C:\Program Files\Symantec AntiVirus\pki\roots"


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Combo_State
        If GUICtrlRead($Combo_State) = "California" Then
           GUICtrlSetData($Combo_City, "","")
           GUICtrlSetData($Combo_City, "Altadena|Buena Park|Los Angeles", "Altadena")
           
        ElseIF GUICtrlRead($Combo_State) = "Colorado" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Broomfield|295 Tech Center", "Broomfield")
           
        ElseIF GUICtrlRead($Combo_State) = "Georgia" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Braselton|Marietta", "Braselton")

        ElseIF GUICtrlRead($Combo_State) = "Hawaii" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Honolulu", "Honolulu")
           
        ElseIF GUICtrlRead($Combo_State) = "Idaho" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Boise", "Boise")

        ElseIF GUICtrlRead($Combo_State) = "Illinois" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Batavia|Franklin Park|Huntley|Melrose Park|Rockford", "Batavia")
           
        ElseIF GUICtrlRead($Combo_State) = "Indiana" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Driggs", "Driggs")
           
        ElseIF GUICtrlRead($Combo_State) = "Iowa" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "LeMars", "LeMars")
           
        ElseIF GUICtrlRead($Combo_State) = "Massachusetts" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Franklin|Lynn", "Franklin")
           
        ElseIF GUICtrlRead($Combo_State) = "Nevada" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Reno", "Reno")         
                   
        ElseIF GUICtrlRead($Combo_State) = "Pennsylvania" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Sharpsville", "Sharpsville")           

        ElseIF GUICtrlRead($Combo_State) = "Tennessee" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Athens|Chattanooga|Knoxville", "Athens")    

        ElseIF GUICtrlRead($Combo_State) = "Texas" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Dallas|Oak Farms|Schepps Dairy Dallas|Schepps Dairy Houston|Sulphur Springs", "Dallas") 
               
           EndIf
           
    $s_Combo_City = GUICtrlRead($Combo_City)
           
       Case $Button_Submit         
        
        If $s_Combo_City = "Altadena" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_AD.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\AD.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Buena Park" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_BP.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\BP.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Los Angeles" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_CA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CA.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Broomfield" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_CO.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CO.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "295 Tech Center" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_CO.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CO.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Marietta" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_MT.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\MT.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Honolulu" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_HI.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\HI.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Boise" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_ID.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\ID.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Batavia" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_BT.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\BT.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Franklin Park" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_FP.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\FP.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Huntley" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_IL.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\IL.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Rockford" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_RF.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\RF.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "LeMars" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_IA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\IA.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Franklin" or $s_Combo_City = "Lynn" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_MA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\MA.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Reno" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_NV.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\NV.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Sharpsville" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_PA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\PA.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Athens" or $s_Combo_City = "Braselton" or $s_Combo_City = "Chattanooga" or $s_Combo_City = "Knoxville" Then ...
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_TN.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TN.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Dallas" or $s_Combo_City = "Driggs" or $s_Combo_City = "Melrose Park" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_TX.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TX.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Oak Farms" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_OF.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\OF.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Schepps Dairy Dallas" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_SD.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SD.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Schepps Dairy Houston" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_SH.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SH.cer", $Cert & "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer", 1)
           
        ElseIF $s_Combo_City = "Sulphur Springs" Then
           FileDelete($Cert & "\*.DAT")
           FileDelete($Cert & "\*.cer")
           FileInstall("GRC\GRC_SS.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SS.cer", $Cert & "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer", 1)
           
        EndIF
        
Sleep(1000)
            GUIDelete()
MsgBox(48, "Company Name", "Update Was Successfully, Please give time for Symantec to contact the New Server")

Exit
EndSwitch
WEnd
Exit

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

with the above code, after the changes i now get "error: illegal text at the end of statement (one statement per line)." it compiles fine, i only get this error if i choose one of the cities where we have added the more options to it. before these changes it did work, i was just not sure if i was doing it right!

d@ve

Edited by surreal

Share this post


Link to post
Share on other sites

You have 3 dots at the end of this line:

ElseIF $s_Combo_City = "Athens" or $s_Combo_City = "Braselton" or $s_Combo_City = "Chattanooga" or $s_Combo_City = "Knoxville" Then ...

Are you using the full SciTE4AutoIt3 installer ?

That will run au3check for you and make it much easier to find issues like this.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

after more testing it seems that this is now not working very well anymore. do i have to do a $s_Combo_City = GUICtrlRead($Combo_City) per if or elseif? im thinking of adding the function thing mentioned above for the delete thing, but i cant do it for the install part do to diff files. just want this to be as clean as possible, with easy updating for additional cites. it seems to be going in the right direction, but for some reason will not work now.

d@ve

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Think it should be this sequence:

Case $Button_Submit
            $s_Combo_City = GUICtrlRead($Combo_City)

You need to read that control after clicking it or OK.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

that did the trick, sorry for my beginner knowledge, im getting the hang of it, and hope soon i can starting helping others as you all have done for me.

d@ve

Share this post


Link to post
Share on other sites

im so sorry but in the process of trying to clean up this code, i have created many errors, any help would be great...

(99,3) : ERROR: missing EndSwitch.

Func

^

(34,13) : REF: missing EndSwitch.

Switch $nMsg

~~~~~~~~~~~~^

(99,3) : ERROR: missing Wend.

Func

^

(32,1) : REF: missing Wend.

While

^

(106,3) : ERROR: syntax error

If

^

3 error(s), 0 warning(s)

#NoTrayIcon
#AutoIt3Wrapper_icon=symantec.ico
#include <GUIConstants.au3>


$Form = GUICreate("Company Name", 344, 152, 596, 471)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form, "int", 1000, "long", 0x00040010)

$Group = GUICtrlCreateGroup("Symantec AntiVirus Server Update", 8, 8, 329, 137)

$Header = GUICtrlCreateLabel("Please choose the location (or the closest to the user)", 24, 32, 257, 17)

$Label_State = GUICtrlCreateLabel("State:", 24, 55, 32, 17)
$Combo_State = GUICtrlCreateCombo("", 24, 72, 137, 25)
        GUICtrlSetData(-1,"California|Colorado|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Massachusetts|Nevada|Pennsylvania

|Tennessee|Texas", "Colorado")
        GUISetState ()  

$Label_City = GUICtrlCreateLabel("City:", 184, 55, 24, 17)
$Combo_City = GUICtrlCreateCombo("", 184, 72, 137, 25)
        GUICtrlSetData(-1,"Broomfield|295 Tech Center", "Broomfield")
        GUISetState ()

$Version = GUICtrlCreateLabel("v8.1", 307, 127, 29, 17)
$Button_Submit = GUICtrlCreateButton("Submit", 136, 104, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()

$GRC = "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5"
$Cert = "C:\Program Files\Symantec AntiVirus\pki\roots"


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Combo_State
        If GUICtrlRead($Combo_State) = "California" Then
           GUICtrlSetData($Combo_City, "","")
           GUICtrlSetData($Combo_City, "Altadena|Buena Park|Los Angeles", "Altadena")
           
        ElseIF GUICtrlRead($Combo_State) = "Colorado" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Broomfield|295 Tech Center", "Broomfield")
           
        ElseIF GUICtrlRead($Combo_State) = "Georgia" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Braselton|Marietta", "Braselton")

        ElseIF GUICtrlRead($Combo_State) = "Hawaii" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Honolulu", "Honolulu")
           
        ElseIF GUICtrlRead($Combo_State) = "Idaho" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Boise", "Boise")

        ElseIF GUICtrlRead($Combo_State) = "Illinois" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Batavia|Franklin Park|Huntley|Melrose Park|Rockford", "Batavia")
           
        ElseIF GUICtrlRead($Combo_State) = "Indiana" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Driggs", "Driggs")
           
        ElseIF GUICtrlRead($Combo_State) = "Iowa" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "LeMars", "LeMars")
           
        ElseIF GUICtrlRead($Combo_State) = "Massachusetts" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Franklin|Lynn", "Franklin")
           
        ElseIF GUICtrlRead($Combo_State) = "Nevada" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Reno", "Reno")         
                   
        ElseIF GUICtrlRead($Combo_State) = "Pennsylvania" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Sharpsville", "Sharpsville")           

        ElseIF GUICtrlRead($Combo_State) = "Tennessee" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Athens|Chattanooga|Knoxville", "Athens")    

        ElseIF GUICtrlRead($Combo_State) = "Texas" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Dallas|Oak Farms|Schepps Dairy Dallas|Schepps Dairy Houston|Sulphur Springs", "Dallas") 
               
        EndIf
           
       Case $Button_Submit
           
                $s_Combo_City = GUICtrlRead($Combo_City)
                $4fb7 = "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer"
                $77f4 = "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer"
                
        Func _Delete()
            FileDelete($Cert & "\*.DAT")
            FileDelete($Cert & "\*.cer")
        EndFunc

Select
        
        If $s_Combo_City = "Altadena" Then
        _Delete()
           FileInstall("GRC\GRC_AD.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\AD.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Buena Park" Then
        _Delete()
           FileInstall("GRC\GRC_BP.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\BP.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Los Angeles" Then
        _Delete()
           FileInstall("GRC\GRC_CA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CA.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Broomfield" Then
        _Delete()
           FileInstall("GRC\GRC_CO.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CO.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "295 Tech Center" Then
        _Delete()
           FileInstall("GRC\GRC_CO.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CO.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Marietta" Then
        _Delete()
           FileInstall("GRC\GRC_MT.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\MT.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Honolulu" Then
        _Delete()
           FileInstall("GRC\GRC_HI.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\HI.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Boise" Then
        _Delete()
           FileInstall("GRC\GRC_ID.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\ID.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Batavia" Then
        _Delete()
           FileInstall("GRC\GRC_BT.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\BT.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Franklin Park" Then
        _Delete()
           FileInstall("GRC\GRC_FP.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\FP.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Huntley" Then
        _Delete()
           FileInstall("GRC\GRC_IL.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\IL.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Rockford" Then
        _Delete()
           FileInstall("GRC\GRC_RF.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\RF.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "LeMars" Then
        _Delete()
           FileInstall("GRC\GRC_IA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\IA.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Franklin" or $s_Combo_City = "Lynn" Then
        _Delete()
           FileInstall("GRC\GRC_MA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\MA.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Reno" Then
        _Delete()
           FileInstall("GRC\GRC_NV.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\NV.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Sharpsville" Then
        _Delete()
           FileInstall("GRC\GRC_PA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\PA.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Athens" or $s_Combo_City = "Braselton" or $s_Combo_City = "Chattanooga" or $s_Combo_City = "Knoxville" Then
        _Delete()
           FileInstall("GRC\GRC_TN.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TN.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Dallas" or $s_Combo_City = "Driggs" or $s_Combo_City = "Melrose Park" Then
        _Delete()
           FileInstall("GRC\GRC_TX.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TX.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Oak Farms" Then
        _Delete()
           FileInstall("GRC\GRC_OF.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\OF.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Schepps Dairy Dallas" Then
        _Delete()
           FileInstall("GRC\GRC_SD.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SD.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Schepps Dairy Houston" Then
        _Delete()
           FileInstall("GRC\GRC_SH.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SH.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Sulphur Springs" Then
        _Delete()
           FileInstall("GRC\GRC_SS.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SS.cer", $Cert & $77f4, 1)
           
        EndIF
        EndSelect
        
Sleep(2000)
    GUIDelete()
            
MsgBox(48, "Company Name", "Update Was Successfully, Please give time for Symantec to contact the New Server")

Exit
EndSwitch
WEnd
Exit

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

ok i think i got it, i moved the func to the top before the cases, i know longer get any errors. do this code look right now?

#NoTrayIcon
#AutoIt3Wrapper_icon=symantec.ico
#include <GUIConstants.au3>

$Form = GUICreate("Company Name", 344, 152, 596, 471)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form, "int", 1000, "long", 0x00040010)

$Group = GUICtrlCreateGroup("Symantec AntiVirus Server Update", 8, 8, 329, 137)

$Header = GUICtrlCreateLabel("Please choose the location (or the closest to the user)", 24, 32, 257, 17)

$Label_State = GUICtrlCreateLabel("State:", 24, 55, 32, 17)
$Combo_State = GUICtrlCreateCombo("", 24, 72, 137, 25)
        GUICtrlSetData(-1,"California|Colorado|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Massachusetts|Nevada|Pennsylvania


|Tennessee|Texas", "Colorado")
        GUISetState ()  

$Label_City = GUICtrlCreateLabel("City:", 184, 55, 24, 17)
$Combo_City = GUICtrlCreateCombo("", 184, 72, 137, 25)
        GUICtrlSetData(-1,"Broomfield|295 Tech Center", "Broomfield")
        GUISetState ()

$Version = GUICtrlCreateLabel("v8.1", 307, 127, 29, 17)
$Button_Submit = GUICtrlCreateButton("Submit", 136, 104, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()

$GRC = "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec AntiVirus Corporate Edition\7.5"
$Cert = "C:\Program Files\Symantec AntiVirus\pki\roots"
$4fb7 = "\4fb75edb2b767840b1e429d0ae9bf033.0.servergroupca.cer"
$77f4 = "\77f42a4745eef642a5a06e44543cc384.0.servergroupca.cer"

        Func _Delete()
            FileDelete($Cert & "\*.DAT")
            FileDelete($Cert & "\*.cer")
        EndFunc
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Combo_State
        If GUICtrlRead($Combo_State) = "California" Then
           GUICtrlSetData($Combo_City, "","")
           GUICtrlSetData($Combo_City, "Altadena|Buena Park|Los Angeles", "Altadena")
           
        ElseIF GUICtrlRead($Combo_State) = "Colorado" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Broomfield|295 Tech Center", "Broomfield")
           
        ElseIF GUICtrlRead($Combo_State) = "Georgia" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Braselton|Marietta", "Braselton")

        ElseIF GUICtrlRead($Combo_State) = "Hawaii" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Honolulu", "Honolulu")
           
        ElseIF GUICtrlRead($Combo_State) = "Idaho" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Boise", "Boise")

        ElseIF GUICtrlRead($Combo_State) = "Illinois" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Batavia|Franklin Park|Huntley|Melrose Park|Rockford", "Batavia")
           
        ElseIF GUICtrlRead($Combo_State) = "Indiana" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Driggs", "Driggs")
           
        ElseIF GUICtrlRead($Combo_State) = "Iowa" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "LeMars", "LeMars")
           
        ElseIF GUICtrlRead($Combo_State) = "Massachusetts" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Franklin|Lynn", "Franklin")
           
        ElseIF GUICtrlRead($Combo_State) = "Nevada" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Reno", "Reno")         
                   
        ElseIF GUICtrlRead($Combo_State) = "Pennsylvania" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Sharpsville", "Sharpsville")           

        ElseIF GUICtrlRead($Combo_State) = "Tennessee" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Athens|Chattanooga|Knoxville", "Athens")    

        ElseIF GUICtrlRead($Combo_State) = "Texas" Then
               GUICtrlSetData($Combo_City, "","")
               GUICtrlSetData($Combo_City, "Dallas|Oak Farms|Schepps Dairy Dallas|Schepps Dairy Houston|Sulphur Springs", "Dallas") 
               
        EndIf
           
Case $Button_Submit        
                $s_Combo_City = GUICtrlRead($Combo_City)
        
        If $s_Combo_City = "Altadena" Then
        _Delete()
           FileInstall("GRC\GRC_AD.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\AD.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Buena Park" Then
        _Delete()
           FileInstall("GRC\GRC_BP.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\BP.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Los Angeles" Then
        _Delete()
           FileInstall("GRC\GRC_CA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CA.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Broomfield" Then
        _Delete()
           FileInstall("GRC\GRC_CO.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CO.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "295 Tech Center" Then
        _Delete()
           FileInstall("GRC\GRC_CO.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\CO.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Marietta" Then
        _Delete()
           FileInstall("GRC\GRC_MT.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\MT.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Honolulu" Then
        _Delete()
           FileInstall("GRC\GRC_HI.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\HI.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Boise" Then
        _Delete()
           FileInstall("GRC\GRC_ID.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\ID.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Batavia" Then
        _Delete()
           FileInstall("GRC\GRC_BT.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\BT.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Franklin Park" Then
        _Delete()
           FileInstall("GRC\GRC_FP.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\FP.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Huntley" Then
        _Delete()
           FileInstall("GRC\GRC_IL.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\IL.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Rockford" Then
        _Delete()
           FileInstall("GRC\GRC_RF.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\RF.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "LeMars" Then
        _Delete()
           FileInstall("GRC\GRC_IA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\IA.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Franklin" or $s_Combo_City = "Lynn" Then
        _Delete()
           FileInstall("GRC\GRC_MA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\MA.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Reno" Then
        _Delete()
           FileInstall("GRC\GRC_NV.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\NV.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Sharpsville" Then
        _Delete()
           FileInstall("GRC\GRC_PA.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\PA.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Athens" or $s_Combo_City = "Braselton" or $s_Combo_City = "Chattanooga" or $s_Combo_City = "Knoxville" Then
        _Delete()
           FileInstall("GRC\GRC_TN.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TN.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Dallas" or $s_Combo_City = "Driggs" or $s_Combo_City = "Melrose Park" Then
        _Delete()
           FileInstall("GRC\GRC_TX.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\TX.cer", $Cert & $77f4, 1)
           
        ElseIF $s_Combo_City = "Oak Farms" Then
        _Delete()
           FileInstall("GRC\GRC_OF.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\OF.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Schepps Dairy Dallas" Then
        _Delete()
           FileInstall("GRC\GRC_SD.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SD.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Schepps Dairy Houston" Then
        _Delete()
           FileInstall("GRC\GRC_SH.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SH.cer", $Cert & $4fb7, 1)
           
        ElseIF $s_Combo_City = "Sulphur Springs" Then
        _Delete()
           FileInstall("GRC\GRC_SS.DAT", $GRC & "\GRC.DAT", 1)
           FileInstall("CER\SS.cer", $Cert & $77f4, 1)
           
        EndIF
        
Sleep(2000)
    GUIDelete()
            
MsgBox(48, "Company Name", "Update Was Successfully, Please give time for Symantec to contact the New Server")

Exit
EndSwitch
WEnd
Edited by surreal

Share this post


Link to post
Share on other sites

Looks fine as far as I can tell. Just two remarks:

1. The Func Delete() definition can be anywhere in the code, just don't put it inside an If/Switch etc. I normally put them at the end of my scripts.

2. these statements:

GUICtrlSetData($Combo_City, "", "")
                GUICtrlSetData($Combo_City, "Altadena|Buena Park|Los Angeles", "Altadena")

can be replaced by:

GUICtrlSetData($Combo_City, "|Altadena|Buena Park|Los Angeles", "Altadena")

The leading | will clear the ComboBox as you will read in the helpfile.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

great help, i will make the changes, thanks again.

Share this post


Link to post
Share on other sites

i have search, and have read the help file without any luck. im trying to make the $Combo_State a none editable dropdown with scroll function, limited to 15 lines. at this time i almost have every state in this program. i have tried:

adding both of these:

#include <ComboConstants.au3>

#include <GuiComboBox.au3>

and includeding a: $CBS_DROPDOWNLIST + $WS_VSCROLL

$Combo_City = GUICtrlCreateCombo("", 184, 72, 137, 25, $CBS_DROPDOWNLIST + $WS_VSCROLL)

i have tried alot of other ways but still no luck, it always errors out.

thanks again for your help.

Share this post


Link to post
Share on other sites

You ask for $Combo_State and list $Combo_City.

Can you show the latest version you ahve and what isn't working whne adding these to the $Combo_State ComboBox?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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