Jump to content

to add checkboxes for each apps - (Moved)


Recommended Posts

hi there

First of all. let me say, i am new to autoit and have to finish a project in autoit for installing and uninstall softwares. Here, the issue is, i have a code that displays the currently installed softwares in a system and i could not add any checkboxes for selecting the apps. Could somebody help in doing this??

newOne.au3

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

You could use or at least have a look at the Volatran project :)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Here is some sample to auto-create and cascade checkboxes as well as recognizing what is checked.

It's all about the 2D array that you will need to generate.

 

;generate a cascade of checkboxes

Opt("GUIOnEventMode", 1)            ;Use Event mode to call functions directly
#include <GUIConstantsEx.au3>


;This array will need to be generated by your code
;[][0] is reserved for the handle auto-generated in the loop that creates the checkboxes
;[][1] is the text you want displayed in the GUI
;[][2]+ These can be anything else you want/need.  Path, Install commands, whatever else you need
Global $aApplications[][] = [[0, "Application Name 1", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 2", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 3", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 4", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 5", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 6", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 7", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 8", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 9", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 10", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 11", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 12", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 13", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 14", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 15", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 16", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 17", "Application Install/Uninstall Path or whatever else you need to remember"], _
    [0, "Application Name 18", "Application Install/Uninstall Path or whatever else you need to remember"]]

$iGuiW = 920
$iGuiH = 680
$hGUI = GUICreate(">SAMPLE<", $iGuiW, $iGuiH)
GUISetOnEvent($GUI_EVENT_CLOSE, "_ExitApp")


$iChkX = 40
$iChkY = 175
For $a = 0 to UBound($aApplications) - 1
    $iChkY += 25

    ;Every 15 checkboxes move over to the next column
    If $a > 0 and Mod($a, 15) = 0 Then
        $iChkX += 220   ;Move over to the next column
        $iChkY = 200        ;Reset the Y back to the top of the list
    EndIf

    $aApplications[$a][0] = GUICtrlCreateCheckbox($aApplications[$a][1], $iChkX, $iChkY, 200, 20)

;This is used to set the font to RED if there is a problem, like you found an app but [][2] is empty so you cant uninstall it!
    ;DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)
    ;GUICtrlSetColor($aFunctionsAppSupt[$a][0], $COLOR_RED)

Next

GUICtrlCreateButton("Start", 40, $iGuiH - 40, 120, 20)
GUICtrlSetOnEvent(-1, "_Start")


GUISetState(@SW_SHOW, $hGUI)

While 1                                                                                                 ;Loop waiting for the user to click something.
    sleep(100)
WEnd


Func _Start()
    $sChecked = ""

    ;Scan each of the checkboxes to see if they are checked or not
    For $t = 0 to UBound($aApplications) - 1

        if BitAND(GUICtrlRead($aApplications[$t][0]), $GUI_CHECKED) = $GUI_CHECKED Then

            $sChecked &= $aApplications[$t][1] & @CRLF

        EndIf
    Next

    MsgBox(0, "Checked", $sChecked)

EndFunc


Func _ExitApp()
    Exit
EndFunc

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...