Guest b.byers Posted August 31, 2005 Posted August 31, 2005 I'm trying to have a script execute based on what button is selected. Each button would execute a different set of commands.Thxb.byersHere is my script so far.expandcollapse popup#include <GuiConstants.au3>;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000GuiCreate("Machine Selection", 201, 91,(@DesktopWidth-201)/2, (@DesktopHeight-91)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)$Label_1 = GuiCtrlCreateLabel("Select Machine Type", 50, 10, 110, 20)$Button_2 = GuiCtrlCreateButton("Desktop", 20, 50, 60, 30)$Button_3 = GuiCtrlCreateButton("Laptop/Tablet", 100, 50, 80, 30)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE If $msg = $Button_2 Then MsgBox (0,"","Desktop was selected" &@ComputerName) ;RunWait(@ComSpec & " /c " & 'netdom.exe Join' &@ComputerName '/Domain:domainname /OU:OU=WinXP,OU=Desktop,OU=Clients,DC=Domain,DC=com /Userd:TriWest\username /Passwordd:*', "", @SW_HIDE) If $msg = $Button_3 Then MsgBox (0,"","Laptop was selected" &@ComputerName) ;RunWait(@ComSpec & " /c " & 'netdom.exe Join' &@ComputerName '/Domain:domainname /OU:OU=WinXP,OU=Laptop,OU=Clients,DC=Domain,DC=com /Userd:TriWest\username /Passwordd:*', "", @SW_HIDE) ExitLoop ;;; EndSelectWEnd BigDod Posted August 31, 2005 BigDod Jokers 7.3k RIP: The Mayor of Mirth Posted August 31, 2005 This is how I would do it but i am no expert. #include <GuiConstants.au3> ;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 Opt("GUIOnEventMode", 1) GuiCreate("Machine Selection", 201, 91) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $Label_1 = GuiCtrlCreateLabel("Select Machine Type", 50, 10, 110, 20) $Button1 = GuiCtrlCreateButton("Desktop", 20, 50, 60, 30) $Button2 = GuiCtrlCreateButton("Laptop/Tablet", 100, 50, 80, 30) GUICtrlSetOnEvent($Button1, "Dtop") GUICtrlSetOnEvent($Button2, "Ltop") GuiSetState(@SW_SHOW) While 1 Sleep(100) WEnd Func CLOSEClicked() Exit EndFunc Func Dtop() ;RunWait(@ComSpec & " /c " & 'netdom.exe Join' &@ComputerName '/Domain:domainname /OU:OU=WinXP,OU=Desktop,OU=Clients,DC=Domain,DC=com /Userd:TriWest\username /Passwordd:*', "", @SW_HIDE) MsgBox (0,"","Desktop was selected" &@ComputerName) EndFunc Func Ltop() ;RunWait(@ComSpec & " /c " & 'netdom.exe Join' &@ComputerName '/Domain:domainname /OU:OU=WinXP,OU=Laptop,OU=Clients,DC=Domain,DC=com /Userd:TriWest\username /Passwordd:*', "", @SW_HIDE) MsgBox (0,"","Laptop was selected" &@ComputerName) EndFunc Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Dickb Posted August 31, 2005 Posted August 31, 2005 With the While loop it looks like this: #include <GuiConstants.au3> ;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GUICreate("Machine Selection", 201, 91, (@DesktopWidth - 201) / 2, (@DesktopHeight - 91) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Label_1 = GUICtrlCreateLabel("Select Machine Type", 50, 10, 110, 20) $Button_2 = GUICtrlCreateButton("Desktop", 20, 50, 60, 30) $Button_3 = GUICtrlCreateButton("Laptop/Tablet", 100, 50, 80, 30) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_2 MsgBox(0, "", "Desktop was selected" & @ComputerName) ;RunWait(@ComSpec & " /c " & 'netdom.exe Join' &@ComputerName '/Domain:domainname /OU:OU=WinXP,OU=Desktop,OU=Clients,DC=Domain,DC=com /Userd:TriWest\username /Passwordd:*', "", @SW_HIDE) Case $msg = $Button_3 MsgBox(0, "", "Laptop was selected" & @ComputerName) ;RunWait(@ComSpec & " /c " & 'netdom.exe Join' &@ComputerName '/Domain:domainname /OU:OU=WinXP,OU=Laptop,OU=Clients,DC=Domain,DC=com /Userd:TriWest\username /Passwordd:*', "", @SW_HIDE) Case Else ;;; EndSelect WEnd Exit
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now