Jump to content

Checkbox needed to run other auto it scripts


vincepr0
 Share

Recommended Posts

I'm not really "pro" at scripting yet, but I am starting to learn.

I need an auto it script where when you run it, it will give a list of checkboxes that point to other auto it scripts. From there if I select 5 checkboxes, it will start by the first checkbox to run an auto it script (wait for it to finish) then run the 2nd and so forth...

I grabbed this from another forum below and have tried using this to run other .au3 script files. However, it does not do anything when I select the checkboxes.... Help?

#RequireAdmin
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; Declare arrays
Global $aRadio[24]
Global $aApps[24]

; Fill this array with the paths to your apps
$aApps[0] = "C:\Users\villarrealv\desktop\1\wylie-ccw.au3"
$aApps[1] = "C:\Users\villarrealv\desktop\1\PA-CCM.au3"
$aApps[2] = "The\Path\To\Your_App_2.exe"
$aApps[3] = "The\Path\To\Your_App_3.exe"
$aApps[4] = "The\Path\To\Your_App_4.exe"
$aApps[5] = "The\Path\To\Your_App_5.exe"
$aApps[6] = "The\Path\To\Your_App_6.exe"
$aApps[7] = "The\Path\To\Your_App_7.exe"
$aApps[8] = "The\Path\To\Your_App_8.exe"
$aApps[9] = "The\Path\To\Your_App_9.exe"
$aApps[10] = "The\Path\To\Your_App_10.exe"
$aApps[11] = "The\Path\To\Your_App_11.exe"
$aApps[12] = "The\Path\To\Your_App_12.exe"
$aApps[13] = "The\Path\To\Your_App_13.exe"
$aApps[14] = "The\Path\To\Your_App_14.exe"
$aApps[15] = "The\Path\To\Your_App_15.exe"
$aApps[16] = "The\Path\To\Your_App_16.exe"
$aApps[17] = "The\Path\To\Your_App_17.exe"
$aApps[18] = "The\Path\To\Your_App_18.exe"
$aApps[19] = "The\Path\To\Your_App_19.exe"
$aApps[20] = "The\Path\To\Your_App_20.exe"
$aApps[21] = "The\Path\To\Your_App_21.exe"
$aApps[22] = "The\Path\To\Your_App_22.exe"
$aApps[23] = "The\Path\To\Your_App_23.exe"

$hGUI = GUICreate("AutoIt Install Menu", 510, 240, 200, 200)
GUICtrlCreateLabel("Select a Program to install", 10, 10, 126, 17)

GUICtrlCreateGroup("", 20, 20, 460, 175)

For $i = 0 To 2
    For $j = 0 To 7
        ; Extract the name of the app from the path
        $sName = StringRegExpReplace($aApps[($i * 8) + $j], "^.*\\|\..*$", "")
        ; Fill the array with the ControlIDs of the checkboxes
        $aRadio[($i * 8) + $j] = GUICtrlCreateCheckbox($sName, 30 + ($i * 150), 30 + ($j * 20), 135, 17)
    Next
Next

$hButton1 = GUICtrlCreateButton("Start", 30, 200, 129, 25, 0)
$hButton2 = GUICtrlCreateButton("Select All", 180, 200, 129, 25, 0)
$hButton3 = GUICtrlCreateButton("UnSelect All", 330, 200, 129, 25, 0)

GUISetState() ; You only need this once

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton1
            ; You can loop through arrays like this - easier than using 24 similar statements
            For $i = 0 To 23
                If BitAND(GUICtrlRead($aRadio[$i]), $GUI_CHECKED) = $GUI_CHECKED Then
                    ;RunWait($aApps[$i])
                    ConsoleWrite("Running: " & $aApps[$i] & @CRLF) ; Just to show that you will run the correct app
                EndIf
            Next
            Exit
        Case $hButton2
            For $i = 0 To 23
                GUICtrlSetState($aRadio[$i], $GUI_CHECKED)
            Next
        Case $hButton3
            For $i = 0 To 23
                GUICtrlSetState($aRadio[$i], $GUI_UNCHECKED)
            Next
    EndSwitch
WEnd

 

Edited by Jos
added codebox
Link to comment
Share on other sites

  • Developers

When talking your script, selecting the first 2 checkboxes and clicking  "Start" it nicely gives:

Running: C:\Users\villarrealv\desktop\1\wylie-ccw.au3
Running: C:\Users\villarrealv\desktop\1\PA-CCM.au3

.. but of course only when running SciTE in Adminmode or taking #requireadmin out. 

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

There is not enough information to comment as you indicated they are exe's so can only imagine they will run.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Might be a silly question but, did you uncomment the line that runs the script?

;RunWait($aApps[$i])

Also, when you double click any script, what happens? does it run, or opens to edit?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

I am pretty sure this script is setup for .exe's only. These auto it scripts are .au3 files.

 

I also removed the uncomment line, but still it does absolutely nothing when I click start. Test it out on your end with a sample .au3 script file and change the path to yours. It is not working on my end.

Link to comment
Share on other sites

  • Developers

Please do me/us a favor (and yourself) and explain what you really want to run so we understand what you are trying to do.
So show some exact code that can we played with.

Jos

 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

as I recall, somebody here actually created an application store in AutoIt and said his company had used it for years. this could solve all your problems. he uploaded the code. one file.

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

OK I am going to be as simple as possible since i've caused confusion.

What I need is:

3 checkboxes

each checkbox points to another auto it .au3 script that will be ran if checked. And if you check more than one, it will wait for the 1st to finish then run the 2nd.

