anandnz Posted February 18, 2011 Posted February 18, 2011 (edited) Hi I am encouraged to make this script little user friendly. Instead of users each time going to program and choose TRUE or False .. a GUI with a radio buttons would really help. Is it a big effort to create a GUI with display of items $avScripts[0] should be in the GUI followed by a radio button to select, which does same action as $avScripts[$cnt][3] true or false. How to say, for all the items selected with a radio button ?? Note: If the array inceases to 70, i presume it will i might change to drop down with double click selection. Commands to do this any references will be greatly appreciated. #include <File.au3> #include <Array.au3> #include <Timers.au3> Global $avScripts[10][4] = _ [["a", $sScripsPath & "b.bat", 50000, True], _ ; Are you sure you want $iBreak_Time to be 50 seconds? ["b", $sScripsPath & "b.bat", 500000, True], _ ; Are you sure you want $iBreak_Time to be over 8 minutes? ["c", $sScripsPath & "c", 500000, True], _ ; Doesn't this program have an extention? ["d", $sScripsPath & "d.bat", 50000, True], _ ["e", $sScripsPath & "e.bat", 50000, True], _ ["f", $sScripsPath & "f.bat", 50000, True], _ ["g", $sScripsPath & "g.bat", 50000, True], _ ["h", $sScripsPath & "h.bat", 50000, True], _ ["i", $sScripsPath & "i.bat", 50000, True], _ ["j", $sScripsPath & "j.bat", 50000, True]] sorry, i just realized i should have posted this in GUI section .. i am not sure how to delete this post. Thanks in advance --Anand Edited February 18, 2011 by anandnz
Xenobiologist Posted February 18, 2011 Posted February 18, 2011 I don't understand. Do you try to set default value or create those RadioButtons in a loop? Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
anandnz Posted February 19, 2011 Author Posted February 19, 2011 I don't understand. Do you try to set default value or create those RadioButtons in a loop?Thank you Xenobiologist, The intention is to give use the executable with options to choose, Sorry i hink i meant check box not radio buttons will replace the hard coded "True" or "False". so instead of checking for element with True in loop, i would check if the check box is selected. and rest is same logic.. Any help is appreciated.Cheers-- Anand
BrewManNH Posted February 19, 2011 Posted February 19, 2011 Just remember, you can't use a True/False comparison on whether a checkbox is checked or not. An unchecked checkbox gives you a value of 4, whereas the checked one will give you a value of 1. So if you used a true/false comparison it will always show as true. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator
Varian Posted February 19, 2011 Posted February 19, 2011 (edited) This should get you started. I used check boxes since only 1 radio per group can be checked. expandcollapse popup#include-once #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Array.au3> #include <Timers.au3> Local $sScripsPath = @DesktopDir & '\' Global $AvScripts[10][4] = _ [["a", $sScripsPath & "b.bat", 50000, ''], _ ; Are you sure you want $iBreak_Time to be 50 seconds? ["b", $sScripsPath & "b.bat", 500000, ''], _ ; Are you sure you want $iBreak_Time to be over 8 minutes? ["c", $sScripsPath & "c", 500000, ''], _ ; Doesn't this program have an extention? ["d", $sScripsPath & "d.bat", 50000, ''], _ ["e", $sScripsPath & "e.bat", 50000, ''], _ ["f", $sScripsPath & "f.bat", 50000, ''], _ ["g", $sScripsPath & "g.bat", 50000, ''], _ ["h", $sScripsPath & "h.bat", 50000, ''], _ ["i", $sScripsPath & "i.bat", 50000, ''], _ ["j", $sScripsPath & "j.bat", 50000, '']] #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 625, 443, 192, 124) Local $Checkbox[10] Local $y = 30 For $i = 0 To UBound($Checkbox) - 1 $Checkbox[$i] = GUICtrlCreateCheckbox("Checkbox" & $i, 40, $y, 97, 17) $y += 30 Next $Button1 = GUICtrlCreateButton("Button1", 216, 304, 147, 57, $WS_GROUP) $Group1 = GUICtrlCreateGroup("Group1", 32, 8, 137, 315) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 For $i = 0 To UBound($Checkbox) - 1 If GUICtrlRead($Checkbox[$i]) = $GUI_CHECKED Then $AvScripts[$i][3] = True Else $AvScripts[$i][3] = False EndIf Next $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _ArrayDisplay($AvScripts, "Current State") ;change this to launch your function EndSwitch WEnd Edited February 19, 2011 by Varian
anandnz Posted February 19, 2011 Author Posted February 19, 2011 This should get you started. I used check boxes since only 1 radio per group can be checked. Thank a ton Varian, yes i just changed to display "a", "b" etc instead of check box and that seems exactly what i want to do. Thank you very much. Thank you BrewManNh for the tip. I am starter here and without help of varian and others, i could not have done anything. I will remember your tip, this will be my first GUI in many years. So i have some to rush to office tomorrow.. By the way, any tips, references to relate the coordinates of used in GUI to the screen size and color of the scree. $Form1 = GUICreate("Form1", [b]625, 443, 192, 124[/b]) $Button1 = GUICtrlCreateButton("Button1", [b]216, 304, 147, 57[/b], $WS_GROUP) $Group1 = GUICtrlCreateGroup("Group1", [b]32, 8, 137, 315[/b]) GUICtrlCreateGroup("", [b]-99, -99[/b], 1, 1) Thanks a ton Regards --Anand
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