whitts Posted November 9, 2007 Share Posted November 9, 2007 (edited) I have posted my entire code below. Everythings working but i cant find away to integrate my radio buttons.I have two radio buttons: - $Radio1 = GUICtrlCreateRadio("Brother MFC8500", 120, 352, 113, 17)$Radio2 = GUICtrlCreateRadio("Brother MFC-8220", 8, 352, 113, 17)Basically when on of them is selected i want this part to be adjusted: - (brotherMFC-8220) so if brother 8500 is selected (by radio button) i want this to change to brother 8500 and if brother 8220 is selected (by radio button) i want it change to brother 8220._ArrayAdd($Third,'rundll32 /s printui.dll, PrintUIEntry /if /q /b "' &GUICtrlRead($Display)& '" /f "c:\8220\Adduni.inf" /r "\\' &GUICtrlRead($IP) & '\' &GUICtrlRead($Share)& '" /m "Brother MFC-8220" w')CODE#include <GUIConstants.au3>#include <Array.au3>#include <File.au3>Global $SaveCnt = 1Global $Saved[1]Global $Second[1]Global $Third[1]Global $fourth[1]Global $fourtha[1]Global $fourthb[1]Global $Fifth[1]$Local = GUICreate("Local Port Batch File Creator", 604, 425, 215, 182)GUISetBkColor(0xFF0000)$Label1 = GUICtrlCreateLabel("Scan Station's IP", 24, 8, 143, 24)GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")GUICtrlSetColor(-1, 0xFFFFFF)$IP = GUICtrlCreateInput("IP", 8, 32, 185, 21)$Label2 = GUICtrlCreateLabel("Share Name", 248, 8, 103, 24)GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")GUICtrlSetColor(-1, 0xFFFFFF)$Share = GUICtrlCreateInput("Share", 208, 32, 185, 21)$Label3 = GUICtrlCreateLabel("Printer's Display Name", 408, 8, 184, 24)GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")GUICtrlSetColor(-1, 0xFFFFFF)$Display = GUICtrlCreateInput("Display", 408, 32, 185, 21)$Add = GUICtrlCreateButton("Add Printer", 8, 384, 187, 33, 0)$Printers = GUICtrlCreateEdit("", 8, 72, 185, 265)GUICtrlSetData(-1, "sData")$Create = GUICtrlCreateButton("Create Batch File", 208, 384, 187, 33, 0)$Radio1 = GUICtrlCreateRadio("Brother MFC8500", 120, 352, 113, 17)$Radio2 = GUICtrlCreateRadio("Brother MFC-8220", 8, 352, 113, 17)$netuse = GUICtrlCreateButton("Create Net Use", 408, 384, 185, 33)$Edit1 = GUICtrlCreateEdit("", 208, 72, 185, 265)GUICtrlSetData(-1, "Edit1")$Edit2 = GUICtrlCreateEdit("", 408, 72, 185, 265)GUICtrlSetData(-1, "Edit2")GUISetState(@SW_SHOW)_ArrayAdd($Saved,'ECHO.^<package^>>"yes.wsf"')_ArrayAdd($Saved, 'ECHO.>>"yes.wsf"')_ArrayAdd($Saved, '')_ArrayAdd($Saved, 'ECHO.^<job id="vbs"^>>>"yes.wsf"')_ArrayAdd($Saved, 'ECHO.>>"yes.wsf"')_ArrayAdd($Saved, 'ECHO. ^<script language="VBScript"^>>>"yes.wsf"')_ArrayAdd($Saved, 'ECHO.set WshShell = WScript.CreateObject("WScript.Shell")>>"yes.wsf"')_ArrayAdd($Saved, 'ECHO.WScript.Sleep 3000>>"yes.wsf"')_ArrayAdd($Saved, 'ECHO.WshShell.SendKeys "Y">>"yes.wsf"')_ArrayAdd($Saved, 'ECHO.^</script^>>>"yes.wsf"')_ArrayAdd($Saved, 'ECHO.^</job^>>>"yes.wsf"')_ArrayAdd($Saved, 'ECHO.^</package^>>>"yes.wsf"')_ArrayAdd($Saved, '')_ArrayAdd($Saved, 'ECHO.Windows Registry Editor Version 5.00>"printer.reg"')_ArrayAdd($Saved, 'ECHO.>>"printer.reg"')_ArrayAdd($Saved, '')_ArrayAdd($Second,'regedit /S printer.reg')_ArrayAdd($Second,'')_ArrayAdd($Second,'net stop spooler')_ArrayAdd($Second,'net start spooler')While 1$nMsg = GUIGetMsg()Switch $nMsgCase $GUI_EVENT_CLOSEExitCase $Add_ArrayAdd($fourth,GUICtrlRead($IP))$sData = _ArrayToString($fourth, @CRLF)GuiCtrlSetData($Printers, $sData)_ArrayAdd($fourtha,GUICtrlRead($Share))$sData = _ArrayToString($fourtha, @CRLF)GuiCtrlSetData($Edit1, $sData)_ArrayAdd($fourthb,GUICtrlRead($Display))$sData = _ArrayToString($fourthb, @CRLF)GuiCtrlSetData($Edit2, $sData)_ArrayAdd($Saved,'ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg"')_ArrayAdd($Saved,'ECHO."\\\\' &GUICtrlRead($IP) & "\\" &GUICtrlRead($Share)& '"="">"printer.reg">>"printer.reg"')_ArrayAdd($Saved, '')_ArrayAdd($Third,'start wscript yes.wsf')_ArrayAdd($Third,'')_ArrayAdd($Third,'rundll32 /s printui.dll, PrintUIEntry /if /q /b "' &GUICtrlRead($Display)& '" /f "c:\8220\Adduni.inf" /r "\\' &GUICtrlRead($IP) & '\' &GUICtrlRead($Share)& '" /m "Brother MFC-8220" w')_ArrayAdd($Third,'')_ArrayAdd($Fifth,'net use \\' &GUICtrlRead($IP) & "\" &GUICtrlRead($Share)& ' /user:GUICtrlSetData($IP,"")GUICtrlSetData($Share,"")GUICtrlSetData($Display,"")$array4 = ArrayMerge($Saved, $Second)$array4 = ArrayMerge($array4, $Third)Func ArrayMerge($amSaved, $amSecond) Local $tempArray = $amSaved Local $amElements = Ubound($tempArray) + Ubound($amSecond) Redim $tempArray[$amElements] Local $amCount = 0 For $X = Ubound($amSaved) to $amElements - 1 $tempArray[$X] = $amSecond[$amCount] $amCount += 1 Next Return $tempArrayEndFuncCase $Create _ArrayAdd($array4,'del yes.wsf') _ArrayAdd($array4,'del printer.reg') _FileWriteFromArray("localport.bat",$array4)Case $netuse_FileWriteFromArray("printer.bat",$fifth)EndSwitchWEnd Edited January 15, 2009 by whitts Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 9, 2007 Share Posted November 9, 2007 I have posted my entire code below. Everythings working but i cant find away to integrate my radio buttons. I have two radio buttons: - $Radio1 = GUICtrlCreateRadio("Brother MFC8500", 120, 352, 113, 17) $Radio2 = GUICtrlCreateRadio("Brother MFC-8220", 8, 352, 113, 17) Basically when on of them is selected i want this part to be adjusted: - (brotherMFC-8220) so if brother 8500 is selected (by radio button) i want this to change to brother 8500 and if brother 8220 is selected (by radio button) i want it change to brother 8220. _ArrayAdd($Third,'rundll32 /s printui.dll, PrintUIEntry /if /q /b "' &GUICtrlRead($Display)& '" /f "c:\8220\Adduni.inf" /r "\\' &GUICtrlRead($IP) & '\' &GUICtrlRead($Share)& '" /m "Brother MFC-8220" w') Something like this: Dim $sPrinter = "Default" If ControlCommand($Local, "", $Radio1, "IsChecked") Then $sPrinter = "Brother MFC8500" If ControlCommand($Local, "", $Radio2, "IsChecked") Then $sPrinter = "Brother MFC-8220" _ArrayAdd($Third, 'rundll32 /s printui.dll, PrintUIEntry /if /q /b "' & GUICtrlRead($Display) & _ '" /f "c:\8220\Adduni.inf" /r "\\' & GUICtrlRead($IP) & '\' & GUICtrlRead($Share) & '" /m "' & $sPrinter & '" w') Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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