This is all I need. I can add more checkboxes with what someone gives me...

Link to comment
Share on other sites

*****and a "Start Button of course along with checkboxes*****

 

OK I am going to be as simple as possible since i've caused confusion.

What I need is:

3 checkboxes

each checkbox points to another auto it .au3 script that will be ran if checked. And if you check more than one, it will wait for the 1st to finish then run the 2nd.

This is all I need. I can add more checkboxes with what someone gives me...

 

*****and a "Start Button of course along with checkboxes*****

Link to comment
Share on other sites

  • Developers

I understood as much in your first post, but you still haven't shown us any code that isn't working.
Guess I am repeating myself  here, but it's my last try.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

4 hours ago, vincepr0 said:

I'm not really "pro" at scripting yet, but I am starting to learn.

I need an auto it script where when you run it, it will give a list of checkboxes that point to other auto it scripts. From there if I select 5 checkboxes, it will start by the first checkbox to run an auto it script (wait for it to finish) then run the 2nd and so forth...

I grabbed this from another forum below and have tried using this to run other .au3 script files. However, it does not do anything when I select the checkboxes.... Help?

#RequireAdmin
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; Declare arrays
Global $aRadio[24]
Global $aApps[24]

; Fill this array with the paths to your apps
$aApps[0] = "C:\Users\villarrealv\desktop\1\wylie-ccw.au3"
$aApps[1] = "C:\Users\villarrealv\desktop\1\PA-CCM.au3"
$aApps[2] = "The\Path\To\Your_App_2.exe"
$aApps[3] = "The\Path\To\Your_App_3.exe"
$aApps[4] = "The\Path\To\Your_App_4.exe"
$aApps[5] = "The\Path\To\Your_App_5.exe"
$aApps[6] = "The\Path\To\Your_App_6.exe"
$aApps[7] = "The\Path\To\Your_App_7.exe"
$aApps[8] = "The\Path\To\Your_App_8.exe"
$aApps[9] = "The\Path\To\Your_App_9.exe"
$aApps[10] = "The\Path\To\Your_App_10.exe"
$aApps[11] = "The\Path\To\Your_App_11.exe"
$aApps[12] = "The\Path\To\Your_App_12.exe"
$aApps[13] = "The\Path\To\Your_App_13.exe"
$aApps[14] = "The\Path\To\Your_App_14.exe"
$aApps[15] = "The\Path\To\Your_App_15.exe"
$aApps[16] = "The\Path\To\Your_App_16.exe"
$aApps[17] = "The\Path\To\Your_App_17.exe"
$aApps[18] = "The\Path\To\Your_App_18.exe"
$aApps[19] = "The\Path\To\Your_App_19.exe"
$aApps[20] = "The\Path\To\Your_App_20.exe"
$aApps[21] = "The\Path\To\Your_App_21.exe"
$aApps[22] = "The\Path\To\Your_App_22.exe"
$aApps[23] = "The\Path\To\Your_App_23.exe"

$hGUI = GUICreate("AutoIt Install Menu", 510, 240, 200, 200)
GUICtrlCreateLabel("Select a Program to install", 10, 10, 126, 17)

GUICtrlCreateGroup("", 20, 20, 460, 175)

For $i = 0 To 2
    For $j = 0 To 7
        ; Extract the name of the app from the path
        $sName = StringRegExpReplace($aApps[($i * 8) + $j], "^.*\\|\..*$", "")
        ; Fill the array with the ControlIDs of the checkboxes
        $aRadio[($i * 8) + $j] = GUICtrlCreateCheckbox($sName, 30 + ($i * 150), 30 + ($j * 20), 135, 17)
    Next
Next

$hButton1 = GUICtrlCreateButton("Start", 30, 200, 129, 25, 0)
$hButton2 = GUICtrlCreateButton("Select All", 180, 200, 129, 25, 0)
$hButton3 = GUICtrlCreateButton("UnSelect All", 330, 200, 129, 25, 0)

GUISetState() ; You only need this once

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton1
            ; You can loop through arrays like this - easier than using 24 similar statements
            For $i = 0 To 23
                If BitAND(GUICtrlRead($aRadio[$i]), $GUI_CHECKED) = $GUI_CHECKED Then
                    ;RunWait($aApps[$i])
                    ConsoleWrite("Running: " & $aApps[$i] & @CRLF) ; Just to show that you will run the correct app
                EndIf
            Next
            Exit
        Case $hButton2
            For $i = 0 To 23
                GUICtrlSetState($aRadio[$i], $GUI_CHECKED)
            Next
        Case $hButton3
            For $i = 0 To 23
                GUICtrlSetState($aRadio[$i], $GUI_UNCHECKED)
            Next
    EndSwitch
WEnd

Jos this was from my very first post. As I stated before, this does not do anything at all. It does bring up all the checkboxes, but when I check the first one which points to wylie-ccw.au3, it does not run it as it should.

 

Link to comment
Share on other sites

  • Developers

So why do you think it should run? an AU3 file in not an executable so it needs another executable file, autoit3.exe, to be executed.
When using CMD.exe and the default for .au3 is set to open with autoit3.exe, it might run properly.

so either use ShellExecuteWait() or change the array to:

$aApps[0] = @comspec & " /c C:\Users\villarrealv\desktop\1\wylie-ccw.au3"

-or for using RunWait() to:

$aApps[0] = '"C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\Users\villarrealv\desktop\1\wylie-ccw.au3"'

Jos 

 

Edited by Jos
Typo

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...