Jump to content

Need Help with Script!


Recommended Posts

I am lost! I cannot add a 3rd menu item. Basically I want to add one more function but I cannot get it to work.

; Group Policy : QuickPolicy Installer v1.0 DR-1
; Author: Timothy A. Wood
; Date: 06/01/08
; Lexen802@gmail.com
#include <GUIConstants.au3>

GUICreate("QuickPolicy Installer", 255, 110, 255, 255)
GUICtrlCreateLabel("Please select which GroupPolicy you wish to install.", 5, 5)
$buttonInstall = GUICtrlCreateButton("Install", 95, 75, 60)
$comboInstallType = GUICtrlCreateCombo("Staff", 93, 40, 65, $CBS_DROPDOWN)
GUICtrlSetData($comboInstallType, "Lab", "Staff")
GUISetState()
GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $buttonInstall
If GUICtrlRead($comboInstallType) = "Staff" Then
_StudentInstall()
Else
_MasterInstall()
EndIf
ExitLoop
EndSelect
WEnd

Func _StudentInstall()
$Staff = IniRead("gpconfig.ini", "Configuration", "Staff", "NotFound")
$StaffDest = IniRead("gpconfig.ini", "Configuration", "StaffDest", "NotFound")
DirCopy($Staff, $StaffDest, 1)
MsgBox(4096, "QuickPolicy Installer", "Staff Group Policy Installed Successfully!", 10)
EndFunc

Func _MasterInstall()
$Lab = IniRead("gpconfig.ini", "Configuration", "Lab", "NotFound")
$LabDest = IniRead("gpconfig.ini", "Configuration", "LabDest", "NotFound")
DirCopy($Lab, $LabDest, 1)
MsgBox(4096, "QuickPolicy Installer", "Lab Group Policy Installed Successfully!", 10)
EndFunc

This is what I am trying but it does not work.

; Group Policy : QuickPolicy Installer v1.0 DR-1
; Author: Timothy A. Wood
; Date: 06/01/08
; Lexen802@gmail.com
#include <GUIConstants.au3>

GUICreate("QuickPolicy Installer", 255, 110, 255, 255)
GUICtrlCreateLabel("Please select which GroupPolicy you wish to install.", 5, 5)
$buttonInstall = GUICtrlCreateButton("Install", 95, 75, 60)
$comboInstallType = GUICtrlCreateCombo("Staff", 93, 40, 65, $CBS_DROPDOWN)
GUICtrlSetData($comboInstallType, "Lab", "Staff", "Laptop")
GUISetState()
GUISetState(@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $buttonInstall
If GUICtrlRead($comboInstallType) = "Staff" Then
_StudentInstall()
If GUICtrlRead($comboInstallType) = "Laptop" Then
_LaptopInstall()
Else
_MasterInstall()
EndIf
ExitLoop
EndSelect
WEnd

Func _LaptopInstall()
MsgBox(4096, "QuickPolicy Installer", "Laptops!!!!", 10)
EndFunc

Func _StudentInstall()
$Staff = IniRead("gpconfig.ini", "Configuration", "Staff", "NotFound")
$StaffDest = IniRead("gpconfig.ini", "Configuration", "StaffDest", "NotFound")
DirCopy($Staff, $StaffDest, 1)
MsgBox(4096, "QuickPolicy Installer", "Staff Group Policy Installed Successfully!", 10)
EndFunc

Func _MasterInstall()
$Lab = IniRead("gpconfig.ini", "Configuration", "Lab", "NotFound")
$LabDest = IniRead("gpconfig.ini", "Configuration", "LabDest", "NotFound")
DirCopy($Lab, $LabDest, 1)
MsgBox(4096, "QuickPolicy Installer", "Lab Group Policy Installed Successfully!", 10)
EndFunc

Can anyone show me how to fix this?

[center][/center][center]Xonos Development[font=trebuchet ms,helvetica,sans-serif]- Resources -[/font]AutoIT Documentation | Active Directory UDF | Windows Services UDF | Koda GUI Designer[/center]

Link to comment
Share on other sites

You're missing an EndIf in your loop. There were a few issues with your combo box declaration as well. I tested this and it works:

; Group Policy : QuickPolicy Installer v1.0 DR-1
; Author: Timothy A. Wood
; Date: 06/01/08
; Lexen802@gmail.com
#include <GUIConstants.au3>

GUICreate("QuickPolicy Installer", 255, 110, 255, 255)
GUICtrlCreateLabel("Please select which GroupPolicy you wish to install.", 5, 5)
$buttonInstall = GUICtrlCreateButton("Install", 95, 75, 60)
$comboInstallType = GUICtrlCreateCombo("", 93, 40, 65, $CBS_DROPDOWN)
GUICtrlSetData($comboInstallType, "Lab|Staff|Laptop")
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $buttonInstall
            If GUICtrlRead($comboInstallType) = "Staff" Then
                _StudentInstall()
            EndIf
            If GUICtrlRead($comboInstallType) = "Laptop" Then
                _LaptopInstall()
            Else
                _MasterInstall()
            EndIf
            ExitLoop
    EndSelect
WEnd

Func _LaptopInstall()
MsgBox(4096, "QuickPolicy Installer", "Laptops!!!!", 10)
EndFunc

Func _StudentInstall()
    $Staff = IniRead("gpconfig.ini", "Configuration", "Staff", "NotFound")
    $StaffDest = IniRead("gpconfig.ini", "Configuration", "StaffDest", "NotFound")
    DirCopy($Staff, $StaffDest, 1)
    MsgBox(4096, "QuickPolicy Installer", "Staff Group Policy Installed Successfully!", 10)
EndFunc

Func _MasterInstall()
    $Lab = IniRead("gpconfig.ini", "Configuration", "Lab", "NotFound")
    $LabDest = IniRead("gpconfig.ini", "Configuration", "LabDest", "NotFound")
    DirCopy($Lab, $LabDest, 1)
    MsgBox(4096, "QuickPolicy Installer", "Lab Group Policy Installed Successfully!", 10)
EndFunc
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

Thanks a Lot!!!!!!! Hey, i'm trying to add "Staff" back as the default item. I added it but it doesn't exactly have a function declared for it so it doesn't work.

Edited by Richardo

[center][/center][center]Xonos Development[font=trebuchet ms,helvetica,sans-serif]- Resources -[/font]AutoIT Documentation | Active Directory UDF | Windows Services UDF | Koda GUI Designer[/center]

Link to comment
Share on other sites

Thanks a Lot!!!!!!! Hey, i'm trying to add "Staff" back as the default item. I added it but it doesn't exactly have a function declared for it so it doesn't work.

Change this:

$comboInstallType = GUICtrlCreateCombo("", 93, 40, 65, $CBS_DROPDOWN)
GUICtrlSetData($comboInstallType, "Lab|Staff|Laptop")

To this:

$comboInstallType = GUICtrlCreateCombo("Staff", 93, 40, 65, $CBS_DROPDOWN)
GUICtrlSetData($comboInstallType, "Lab|Laptop")
Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...