Delai Posted February 19, 2009 Share Posted February 19, 2009 (edited) Hi i would like to select multiple checkboxes and save them, then compare with othe sentence.Here is my script:#Include <File.au3>#Include <GUIConstants.au3>#Include <Array.au3>DIM $checked[5]$Fileopen = FileOpen(".\Files\SVCPACK.INF", 2)If $fileopen = -1 Then MsgBox(0, "Error", "Unable to open file.") ExitEndIf$FileList=_FileListToArray(@ScriptDir & "\SVCPACK") Here i read all the files from the directory and i save them If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") ExitEndIf$number = $FileList[0]msgbox(0,'',$number) GUICreate("SVCPACk WHOLE PROCESS", 800, 420) GUISetBkColor(0x00E0FFFF) $tab=GUICtrlCreateTab (5,5, 600,400);::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: $tab0=GUICtrlCreateTabitem ("Exclude To Internet") GUICtrlSetFont (-1,"12","800","", "Comic Sans MS") $Button_1 = GUICtrlCreateButton ("OK", 200, 360, 100) GUICtrlSetFont (-1,"12","800","", "Comic Sans MS") $Height_1=40 $Height_2=40 $Height_3=40 $Height_4=40 For $i=1 to $FileList[0] Select Case $i >= 1 AND $i <= 15 $FileList[$i] = GUICtrlCreateCheckBox ($FileList[$i], 15, $Height_1, 130, 20) $Height_1 += 20 Case $i >= 16 AND $i <= 30 $FileList[$i] = GUICtrlCreateCheckBox ($FileList[$i], 150, $Height_2, 130, 20) $Height_2 += 20 Case $i >= 31 AND $i <= 45 $FileList[$i] = GUICtrlCreateCheckBox ($FileList[$i], 285, $Height_3, 130, 20) $Height_3 += 20 Case $i >= 46 AND $i <= 60 MsgBox(0, "Example", "$var was greater than 30") Case $i >= 61 AND $i <= 75 MsgBox(0, "Example", "$var was greater than 40") EndSelect Next;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: $tab1=GUICtrlCreateTabitem ("Remove These Updates") $tab2=GUICtrlCreateTabitem ("Create SVCPACK.INF") GUISetState () While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $Button_1 For $i=1 to $FileList[0] IF BitAND(GUICtrlRead($FileList[$i]), $GUI_CHECKED) = $GUI_CHECKED Then $checked[$i] = $i !My first problem: Here i would like only save the position selected checkboxes in a variables which may be 2 or 3 or 4, the problem if the number of the checkbox is 30, i must add the dim of the array $Checkbox to >30 EndIfNext For $i=1 to $FileList[0] $FileRead = GUICtrlRead($FileList[$i],1) IF $FileRead == GUICtrlRead($FileList[$Checked !My other Problem],1) Then My Problem: here i read the filelist (ony by one) and i would like to compare it with the text of the only selected checkboxes which may be are 2 or 3 ElseIF $FileRead == "IE7.exe" Then FileWrite($Fileopen, $FileRead & " /quiet /update-no /nobackup /norestart" & @CRLF) ElseIf $FileRead == "KB890830.exe" Then FileWrite($Fileopen, $FileRead & " /q" & @CRLF) ElseIf $FileRead == "qchain.exe" Then FileWrite($Fileopen, $FileRead & @CRLF) Else FileWrite($Fileopen, $FileRead & " /passive /norestart /quiet" & @CRLF) EndIf Next Next EXitLoop EndSwitchWEnd GuiDelete() Edited February 19, 2009 by Delai Link to comment Share on other sites More sharing options...
martin Posted February 19, 2009 Share Posted February 19, 2009 (edited) Hi i would like to select multiple checkboxes and save them, then compare with othe sentence. Here is my script: I'm fairly confident I don't understand very much of what you've written as comments in your code about your problems, but here's a shot at helping. expandcollapse popup#Include <File.au3> #Include <GUIConstants.au3> #Include <Array.au3> DIM $checked[5] $Fileopen = FileOpen(".\Files\SVCPACK.INF", 2) If $fileopen = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $FileList=_FileListToArray(@ScriptDir & "\SVCPACK") [color="#0000ff"]Here i read all the files from the directory and i save them[/color] If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf $number = $FileList[0] msgbox(0,'',$number) GUICreate("SVCPACk WHOLE PROCESS", 800, 420) GUISetBkColor(0x00E0FFFF) $tab=GUICtrlCreateTab (5,5, 600,400) ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: $tab0=GUICtrlCreateTabitem ("Exclude To Internet") GUICtrlSetFont (-1,"12","800","", "Comic Sans MS") $Button_1 = GUICtrlCreateButton ("OK", 200, 360, 100) GUICtrlSetFont (-1,"12","800","", "Comic Sans MS") $Height_1=40 $Height_2=40 $Height_3=40 $Height_4=40 For $i=1 to $FileList[0] Select Case $i >= 1 AND $i <= 15 $FileList[$i] = GUICtrlCreateCheckBox ($FileList[$i], 15, $Height_1, 130, 20) $Height_1 += 20 Case $i >= 16 AND $i <= 30 $FileList[$i] = GUICtrlCreateCheckBox ($FileList[$i], 150, $Height_2, 130, 20) $Height_2 += 20 Case $i >= 31 AND $i <= 45 $FileList[$i] = GUICtrlCreateCheckBox ($FileList[$i], 285, $Height_3, 130, 20) $Height_3 += 20 Case $i >= 46 AND $i <= 60 MsgBox(0, "Example", "$var was greater than 30") Case $i >= 61 AND $i <= 75 MsgBox(0, "Example", "$var was greater than 40") EndSelect Next ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::: $tab1=GUICtrlCreateTabitem ("Remove These Updates") $tab2=GUICtrlCreateTabitem ("Create SVCPACK.INF") GUISetState () While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $Button_1 For $i=1 to $FileList[0] IF BitAND(GUICtrlRead($FileList[$i]), $GUI_CHECKED) = $GUI_CHECKED Then $checked[$i] = $i ![color="#ff0000"]My first problem: Here i would like only save the position selected checkboxes in a variables which may be 2 or 3 or 4, the problem if the number of the checkbox is 30, i must add the dim of the array $Checkbox to >30[/color] EndIf Next [color="#0000ff"];wouldn't it be easier to first Redim $checked[$Filelist[0] + 1] ;then say For $i=1 to $FileList[0] $checked[$i] = GUICtrlRead($FileList[$i]) EndIf Next[/color] For $i=1 to $FileList[0] $FileRead = GUICtrlRead($FileList[$i],1) IF $FileRead == GUICtrlRead($FileList[$Checked ![color="#ff0000"]My other Problem[/color]],1) Then [color="#ff0000"]My Problem: here i read the filelist (ony by one) and i would like to compare it with the text of the only selected checkboxes which may be are 2 or 3[/color] [color="#0000ff"];if you did what I suggested above then you could say if $checked[$i] = GUICtrlRead($FileList[$i]) And BitAnd($checked[$i],$GUI_CHECKED) then ;something[/color] ElseIF $FileRead == "IE7.exe" Then FileWrite($Fileopen, $FileRead & " /quiet /update-no /nobackup /norestart" & @CRLF) ElseIf $FileRead == "KB890830.exe" Then FileWrite($Fileopen, $FileRead & " /q" & @CRLF) ElseIf $FileRead == "qchain.exe" Then FileWrite($Fileopen, $FileRead & @CRLF) Else FileWrite($Fileopen, $FileRead & " /passive /norestart /quiet" & @CRLF) EndIf Next Next EXitLoop EndSwitch WEnd GuiDelete() Edited February 19, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Delai Posted February 20, 2009 Author Share Posted February 20, 2009 Thanks very much, I will try it and reply. 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