daedlus Posted May 22, 2006 Share Posted May 22, 2006 Please be patient, this is my first post, and Im only posting because Im stumped.This Program is to automate the process of making an Unattended windows cd. I am having a few problems here: 1st: When I have the code like this I can enter in my data on the first page and create the file and proceed to the second child no problem. But if I take the ";" out from the commands on the 2nd page the program will not advance to the second child. 2nd: I dont want to have to click create, I would rather click next and have it automatically create the file. If I change the until from $msg=$n2 to $msg=$button_1 then I have to hit next twice to goto the next screen. Im sorry if these are really stupid questions, or if this script is messy, but I am new to this program and I have never programed anything before. BTW: thanks to everyone on this board for posting information that has allowed me to learn this much. expandcollapse popup#region;Parent Start #include <GuiConstants.au3> Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) DirCreate("c:\XPCD\$OEM$\$1\Drivers") DirCreate("c:\XPCD\$OEM$\$1\Install") DirCreate("c:\XPCD\$OEM$\$$\Links") DirCreate("c:\XPCD\$OEM$\$$\Resources\Themes") DirCreate("c:\XPCD\$OEM$\$$\system32") DirCreate("c:\XPCD\I386") Dim $show = 0, $Child_[11], $children = 10 $Main = GuiCreate("MyGUI", 580, 440, (@DesktopWidth-516)/2, (@DesktopHeight-323)/2) $Button_1 = GuiCtrlCreateButton("&Next >", 399, 407, 80, 25) GUICtrlSetState(-1,$GUI_DEFBUTTON) $Button_2 = GuiCtrlCreateButton("< &Back", 314, 407, 80, 25) $Button_3 = GuiCtrlCreateButton("&Exit", 484, 407, 80, 25) GuiSetState() #endregion #region;Child_1 $Child_[1] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("Settings for WINNT.SIF",10,0,400) GUICtrlSetFont(-1, 12, 650) $Label_2 = GuiCtrlCreateLabel("Full Name", 36, 33, 47, 12) $Input_3=GuiCtrlCreateInput ("", 90, 30, 197, 20) $Label_4 = GuiCtrlCreateLabel("Company", 38, 62, 62, 14) $Input_5 = GuiCtrlCreateInput("", 90, 60, 197, 20) $Label_6 = GuiCtrlCreateLabel("Serial Key", 36, 93, 48, 15) $Input_7 = GuiCtrlCreateInput("", 90, 90, 197, 20) $Label_8 = GuiCtrlCreateLabel("Admin Password", 4, 153, 80, 14) $Input_9 = GuiCtrlCreateInput("", 90, 150, 197, 20,$es_password) $Label_10 = GuiCtrlCreateLabel("Computer Name", 8, 183, 82, 14) $Input_11 = GuiCtrlCreateInput("", 90, 180, 197, 20) $Label_20 = GuiCtrlCreateLabel("Workgroup", 29, 216) $Input_21 = GuiCtrlCreateInput("", 90, 213,197) $Label_12 = GuiCtrlCreateLabel("Resolution", 30, 273, 60, 20) $Combo_13 = GuiCtrlCreateCombo("800 x 600", 90, 270, 85, 21) GUICtrlSetData(-1,"1024 x 768|1152 x 864|1280x800|1280 x 1024|1600 x 1200","1024 x 768") $Label_14 = GuiCtrlCreateLabel("Colors", 188, 273, 35, 20) $Combo_15 = GuiCtrlCreateCombo("16 Bit", 226, 270, 60, 21) GUICtrlSetData(-1,"24 Bit|32 Bit","32 Bit") $Label_16 = GuiCtrlCreateLabel("Home Page", 26, 306, 60) $Input_17 = GuiCtrlCreateInput("", 90, 303, 197) $Label_18 = GuiCtrlCreateLabel("Search Page", 20, 336) $Input_19 = GuiCtrlCreateInput("", 90, 333,197) GuiSetState() $n2=GUICtrlCreateButton ("&Create",480,357,80,25) GUICtrlSetState(-1,$GUI_FOCUS) Do $msg = GUIGetMsg() if $msg = $n2 then $file = FileOpen("C:\XPCD\I386\WINNT.SIF", 2) FileWrite($file, "[Data]" & @CRLF) FileWrite($file, " AutoPartition=0" & @CRLF) FileWrite($file, ' MsDosInitiated="0"' & @CRLF) FileWrite($file, ' UnattendedInstall="Yes"' & @CRLF) FileWrite($file, " AutomaticUpdates=yes" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Unattended]" & @CRLF) FileWrite($file, " UnattendMode=FullUnattended" & @CRLF) FileWrite($file, " UnattendSwitch=yes" & @CRLF) FileWrite($file, " OemSkipEula=Yes" & @CRLF) FileWrite($file, " OemPreinstall=Yes" & @CRLF) FileWrite($file, " TargetPath=\WINDOWS" & @CRLF) FileWrite($file, " FileSystem=*" & @CRLF) FileWrite($file, " DriverSigningPolicy=Ignore" & @CRLF) FileWrite($file, ' WaitForReboot="No"' & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, 'OemPnPDriversPath="Drivers\000_Chipset;Drivers\001_Network;Drivers\002_Video;Drivers\003_Sound;Drivers\004_Raid"' & @CRLF) FileWrite($file, " FactoryMode=Yes" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[GuiUnattended]" & @CRLF) FileWrite($file, " AdminPassword=") $ap=GUICtrlRead($Input_9) FileWrite($file,$ap) FileWrite($file,"" & @CRLF) FileWrite($file, " AutoLogon=Yes" & @CRLF) FileWrite($file, " AutoLogonCount=1" & @CRLF) FileWrite($file, " OEMSkipRegional=1" & @CRLF) FileWrite($file, " TimeZone=10" & @CRLF) FileWrite($file, " OemSkipWelcome=1" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[UserData]" & @CRLF) FileWrite($file, " ProductKey=");7 $key=GUICtrlRead($Input_7) FileWrite($file,$key& @CRLF) FileWrite($file, ' FullName="') $name=GUICtrlRead($Input_3) FileWrite($file,$name) FileWrite($file,'"' & @CRLF) FileWrite($file, ' OrgName="') $org=GUICtrlRead($Input_5) FileWrite($file,$org) FileWrite($file,'"' & @CRLF) FileWrite($file, " ComputerName=");11 $compname=GUICtrlRead($Input_11) FileWrite($file,$compname) FileWrite($file, "" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Display]" & @CRLF) FileWrite($file, " BitsPerPel=") $bit=GUICtrlRead($Combo_15) if $bit=("16 Bit")Then $but=("16") EndIf if $bit=("24 Bit") Then $but=("24") EndIf if $bit=("32 Bit") Then $but=("32") EndIf FileWrite($file,$but & @CRLF);15 FileWrite($file, " Xresolution=");13 $x=GUICtrlRead($Combo_13) if $x=("800 x 600")then $x1=("800") EndIf if $x=("1024 x 768")Then $x1=("1024") EndIf if $x=("1152 x 864")Then $x1=("1152") EndIf if $X=("1280x800") Then $x1=("1280") EndIf if $x=("1280 x 1024")Then $x1=("1280") EndIf if $x=("1600 x 1200") Then $x1=("1600") EndIf FileWrite($file,$x1) FileWrite($file,"" & @CRLF) FileWrite($file, " YResolution=") $y=GUICtrlRead($Combo_13) if $y=("800 x 600")then $y1=("600") EndIf if $y=("1024 x 768")Then $y1=("768") EndIf if $y=("1152 x 864")Then $y1=("864") EndIf if $y=("1280x800") Then $y1=("800") EndIf if $y=("1280 x 1024")Then $y1=("1024") EndIf if $y=("1600 x 1200") Then $y1=("1200") EndIf FileWrite($file,$y1) FileWrite($file,"" & @CRLF) FileWrite($file, " AutoConfirm=1" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[TapiLocation]" & @CRLF) FileWrite($file, " CountryCode=107" & @CRLF) FileWrite($file, " Dialing=Tone" & @CRLF) FileWrite($file, " AreaCode=403" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[RegionalSettings]" & @CRLF) FileWrite($file, " LanguageGroup=1,7,9,10" & @CRLF) FileWrite($file, " Language=00000409" & @CRLF) FileWrite($file, " SystemLocale=00000409" & @CRLF) FileWrite($file, " UserLocale=00001009" & @CRLF) FileWrite($file, " InputLocale = 1009:00011009" & @CRLF) FileWrite($file, " InputLocale_DefaultUser = 1009:00000409" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Branding]" & @CRLF) FileWrite($file, " BrandIEUsingUnattended=Yes" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[URL]" & @CRLF) FileWrite($file, " Home_Page=");17 $home=GUICtrlRead($Input_17) FileWrite($file,$home) FileWrite($File,"" & @CRLF) FileWrite($file, " Search_Page=");19 $search=GUICtrlRead($Input_19) FileWrite($file,$search) FileWrite($File,"" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Proxy]" & @CRLF) FileWrite($file, " Proxy_Enable=0" & @CRLF) FileWrite($file, " Use_Same_Proxy=1" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Identification]" & @CRLF) FileWrite($file, " JoinWorkgroup=") $wg=GUICtrlRead($Input_21) filewrite($file,$wg) FileWrite($file, "" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Networking]" & @CRLF) FileWrite($file, " InstallDefaultComponents=Yes" & @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Components]" & @CRLF) FileWrite($file, " msmsgs=off" & @CRLF) FileWrite($file, " msnexplr=off" & @CRLF) FileWrite($file, " zonegames=off"& @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Shell]"& @CRLF) FileWrite($file, ' CustomDefaultThemeFile = "%WinDir%\Resources\Themes\MyTheme.theme"'& @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[Components]"& @CRLF) FileWrite($file, " TerminalServer=On"& @CRLF) FileWrite($file, ""& @CRLF) FileWrite($file, "[TerminalServices]"& @CRLF) FileWrite($file, " AllowConnections = 1"& @CRLF) FileWrite($file, "" & @CRLF) FileWrite($file, "[GuiRunOnce]"& @CRLF) FileClose($file) endif Until $msg = $n2 #endregion #region;Child 2 $Child_[2] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $2Label_1 = GuiCtrlCreateLabel("User Names",10,0,400) GUICtrlSetFont(-1, 12, 650) $2Label_2 = GuiCtrlCreateLabel("User 1:", 45, 33, 47, 12) $2Input_3 = GuiCtrlCreateInput ("", 90, 30, 197, 20) $2Label_4 = GuiCtrlCreateLabel("Password:", 30, 63, 62, 14) $2Input_5 = GuiCtrlCreateInput("", 90, 60, 197, 20,$es_password) $2Label_6 = GuiCtrlCreateLabel("User 2:", 45, 123, 48, 15) $2Input_7 = GuiCtrlCreateInput("", 90, 120, 197, 20) $2Label_8 = GuiCtrlCreateLabel("Password:", 30, 153, 80, 14) $2Input_9 = GuiCtrlCreateInput("", 90, 150, 197, 20,$es_password) $2Label_10 = GuiCtrlCreateLabel("User 3:", 45, 213, 47, 12) $2Input_11=GuiCtrlCreateInput ("", 90, 210, 197, 20) $2Label_12 = GuiCtrlCreateLabel("Password:", 30, 243, 62, 14) $2Input_13 = GuiCtrlCreateInput("", 90, 240, 197, 20,$es_password) $2Label_14 = GuiCtrlCreateLabel("User 4:", 45, 303, 48, 15) $2Input_15 = GuiCtrlCreateInput("", 90, 300, 197, 20) $2Label_16 = GuiCtrlCreateLabel("Password:", 30, 333, 80, 14) $2Input_17 = GuiCtrlCreateInput("", 90, 330, 197, 20,$es_password) GUIstartGroup() $2Radio_18= GUICtrlCreateRadio("Auto Logon", 300, 30) $2Radio_19= GUICtrlCreateRadio("Auto Logon", 300, 120) $2Radio_20= GUICtrlCreateRadio("Auto Logon", 300, 210) $2Radio_21= GUICtrlCreateRadio("Auto Logon", 300, 300) $2CheckBox_22= GUICtrlCreateCheckbox("Force Reset at 1st Logon", 300, 60) $2CheckBox_23= GUICtrlCreateCheckbox("Force Reset at 1st Logon", 300, 150) $2CheckBox_24= GUICtrlCreateCheckbox("Force Reset at 1st Logon", 300, 240) $2CheckBox_25= GUICtrlCreateCheckbox("Force Reset at 1st Logon", 300, 330) $2n2=GUICtrlCreateButton ("&Create",480,357,80,25) ;GUICtrlSetState(-1,$GUI_FOCUS) ;Do ;$msg = GUIGetMsg() ;if $msg = $n2 then ;$2file = FileOpen("C:\XPCD\$OEM$\useraccounts.cmd", 2) ;FileWrite($file, "net user ") ;$2u1n=GUICtrlRead($2Input_3) ;filewrite($2file,$2u1n) ;FileWrite($2file, " ") ;$2u1p=GUICtrlRead($2Input_5) ;filewrite($2file,$2u1p) ;FileWrite($2file, " /add" & @CRLF) ;FileClose($2file) ; endif ;Until $msg = $2n2 #endregion #region;Child 3 $Child_[3] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("", 30, 30, 290, 30) GuiSetState(@SW_HIDE) #endregion #region;Child 4 $Child_[4] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("Child 4.", 40, 40, 290, 30) GuiSetState(@SW_HIDE) #endregion #region;Child 5 $Child_[5] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("Child 5.", 50, 50, 290, 30) GuiSetState(@SW_HIDE) #endregion #region;Child 6 $Child_[6] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("Child 6.", 60, 60, 290, 30) GuiSetState(@SW_HIDE) #endregion #region;Child 7 $Child_[7] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("Child 7.", 70, 70, 290, 30) GuiSetState(@SW_HIDE) #endregion #region;Child 8 $Child_[8] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("Child 8.", 80, 80, 290, 30) GuiSetState(@SW_HIDE) #endregion #region;Child 9 $Child_[9] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("Child 9.", 90, 90, 290, 30) GuiSetState(@SW_HIDE) #endregion #region;Child 10 $Child_[10] = GuiCreate("", 572, 390, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main) $Label_1 = GuiCtrlCreateLabel("Child 10..... You Must be Nuts if you have ... 10 Children!!!", 50, 100, 390, 30) GUICtrlSetFont(-1, 10, 650) GuiSetState(@SW_HIDE) #endregion #region;Parent End While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_3 ExitLoop Case $msg = $Button_1 Set_Next() Case $msg = $Button_2 Set_Back() ;;; EndSelect WEnd ;--------- Functions ------------------- Func Set_Next() For $x = 1 to $children -1 $Nwin = WinGetState( $child_[$x] ) If $Nwin > 5 Then GuiSetState( @SW_HIDE, $child_[$x]) GuiSetState( @SW_SHOW, $child_[$x +1]) Return EndIf Next EndFunc Func Set_Back() For $x = $children To 1 Step -1 $Nwin = WinGetState( $child_[$x] ) If $Nwin > 5 Then GuiSetState( @SW_HIDE, $child_[$x]) GuiSetState( @SW_SHOW, $child_[$x -1]) Return EndIf Next EndFunc #endregion 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