
whitts
Active Members-
Posts
25 -
Joined
-
Last visited
Everything posted by whitts
-
Is there any way to mask the input of a GUICTRLCREATEINPUT E.G. $Something = GUICtrlCreateInput("Enter something (mask ***.***.***) ", 208, 32, 185, 21) Only allowing numbers? thanks
-
On program exit how do i delete whats in memory, and/or clear out the arrays. Thanks
-
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 = 1 Global $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 $nMsg Case $GUI_EVENT_CLOSE Exit Case $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 $tempArray EndFunc Case $Create _ArrayAdd($array4,'del yes.wsf') _ArrayAdd($array4,'del printer.reg') _FileWriteFromArray("localport.bat",$array4) Case $netuse _FileWriteFromArray("printer.bat",$fifth) EndSwitch WEnd
-
Works perfectly thanks
-
How do i display an array to an edit window using _ArrayDisplay This is where i want to show it $Printers = GUICtrlCreateEdit("", 8, 144, 585, 137)
-
Thanks weaponx, that code works a treat
-
Ok say i have 3 arrays $array1 $array2 $array3 How could i add $array2 to the end of array $array1 and then add $array3 to the end of $array1 (which would at this point would contain $array2) Thanks
-
How do i open it back up in append mode? Thanks
-
Blue_Drache your solution works in the correct order for me but only allows one press of the save button. PsaltyDS works but seems to put things in the array in strange places... Thanks to you both for your input..
-
I was wondering if we can write to a file from more than one array at the same time. e.g. I dont want to do it seperately because the second will over write the first. _FileWriteFromArray("MyFile.txt",$Saved &$Second)
-
Below i have 3 cases in a row all are the same (when i press the save button) I want to exicute the first one until everything is added in the array and then move to the second until everyting in the array is added then to the third. At the moment the program is excuting the first thing in the array for the first case then the first thing in the array for the seocnd an dthen the third and then starts again with the second thing in the array. Anyone any ideas? Thanks CODE#include <GUIConstants.au3> #include <Array.au3> #include <File.au3> Global $Saved[1];This will be an array of 2 elements, but _ArrayAdd will take care of ;making it bigger as you add data. GUICreate("", 273, 192, 217, 152) $Input1 = GUICtrlCreateInput("Input1", 12, 14, 245, 21) $Input2 = GUICtrlCreateInput("Input2", 12, 47, 245, 21) $Input3 = GUICtrlCreateInput("Input3", 12, 80, 245, 21) $Save = GUICtrlCreateButton("Save to memory", 22, 130, 105, 45, $BS_DEFPUSHBUTTON) $Write = GUICtrlCreateButton("Write to file", 142, 130, 105, 45, 0) 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, '') While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Save _ArrayAdd($Saved,'ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg"') _ArrayAdd($Saved,'ECHO."\\\\' &GUICtrlRead($Input1) & "\\" &GUICtrlRead($Input2)& '"="">"printer.reg">>"printer.reg"') _ArrayAdd($Saved, '') GUICtrlSetData($Input1,"") GUICtrlSetData($Input2,"") GUICtrlSetData($Input3,"") Case $Save _ArrayAdd($Saved, 'regedit /S printer.reg') _ArrayAdd($Saved, '') _ArrayAdd($Saved, 'net stop spooler') _ArrayAdd($Saved, 'net start spooler') Case $Save _ArrayAdd($Saved,'start wscript yes.wsf') _ArrayAdd($Saved,'') _ArrayAdd($Saved, 'rundll32 /s printui.dll, PrintUIEntry /if /q /b "' &GUICtrlRead($Input2)& '" /f "c:\8220\Adduni.inf" /r "\\' &GUICtrlRead($Input1) & '\' &GUICtrlRead($Input2)& '" /m "Brother MFC-8220" w') _ArrayAdd($Saved,'') GUICtrlSetData($Input1,"") GUICtrlSetData($Input2,"") GUICtrlSetData($Input3,"") Case $Write ;~ _ArrayDisplay($Saved) _FileWriteFromArray("MyFile.txt",$Saved) EndSwitch WEnd
-
Das Ami here is my code... CODE#include <GUIConstants.au3> #include <Array.au3> #include <File.au3> Global $Saved[1];This will be an array of 2 elements, but _ArrayAdd will take care of ;making it bigger as you add data. GUICreate("", 273, 192, 217, 152) $Input1 = GUICtrlCreateInput("Input1", 12, 14, 245, 21) $Input2 = GUICtrlCreateInput("Input2", 12, 47, 245, 21) $Input3 = GUICtrlCreateInput("Input3", 12, 80, 245, 21) $Save = GUICtrlCreateButton("Save to memory", 22, 130, 105, 45, $BS_DEFPUSHBUTTON) $Write = GUICtrlCreateButton("Write to file", 142, 130, 105, 45, 0) GUISetState(@SW_SHOW) #include <File.au3> If Not _FileCreate("myfile.txt") Then MsgBox(4096,"Error", " Error Creating/Resetting log. error:" & @error) EndIf $file = FileOpen("myfile.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, 'ECHO.^<package^>>"yes.wsf"') FileWriteLine($file, 'ECHO.>>"yes.wsf"') FileWriteLine($file, '') FileWriteLine($file, 'ECHO.^<job id="vbs"^>>>"yes.wsf"') FileWriteLine($file, 'ECHO.>>"yes.wsf"') FileWriteLine($file, 'ECHO. ^<script language="VBScript"^>>>"yes.wsf"') FileWriteLine($file, 'ECHO.set WshShell = WScript.CreateObject("WScript.Shell")>>"yes.wsf"') FileWriteLine($file, 'ECHO.WScript.Sleep 3000>>"yes.wsf"') FileWriteLine($file, 'ECHO.WshShell.SendKeys "Y">>"yes.wsf"') FileWriteLine($file, 'ECHO.^</script^>>>"yes.wsf"') FileWriteLine($file, 'ECHO.^</job^>>>"yes.wsf"') FileWriteLine($file, 'ECHO.^</package^>>>"yes.wsf"') FileWriteLine($file, '') FileWriteLine($file, 'ECHO.Windows Registry Editor Version 5.00>"printer.reg"') FileWriteLine($file, 'ECHO.>>"printer.reg"') FileWriteLine($file, '') FileClose($file) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Save _ArrayAdd($Saved,'ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg"') _ArrayAdd($Saved,'ECHO."\\\\' &GUICtrlRead($Input1) & "\\" &GUICtrlRead($Input2)& '"="">"printer.reg">>"printer.reg"') GUICtrlSetData($Input1,"") GUICtrlSetData($Input2,"") GUICtrlSetData($Input3,"") Case $Write ;~ _ArrayDisplay($Saved) _FileWriteFromArray("MyFile.txt",$Saved) EndSwitch WEnd Thanks BsaltyDS i will take a look at that
-
I just tried it the way you told me to - whee am i going wrong... Heres my code CODEWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Save _ArrayAdd($Saved,'ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg"') _ArrayAdd($Saved,'ECHO."\\\\' &GUICtrlRead($Input1) & "\\" &GUICtrlRead($Input2)& '"="">"printer.reg">>"printer.reg"') GUICtrlSetData($Input1,"") GUICtrlSetData($Input2,"") GUICtrlSetData($Input3,"") Case $Write For $i=1 to $Saved[0] FileWriteLine ("myfile.txt", $Saved[$i]) Next EndSwitch WEnd
-
How do i get _FileWriteFromArray("MyFile.txt",$Saved) To append the text to the end of an already created file. The file myfile.txt already has text in it and i dont want that overwritten i just want the text in the array to be written after the original text.. Thanks
-
Thankyou so much Thats exactly how i wanted it... Thanks again for your time an knowledge
-
#include <GUIConstants.au3> #include <File.au3> Global $Saved[3] GUICreate("", 273, 192, 217, 152) $Input1 = GUICtrlCreateInput("Input1", 12, 14, 245, 21) $Input2 = GUICtrlCreateInput("Input2", 12, 47, 245, 21) $Input3 = GUICtrlCreateInput("Input3", 12, 80, 245, 21) $Save = GUICtrlCreateButton("Save to memory", 22, 130, 105, 45, $BS_DEFPUSHBUTTON) $Write = GUICtrlCreateButton("Write to file", 142, 130, 105, 45, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Save $Saved[0]=$Saved[0] & " " &GUICtrlRead($Input1) &GUICtrlRead($Input2) &GUICtrlRead($Input3) ;I want to display like this. GUICtrlSetData($Input1,"") GUICtrlSetData($Input2,"") GUICtrlSetData($Input3,"") Case $Write _FileWriteFromArray("MyFile.txt",$Saved) $Saved[0]="" $Saved[1]="" $Saved[2]="" EndSwitch WEnd But when i add the second lot of data i dont want it go on the end i want it to go to the next line. How do i make start a new line? Thanks
-
Thanks Nahuel I think im nearly there now....
-
I can now get it to go into the array but how to i get it out of the array in the format that i want?
-
Something like that, i will describe what i wanted it to do. I basically anted the program to ask for the ip (inputA), share name (input and display name (input C). Then when the user hits add those go to memory. Then the user can repeat the same steps for different printer and so on until he hits finish. When finish is pressed i want all the printers in memory and their details to be written to a file. The file is formatted as follows:- ECHO.^<package^>>"yes.wsf" ECHO.>>"yes.wsf" ECHO.^<job id="vbs"^>>>"yes.wsf" ECHO.>>"yes.wsf" ECHO. ^<script language="VBScript"^>>>"yes.wsf" ECHO.set WshShell = WScript.CreateObject("WScript.Shell")>>"yes.wsf" ECHO.WScript.Sleep 3000>>"yes.wsf" ECHO.WshShell.SendKeys "Y">>"yes.wsf" ECHO.^</script^>>>"yes.wsf" ECHO.^</job^>>>"yes.wsf" ECHO.^</package^>>>"yes.wsf" ECHO.Windows Registry Editor Version 5.00>"printer.reg" ECHO.>>"printer.reg" ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg" ECHO."\\\\192.168.136.88(INPUT A)\\ICU (INPUT "="">"printer.reg">>"printer.reg" ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg" ECHO."\\\\192.168.136.89(INPUT A - ADDED AGAIN)\\ER ((INPUT b -ADDED AGAIN)"="">"printer.reg">>"printer.reg" regedit /S printer.reg net stop spooler net start spooler start wscript yes.wsf rundll32 /s printui.dll, PrintUIEntry /if /q /b "ICU" /f "c:\8220\Adduni.inf" /r "\\192.168.136.88\ICU" /m "Brother MFC-8220" w start wscript yes.wsf rundll32 /s printui.dll, PrintUIEntry /if /q /b "ER" /f "c:\8220\Adduni.inf" /r "\\192.168.136.90\ER" /m "Brother MFC-8220" w del yes.wsf del printer.reg tHANKS
-
Hi i was wondering if anyone can help me. I have several gui input boxes, call them input A, input B and input C. Once these are filled in, you press the add button and these are added into memory, i wanted to be able to do this as many times as needed until you press the finsihde button, once the finish button is pressed i want all the text in memory to be written to a text file. eg. Input A; Testing Input B; Testing1 Input C; Testing2 Add Input A; somethingelse Input B; somethingelse1 Input C; somethingelse2 Add Each time add is pressed the text goes into memory. Then when i press finish all the text in memory is written to a text file.. I dont know how to do this without pre-defing the number of time the person inupt something.. Thanks
-
It works..... Thanks for the quick reply.
-
Im trying to write to a file but i am having problems. FileWriteLine($file, "some text") works but i want to also add a value form a GUI edit box.. FileWriteLine($file, "some text" $value from edit box) How do i go about doing that it always gives me an error. Thanks
-
Yeh thats right. I dont know where to start, do i get the software to write the printer details to memory and wait until all the printers have been added then write to the batch file or do i get the program to write to the batch file each time add printer is selected. Is there any sample code showing how to write from the gui buttons to a file? Thanks
-
Hi i was wondering if anyone could either make or point me in the right direction... Ive made a batch file that installs printers as local ports, the batch file creates a reg file which adds the ports then uses the print dll to install the printers (and a very simple yes VBS scripte to answer the unsigned driver warning box). At the moment it is long to add the printers to the batch file using notepad and want some kind of GUI which would simplifiy the process. I am useless at GUis and was wondering if someone could make a simple one, i was looking for something like this :- #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Adam & Nath\Desktop\koda_1.7.0.1\Forms\Form1.kxf $Form1 = GUICreate("Form1", 435, 150, 356, 124) $IP = GUICtrlCreateInput("ScanStations IP", 8, 8, 233, 21) $Name = GUICtrlCreateInput("Printer's Share Name", 8, 40, 233, 21) $AddIt = GUICtrlCreateButton("Add Printer", 32, 72, 355, 25, 0) $BatchIt = GUICtrlCreateButton("Create Batch File", 64, 112, 291, 25, 0) $Old = GUICtrlCreateRadio("Brother 8500", 280, 8, 145, 17) $New = GUICtrlCreateRadio("Brother 8220", 280, 32, 113, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd The batch file i want to create depending on user input is : - ECHO.^<package^>>"yes.wsf" ECHO.>>"yes.wsf" ECHO.^<job id="vbs"^>>>"yes.wsf" ECHO.>>"yes.wsf" ECHO. ^<script language="VBScript"^>>>"yes.wsf" ECHO.set WshShell = WScript.CreateObject("WScript.Shell")>>"yes.wsf" ECHO.WScript.Sleep 3000>>"yes.wsf" ECHO.WshShell.SendKeys "Y">>"yes.wsf" ECHO.^</script^>>>"yes.wsf" ECHO.^</job^>>>"yes.wsf" ECHO.^</package^>>>"yes.wsf" ECHO.Windows Registry Editor Version 5.00>"printer.reg" ECHO.>>"printer.reg" ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg" ECHO."\\\\192.168.136.88\\ICU"="">"printer.reg">>"printer.reg" ECHO.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports]>>"printer.reg" ECHO."\\\\192.168.136.90\\ER"="">"printer.reg">>"printer.reg" regedit /S printer.reg net stop spooler net start spooler start wscript yes.wsf rundll32 /s printui.dll, PrintUIEntry /if /q /b "ICU" /f "c:\8220\Adduni.inf" /r "\\192.168.136.88\ICU" /m "Brother MFC-8220" w start wscript yes.wsf rundll32 /s printui.dll, PrintUIEntry /if /q /b "ER" /f "c:\8220\Adduni.inf" /r "\\192.168.136.90\ER" /m "Brother MFC-8220" w del yes.wsf del printer.reg I know there is a much simpler way to create the same effect using Autoit, but i have no other options but to use DOS commands. Thanks (I am a complete nwb at Autot)