TSO Posted June 19, 2008 Share Posted June 19, 2008 Ok, I give up, I've searched all over to find out how I'm supposed to do this... What I want is for a button on $Form1 to open $Form2, and to be able to write 'Cases' for $Form2, and once $Form2 is exited, back to $Form1. Any help would be seriously appreciated.. Here's the entire code, look for the ;;;;;;;;;;;;; before the specific section I'm working/struggling with (towards the bottom).. Thanks! expandcollapse popup; AutoIt Version: 3.x ; Language: English ; Platform: Win 2000/XP ; Author: xxx ; ; Script Function: ; This script will use technician interface to populate the 'Registered Organization' Windows registry key ; with the support organization determined to be appropriate for the computer the script is run on. ; The result of this populated key will be a notation under 'My Computer' properties, and the ability ; for the computer's designated support group to be inventoried by Altiris. $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") $colSMBIOS = $objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure") $wmi = ObjGet("winmgmts:") $wql = "select * from win32_computersystem" $results = $wmi.execquery($wql) $secStat = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedSector") $busStat = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedBusinessUnit") $supStat = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedSupportGroup") If $secStat = "" Then $secStat = "Undefined" EndIf If $busStat = "" Then $busStat = "Undefined" EndIf If $supStat = "" Then $supStat = "Undefined" EndIf For $objSMBIOS in $colSMBIOS ;ConsoleWrite("Serial Number: " & $objSMBIOS.SerialNumber & @CRLF) ;ConsoleWrite("Asset Tag: " & $objSMBIOS.SMBIOSAssetTag & @CRLF) Next For $compsys in $results ConsoleWrite("Domain: " & $compsys.domain & @CRLF) Next #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\s830829\Desktop\koda_1.7.0.1\Forms\EUSGUI3.kxf $Form1 = GUICreate("RoS", 332, 470, 214, 139) $Label1 = GUICtrlCreateLabel("Select Business Unit:", 144, 224, 130, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Select Sector:", 144, 168, 85, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("Select Support Group:", 144, 280, 130, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Group2 = GUICtrlCreateGroup("Change Service:", 136, 144, 185, 185) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Label7 = GUICtrlCreateLabel("Redirection of Service", 75, 0, 180, 25) GUICtrlSetFont(-1, 12, 800, 4, "Arial Unicode MS") GUICtrlSetColor(-1, 0x000080) $Button1 = GUICtrlCreateButton("Change", 32, 424, 115, 33, 0) $Button2 = GUICtrlCreateButton("Cancel", 184, 424, 115, 33, 0) $Label4 = GUICtrlCreateLabel("Support Group:", 16, 280, 90, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("Sector:", 16, 168, 45, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label6 = GUICtrlCreateLabel("Business Unit:", 16, 224, 85, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Group1 = GUICtrlCreateGroup("Current Status:", 8, 144, 121, 185) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $secInf = GUICtrlCreateInput($secStat, 16, 184, 105, 21, $ES_READONLY) GUICtrlSetBkColor(-1, 0xE1E0D2) $busInf = GUICtrlCreateInput($busStat, 16, 240, 105, 21, $ES_READONLY) GUICtrlSetBkColor(-1, 0xE1E0D2) $supInf = GUICtrlCreateInput($supStat, 16, 296, 105, 21, $ES_READONLY) GUICtrlSetBkColor(-1, 0xE1E0D2) $Label8 = GUICtrlCreateLabel("Host Name:", 72, 64, 70, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label9 = GUICtrlCreateLabel("Domain:", 88, 88, 50, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label10 = GUICtrlCreateLabel("Serial Number:", 56, 112, 87, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $hostName = GUICtrlCreateInput(@ComputerName, 152, 56, 121, 21, $ES_READONLY) GUICtrlSetBkColor(-1, 0xE1E0D2) $Domain = GUICtrlCreateInput($compsys.domain, 152, 80, 121, 21, $ES_READONLY) GUICtrlSetBkColor(-1, 0xE1E0D2) $sNum = GUICtrlCreateInput($objSMBIOS.SerialNumber, 152, 104, 121, 21, $ES_READONLY) GUICtrlSetBkColor(-1, 0xE1E0D2) $Group3 = GUICtrlCreateGroup("This Computer Information:", 48, 32, 233, 105) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Radio1 = GUICtrlCreateRadio("New Deployment", 56, 368, 113, 17) $Radio2 = GUICtrlCreateRadio("Refresh Upgrade", 56, 384, 113, 17) $Radio3 = GUICtrlCreateRadio("Asset Removal", 176, 368, 97, 17) $Radio4 = GUICtrlCreateRadio("Existing Asset", 176, 384, 97, 17) $Group4 = GUICtrlCreateGroup("This Computer is a...", 48, 344, 233, 65) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) $Combo1 = GUICtrlCreateCombo("", 144, 184, 97, 200,BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) GUICtrlSetData($Combo1, "SECTOR1|SECTOR2|SECTOR3") $Combo3 = GUICtrlCreateCombo("", 144, 296, 161, 200,BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) GUICtrlSetData($Combo3, "SUPPORT1|SUPPORT2|SUPPORT3") $Combo2 = GUICtrlCreateCombo("", 144, 240, 161, 200,BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) GUICtrlSetData($Combo2, "BUSINESS1|BUSINESS2|BUSINESS3") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Select Case $nMsg = $Button2 Exit Case $nMsg = $Button1 AND GUICtrlRead($Combo1) = "" MsgBox(0, "Information Required", "Please choose a Sector") Case $nMsg = $Button1 AND GUICtrlRead($Radio2) = $GUI_CHECKED ;;;;;;;Case $nMsg = $Button1 AND GUICtrlRead($Radio2) = $GUI_CHECKED ;;;;;;;$Form2 = GUICreate("Insert Old Tag #", 259, 113, 267, 272) ;;;;;;;$RLabel1 = GUICtrlCreateLabel("Please input FULL asset tag of the OLD computer", 8, 8, 240, 17) ;;;;;;;$RInput1 = GUICtrlCreateInput("", 48, 48, 161, 21) ;;;;;;;$RButton1 = GUICtrlCreateButton("OK", 40, 80, 75, 25, 0) ;;;;;;;$RButton2 = GUICtrlCreateButton("Cancel", 144, 80, 75, 25, 0) ;;;;;;;$RLabel2 = GUICtrlCreateLabel("(Example: ITE0001234)", 64, 24, 115, 17) ;;;;;;;GUISetState(@SW_SHOW) Case $nMsg = $Button1 AND GUICtrlRead($Radio3) = $GUI_CHECKED RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "REG_SZ", "Asset Removed") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedSupportGroup", "REG_SZ", "Asset Removed") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedBusinessUnit", "REG_SZ", "Asset Removed") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedSector", "REG_SZ", "Asset Removed") MsgBox(0, "Updated", "This asset has been removed from the database") Exit Case $nMsg = $Button1 RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", "REG_SZ", GUICtrlRead($Combo3)) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedSupportGroup", "REG_SZ", GUICtrlRead($Combo3)) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedBusinessUnit", "REG_SZ", GUICtrlRead($Combo2)) RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "AssignedSector", "REG_SZ", GUICtrlRead($Combo1)) MsgBox(0, "Updated", "Support information has been updated") Exit EndSelect WEnd #EndRegion ### END Koda GUI section ### Link to comment Share on other sites More sharing options...
TSO Posted June 19, 2008 Author Share Posted June 19, 2008 I may have figured this out, though I'm sure it's sloppy as hell. I added another 'While' in the $Form2 section, and the cases seem to be working independently from $Form1 now. If this is wrong somehow, please feel free to let me know. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted June 19, 2008 Share Posted June 19, 2008 It's not wrong it it works the way you wanted it to be. I myself have used multiple GUI's in both the ways you are describing successfully. But it shouldn't be any slower, are you sure you didn't slip in a Sleep() somewhere? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
TSO Posted June 19, 2008 Author Share Posted June 19, 2008 It's not wrong it it works the way you wanted it to be.I myself have used multiple GUI's in both the ways you are describing successfully. But it shouldn't be any slower, are you sure you didn't slip in a Sleep() somewhere?Nah, the thing is, I couldn't figure out how to write Cases for $Form2, they were only using variables and trying to change $Form1. I just took a guess that if I surrounded the new $Form2 inside of a While/Wend that it might let me define the $Form2 Cases inside of that, and dumb f'ing luck, it worked! lol I think this script is just about done (my first btw). It sure feels sloppy as hell, but honestly it does what we want to the T and haven't seen a sign of bugging yet Link to comment Share on other sites More sharing options...
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