Jump to content

Stuck with a Main Menu automation launch menu (select all/deselect all)


Zim
 Share

Recommended Posts

First of all, I wanted to thank everyone for being helpful the last time I had some questions. I love Autoit!!

Now here's where I am stuck. Below is the script that I am using to launch a main menu that will sort of automate a certain portion of reporting for the company I work for. I have been through tons of examples and used a lot of pieces that I found useful. However, the following functionality does not work right now.

Select All

Deselect All

Run

Open

Select All will select all checkboxes in the GUI. This is the one I have been banging my head on for quite some time. I originally tried this in an array and almost every example out here uses an array, but I couldn't get it to work right in the tabs, they would overlap, so I couldn't create my checkboxes in an array. Now I am trying to figure out how to select everything when Select All is checked, everything I have tried so far does not give me the desired output.

Deselect All, I guess if I can figure Select All out, I can probably do this one as well.

(I also need to figure out how you can only pick one or the other. Right now, you can pick both).

Run, run has to launch everything checked, since they are not in an array, i'm not sure how I would do that either. Again, all examples lead to array's.

Open will open certain spreadsheets created in the past. I can take care of what to open and how to figure that out, but I am not sure how it can go about opening what's checked.

I'm sure I could have made the code much more complicated, but I have to have this code formatted in an easy format for others to read/fix if they have to add/remove/update items in the script, so that part was delibrate.

Any help would certainly be appreciated, again, thank you all for your time.

;Code for Main Menu

#include <Date.au3>
#include <GuiConstants.au3>
#include <Misc.au3>

; GUI
$hwnd = GUICreate("Main Menu", 400, 400)
GUISetIcon(@WindowsDir & "\notepad.exe", 0)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000);fade-in

; TEXT
GUICtrlCreateLabel("Date: " & @MON & "-" & @MDAY & "-" & @YEAR & " " & @CRLF & "", 20, 260)
GuiCtrlCreateLabel("Time: "  & @HOUR &  ":" & @MIN & ":" & @SEC, 20, 280)
GUICtrlCreateLabel("User ID: " & @UserName & "" & @CRLF & " " &@CRLF  & " ", 20, 300)

; BUTTONS
$openrpts = GUICtrlCreateButton (" Open ",280, 260, 100)
$runrpts = GUICtrlCreateButton (" Run ",280, 290, 100)
$exititem2 = GUICtrlCreateButton(" Exit ",280, 320, 100) 

; MENU
$filemenu = GUICtrlCreateMenu("File")
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)
$selectall = GUICtrlCreateCheckbox ("Select All", 20, 200)
$deselectall = GUICtrlCreateCheckbox ("Deselect All", 20, 220)

; PROGRESS BAR
ProgressOn("Progress Meter", "Increments every second", "0 percent")
For $i = 1 To 100 Step 10
    ProgressSet($i, $i & " percent")
Next
ProgressSet(100, "Done", "Complete")
Sleep(500)
ProgressOff()

; TAB
GUICtrlCreateTab(1, 0, 400, 190)

GUICtrlCreateTabItem("MKT")
$checkmktll = GUICtrlCreateCheckbox ("checkmktll", 20, 40)
$checkmktw = GUICtrlCreateCheckbox ("checkmktw", 20, 60)
$checkmktq = GUICtrlCreateCheckbox ("checkmktq", 20, 80)
$checkmktaux = GUICtrlCreateCheckbox ("checkmktaux", 20, 100)
$checkmktvdn = GUICtrlCreateCheckbox ("checkmktvdn ", 20, 120)
$checkmktasm = GUICtrlCreateCheckbox ("checkmktasm", 20, 140)

GUICtrlCreateTabItem("OPS")
$checkoprll = GUICtrlCreateCheckbox ("checkoprll", 20, 40)
$checkoprw = GUICtrlCreateCheckbox ("checkoprw", 20, 60 )
$checkoprfm = GUICtrlCreateCheckbox ("checkoprfm", 20, 80 )
$checkoprap = GUICtrlCreateCheckbox ("checkoprap", 20, 100 )

GUICtrlCreateTabItem("FSG")
$checkrswr = GUICtrlCreateCheckbox ("checkrswr", 20, 40)
$checkrsint = GUICtrlCreateCheckbox ("checkrsint", 20, 60)

GUICtrlCreateTabItem("BEN")
$checkrbenw = GUICtrlCreateCheckbox ("checkrbenw", 20, 40)

GUICtrlCreateTabItem("IC")
$checkricsll = GUICtrlCreateCheckbox ("checkricsll", 20, 40)
$checkicswr = GUICtrlCreateCheckbox ("checkicswr", 20, 60)

GUICtrlCreateTabItem("GK")
$checkrgtkr = GUICtrlCreateCheckbox ("checkrgtkr", 20, 40)

GUICtrlCreateTabItem("VRU")
$checkvrur = GUICtrlCreateCheckbox ("checkvrur", 20, 40)

GUISetState()

Func GetCheckboxes()
IF Guictrlread($checkmktll[0]) = $GUI_CHECKED then call ("MKT_LL")
IF GUICtrlread($checkmktw[1]) = $GUI_CHECKED then call ("MKT_WR")
IF GUICtrlread($checkmktq[2]) = $GUI_CHECKED then call ("MKT_IQR")
IF GUICtrlread($checkmktaux[3]) = $GUI_CHECKED then call ("MKT_AUX")    
IF GUICtrlread($checkmktvdn[4]) = $GUI_CHECKED then call ("MKT_VDN")    
IF GUICtrlread($checkmktasm[5]) = $GUI_CHECKED then call ("MKT_ASM")    
IF GUICtrlread($checkoprll[6]) = $GUI_CHECKED then call ("OPS_LL")    
IF GUICtrlread($checkoprw[7]) = $GUI_CHECKED then call ("OPS_WR")    
IF GUICtrlread($checkoprfm [8]) = $GUI_CHECKED then call ("OPS_FM ")    
IF GUICtrlread($checkoprap[9]) = $GUI_CHECKED then call ("OPS_ADM")    
IF GUICtrlread($checkrswr[10]) = $GUI_CHECKED then call ("FSG_WR")
IF GUICtrlread($checkrsint[11]) = $GUI_CHECKED then call ("FSG_IR")
IF GUICtrlread($checkbenwr[12]) = $GUI_CHECKED then call ("BEN_WR")
IF GUICtrlread($checkricsll[13]) = $GUI_CHECKED then call ("ICS_LL")
IF GUICtrlread($checkicswr[14]) = $GUI_CHECKED then call ("ICS_WR")
IF GUICtrlread($checkrgtkr[15]) = $GUI_CHECKED then call ("GTK_RPT")
IF GUICtrlread($checkvrur[16]) = $GUI_CHECKED then call ("VRU_REF")

Call ("exititem3")

EndFunc

;Add Automation Scripts here
Func MKT_LL()
    
EndFunc

Func MKT_WR()
    
EndFunc

Func MKT_IQR()

EndFunc

Func MKT_AUX()
    
EndFunc

Func MKT_VDN()

EndFunc

Func MKT_ASM()

EndFunc

Func OPS_LL()

EndFunc

Func OPS_WR()

EndFunc

Func OPS_FM()

EndFunc

Func OPS_ADM()
    
EndFunc

Func FSG_WR()

EndFunc

Func FSG_IR()

EndFunc

Func BEN_WR()

EndFunc

Func ICS_LL()

EndFunc

Func ICS_WR()

EndFunc

Func GTK_RPT()

EndFunc

Func VRU_REF()
EndFunc


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $exititem
            ExitLoop
        Case $msg = $exititem2
            ExitLoop
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop    
         Exit
    EndSelect
WEnd
Edited by big_daddy
Link to comment
Share on other sites

First of all, I wanted to thank everyone for being helpful the last time I had some questions. I love Autoit!!

Now here's where I am stuck. Below is the script that I am using to launch a main menu that will sort of automate a certain portion of reporting for the company I work for. I have been through tons of examples and used a lot of pieces that I found useful. However, the following functionality does not work right now.

Select All

Deselect All

Run

Open

Select All will select all checkboxes in the GUI. This is the one I have been banging my head on for quite some time. I originally tried this in an array and almost every example out here uses an array, but I couldn't get it to work right in the tabs, they would overlap, so I couldn't create my checkboxes in an array. Now I am trying to figure out how to select everything when Select All is checked, everything I have tried so far does not give me the desired output.

Deselect All, I guess if I can figure Select All out, I can probably do this one as well.

(I also need to figure out how you can only pick one or the other. Right now, you can pick both).

First of all, just a note - if you enclose your code in the "["Code"]" and "["/Code"]" tags (without the quotes), it will make the page a little more readable when you post a script (that way you don't end up with a page that scrolls painfully long for a single post.

Here's a quick edit to give you a starting point for your Select All / Deselect All issues. The code right now is set only for the MKT tab, but you'd want to edit it to have the Select/Deselect only target the active tab in your final code.

#include <Date.au3>
#include <GuiConstants.au3>
#include <Misc.au3>

; GUI
$hwnd = GUICreate("Main Menu", 400, 400)
GUISetIcon(@WindowsDir & "\notepad.exe", 0)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000);fade-in

; TEXT
GUICtrlCreateLabel("Date: " & @MON & "-" & @MDAY & "-" & @YEAR & " " & @CRLF & "", 20, 260)
GUICtrlCreateLabel("Time: " & @HOUR & ":" & @MIN & ":" & @SEC, 20, 280)
GUICtrlCreateLabel("User ID: " & @UserName & "" & @CRLF & " " & @CRLF & " ", 20, 300)

; BUTTONS
$openrpts = GUICtrlCreateButton(" Open ", 280, 260, 100)
$runrpts = GUICtrlCreateButton(" Run ", 280, 290, 100)
$exititem2 = GUICtrlCreateButton(" Exit ", 280, 320, 100)

; MENU
$filemenu = GUICtrlCreateMenu("File")
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
GUICtrlCreateGroup("", 10, 190, 120, 55)
$selectall = GUICtrlCreateRadio("Select All", 20, 200, 100)
$deselectall = GUICtrlCreateRadio("Deselect All", 20, 220, 100)
GUICtrlCreateGroup("", -99, -99, 1, 1)
; PROGRESS BAR
ProgressOn("Progress Meter", "Increments every second", "0 percent")
For $i = 1 To 100 Step 10
    ProgressSet($i, $i & " percent")
Next
ProgressSet(100, "Done", "Complete")
Sleep(500)
ProgressOff()

; TAB
GUICtrlCreateTab(1, 0, 400, 190)

$mktTab = GUICtrlCreateTabItem("MKT")
$mktcheckboxesstart = GUICtrlCreateDummy()
$checkmktll = GUICtrlCreateCheckbox("checkmktll", 20, 40)
$checkmktw = GUICtrlCreateCheckbox("checkmktw", 20, 60)
$checkmktq = GUICtrlCreateCheckbox("checkmktq", 20, 80)
$checkmktaux = GUICtrlCreateCheckbox("checkmktaux", 20, 100)
$checkmktvdn = GUICtrlCreateCheckbox("checkmktvdn ", 20, 120)
$checkmktasm = GUICtrlCreateCheckbox("checkmktasm", 20, 140)
$mktcheckboxesend = GUICtrlCreateDummy()

$optTab = GUICtrlCreateTabItem("OPS")
$opscheckboxesstart = GUICtrlCreateDummy()
$checkoprll = GUICtrlCreateCheckbox("checkoprll", 20, 40)
$checkoprw = GUICtrlCreateCheckbox("checkoprw", 20, 60)
$checkoprfm = GUICtrlCreateCheckbox("checkoprfm", 20, 80)
$checkoprap = GUICtrlCreateCheckbox("checkoprap", 20, 100)
$opscheckboxesend = GUICtrlCreateDummy()

$fsgTab = GUICtrlCreateTabItem("FSG")
$fsgcheckboxesstart = GUICtrlCreateDummy()
$checkrswr = GUICtrlCreateCheckbox("checkrswr", 20, 40)
$checkrsint = GUICtrlCreateCheckbox("checkrsint", 20, 60)
$fsgcheckboxesend = GUICtrlCreateDummy()

$benTab = GUICtrlCreateTabItem("BEN")
$bencheckboxesstart = GUICtrlCreateDummy()
$checkrbenw = GUICtrlCreateCheckbox("checkrbenw", 20, 40)
$bencheckboxesstart = GUICtrlCreateDummy()

$icTab = GUICtrlCreateTabItem("IC")
$iccheckboxesstart = GUICtrlCreateDummy()
$checkricsll = GUICtrlCreateCheckbox("checkricsll", 20, 40)
$checkicswr = GUICtrlCreateCheckbox("checkicswr", 20, 60)
$iccheckboxesend = GUICtrlCreateDummy()

$gkTab = GUICtrlCreateTabItem("GK")
$gkcheckboxesstart = GUICtrlCreateDummy()
$checkrgtkr = GUICtrlCreateCheckbox("checkrgtkr", 20, 40)
$gkcheckboxesend = GUICtrlCreateDummy()

$vruTab = GUICtrlCreateTabItem("VRU")
$vrucheckboxesstart = GUICtrlCreateDummy()
$checkvrur = GUICtrlCreateCheckbox("checkvrur", 20, 40)
$vrucheckboxesend = GUICtrlCreateDummy()

Dim $checkboxesstart = $mktcheckboxesstart
Dim $checkboxesend = $mktcheckboxesend

GUISetState()

Func GetCheckboxes()
    If GUICtrlRead($checkmktll[0]) = $GUI_CHECKED Then Call("MKT_LL")
    If GUICtrlRead($checkmktw[1]) = $GUI_CHECKED Then Call("MKT_WR")
    If GUICtrlRead($checkmktq[2]) = $GUI_CHECKED Then Call("MKT_IQR")
    If GUICtrlRead($checkmktaux[3]) = $GUI_CHECKED Then Call("MKT_AUX")
    If GUICtrlRead($checkmktvdn[4]) = $GUI_CHECKED Then Call("MKT_VDN")
    If GUICtrlRead($checkmktasm[5]) = $GUI_CHECKED Then Call("MKT_ASM")
    If GUICtrlRead($checkoprll[6]) = $GUI_CHECKED Then Call("OPS_LL")
    If GUICtrlRead($checkoprw[7]) = $GUI_CHECKED Then Call("OPS_WR")
    If GUICtrlRead($checkoprfm [8]) = $GUI_CHECKED Then Call("OPS_FM")
    If GUICtrlRead($checkoprap[9]) = $GUI_CHECKED Then Call("OPS_ADM")
    If GUICtrlRead($checkrswr[10]) = $GUI_CHECKED Then Call("FSG_WR")
    If GUICtrlRead($checkrsint[11]) = $GUI_CHECKED Then Call("FSG_IR")
    If GUICtrlRead($checkrbenw[12]) = $GUI_CHECKED Then Call("BEN_WR")
    If GUICtrlRead($checkricsll[13]) = $GUI_CHECKED Then Call("ICS_LL")
    If GUICtrlRead($checkicswr[14]) = $GUI_CHECKED Then Call("ICS_WR")
    If GUICtrlRead($checkrgtkr[15]) = $GUI_CHECKED Then Call("GTK_RPT")
    If GUICtrlRead($checkvrur[16]) = $GUI_CHECKED Then Call("VRU_REF")
    Call("exititem3")

EndFunc   ;==>GetCheckboxes

;Add Automation Scripts here
Func exititem3()
EndFunc   ;==>exititem3

Func MKT_LL()

EndFunc   ;==>MKT_LL

Func MKT_WR()

EndFunc   ;==>MKT_WR

Func MKT_IQR()

EndFunc   ;==>MKT_IQR

Func MKT_AUX()

EndFunc   ;==>MKT_AUX

Func MKT_VDN()

EndFunc   ;==>MKT_VDN

Func MKT_ASM()

EndFunc   ;==>MKT_ASM

Func OPS_LL()

EndFunc   ;==>OPS_LL

Func OPS_WR()

EndFunc   ;==>OPS_WR

Func OPS_FM()

EndFunc   ;==>OPS_FM

Func OPS_ADM()

EndFunc   ;==>OPS_ADM

Func FSG_WR()

EndFunc   ;==>FSG_WR

Func FSG_IR()

EndFunc   ;==>FSG_IR

Func BEN_WR()

EndFunc   ;==>BEN_WR

Func ICS_LL()

EndFunc   ;==>ICS_LL

Func ICS_WR()

EndFunc   ;==>ICS_WR

Func GTK_RPT()

EndFunc   ;==>GTK_RPT

Func VRU_REF()
EndFunc   ;==>VRU_REF

Func CheckThem()
    For $iCtrl = $checkboxesstart To $checkboxesend
        GUICtrlSetState($iCtrl, $GUI_CHECKED)
    Next
EndFunc   ;==>CheckThem

Func UncheckThem()
    For $iCtrl = $checkboxesstart To $checkboxesend
        GUICtrlSetState($iCtrl, $GUI_UNCHECKED)
    Next

EndFunc   ;==>UncheckThem


While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $exititem
            ExitLoop
        Case $msg = $exititem2
            ExitLoop
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            Exit
        Case $msg = $selectall
            CheckThem()
            ;function pass to check all boxes on active tab
            
        Case $msg = $deselectall
            ;function pass to uncheck all boxes on active tab
            UncheckThem()
            GUICtrlSetState($deselectall, $GUI_UNCHECKED)
    EndSelect
WEnd
Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Ok, i have looked and tried but I keep getting the following error when I try to run it now.

Line (253) : ==> Error parsing function call.

All I am trying to do, is make the Run button count which checkboxes are checked and launch them. I know it's something small, but I can't find anything even when I search for that type of error. Please let me know if you have any recommendations.

#include <Date.au3>
#include <GuiConstants.au3>
#include <Misc.au3>

; GUI
$hwnd = GUICreate("Main Menu", 400, 400)
GUISetIcon(@WindowsDir & "\system32\osk.exe", 0)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000);fade-in

; TEXT
GUICtrlCreateLabel("Date: " & @MON & "-" & @MDAY & "-" & @YEAR & " " & @CRLF & "", 20, 260)
GuiCtrlCreateLabel("Time: "  & @HOUR &  ":" & @MIN & ":" & @SEC, 20, 280)
GUICtrlCreateLabel("UserID: " & @UserName & "" & @CRLF & " " &@CRLF  & " ", 20, 300)

; BUTTONS
$openrpts = GUICtrlCreateButton (" Open Reports ",280, 260, 100)
$runrpts = GUICtrlCreateButton (" Run ",280, 290, 100)
$exititem2 = GUICtrlCreateButton(" Exit ",280, 320, 100);This causes the application to exit

; MENU
$filemenu = GUICtrlCreateMenu("File")
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)
$helpmenu = GUICtrlCreateMenu("Help")
$aboutitem = GUICtrlCreateMenuitem("About", $helpmenu)
GUICtrlCreateGroup("", 10, 190, 120, 55)
$selectall = GUICtrlCreateRadio("Select All", 20, 200, 100)
$deselectall = GUICtrlCreateRadio("Deselect All", 20, 220, 100)
GUICtrlCreateGroup("", -99, -99, 1, 1)

; PROGRESS BAR
ProgressOn("Progress Meter", "Increments every second", "0 percent")
For $i = 1 To 100 Step 10
    ProgressSet($i, $i & " percent")
Next
ProgressSet(100, "Done", "Complete")
Sleep(500)
ProgressOff()

; TAB
GUICtrlCreateTab(1, 0, 400, 190)

GUICtrlCreateTabItem("Marketing")
$mktcheckboxesstart = GUICtrlCreateDummy()
$checkmktll = GUICtrlCreateCheckbox ("Marketing Login/Logout Report", 20, 40)
$checkmktw = GUICtrlCreateCheckbox ("Marketing Weekly Report", 20, 60)
$checkmktq = GUICtrlCreateCheckbox ("Marketing Interval Queue Report", 20, 80)
$checkmktaux = GUICtrlCreateCheckbox ("Marketing AUX Report", 20, 100)
$checkmktvdn = GUICtrlCreateCheckbox ("Marketing VDN Grouping Report", 20, 120)
$checkmktasm = GUICtrlCreateCheckbox ("Marketing ASM Weekly Report", 20, 140)

GUICtrlCreateTabItem("Operations")
$checkoprll = GUICtrlCreateCheckbox ("Operations Login/Logout Report", 20, 40)
$checkoprw = GUICtrlCreateCheckbox ("Operations Weekly Report", 20, 60 )
$checkoprfm = GUICtrlCreateCheckbox ("Operations FM Scorecard Report", 20, 80 )
$checkoprap = GUICtrlCreateCheckbox ("Operations Admin Performance Report", 20, 100 )

GUICtrlCreateTabItem("Road Service")
$checkrswr = GUICtrlCreateCheckbox ("Road Service Weekly (Friday) Report", 20, 40)
$checkrsint = GUICtrlCreateCheckbox ("Road Service Interval Report", 20, 60)

GUICtrlCreateTabItem("Benefits")
$checkrbenw = GUICtrlCreateCheckbox ("Benefits Weekly Report", 20, 40)

GUICtrlCreateTabItem("ICS")
$checkricsll = GUICtrlCreateCheckbox ("ICS Login/Logout Report", 20, 40)
$checkicswr = GUICtrlCreateCheckbox ("ICS Weekly Report", 20, 60)

GUICtrlCreateTabItem("Gatekeeper")
$checkrgtkr = GUICtrlCreateCheckbox ("Gatekeeper Report", 20, 40)

GUICtrlCreateTabItem("VRU")
$checkvrur = GUICtrlCreateCheckbox ("Driver VRU Refresh", 20, 40)
$vrucheckboxessend = GUICtrlCreateDummy()

GUISetState()

Func GetCheckboxes()
IF Guictrlread($checkmktll[0]) = $GUI_CHECKED then call ("MKT_LL")
IF GUICtrlread($checkmktw[1]) = $GUI_CHECKED then call ("MKT_WR")
IF GUICtrlread($checkmktq[2]) = $GUI_CHECKED then call ("MKT_IQR")
IF GUICtrlread($checkmktaux[3]) = $GUI_CHECKED then call ("MKT_AUX")    
IF GUICtrlread($checkmktvdn[4]) = $GUI_CHECKED then call ("MKT_VDN")    
IF GUICtrlread($checkmktasm[5]) = $GUI_CHECKED then call ("MKT_ASM")    
IF GUICtrlread($checkoprll[6]) = $GUI_CHECKED then call ("OPS_LL")  
IF GUICtrlread($checkoprw[7]) = $GUI_CHECKED then call ("OPS_WR")   
IF GUICtrlread($checkoprfm [8]) = $GUI_CHECKED then call ("OPS_FM ")    
IF GUICtrlread($checkoprap[9]) = $GUI_CHECKED then call ("OPS_ADM") 
IF GUICtrlread($checkrswr[10]) = $GUI_CHECKED then call ("FSG_WR")
IF GUICtrlread($checkrsint[11]) = $GUI_CHECKED then call ("FSG_IR")
IF GUICtrlread($checkbenwr[12]) = $GUI_CHECKED then call ("BEN_WR")
IF GUICtrlread($checkricsll[13]) = $GUI_CHECKED then call ("ICS_LL")
IF GUICtrlread($checkicswr[14]) = $GUI_CHECKED then call ("ICS_WR")
IF GUICtrlread($checkrgtkr[15]) = $GUI_CHECKED then call ("GTK_RPT")
IF GUICtrlread($checkvrur[16]) = $GUI_CHECKED then call ("VRU_REF")

Call $exititem

EndFunc;==>GetCheckboxes

Dim $checkboxesstart = $mktcheckboxesstart
Dim $checkboxessend = $vrucheckboxessend

Func CheckThemAll()
    For $iCtrl = $checkboxesstart To $checkboxessend
        GUICtrlSetState($iCtrl, $GUI_CHECKED)
    Next
EndFunc  ;==>CheckThemAll

Func UncheckThemAll()
    For $iCtrl = $checkboxesstart To $checkboxessend
        GUICtrlSetState($iCtrl, $GUI_UNCHECKED)
    Next
EndFunc  ;==>UncheckThemAll



;Add Automation Scripts here
Func MKT_LL();Marketing Login/Logout Report
    MsgBox(0, "AcrobatReader get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\AdobeReader\AdbeRdr708.exe /S /v/qn","",@SW_SHOWDEFAULT)
    ProcessWaitClose("Adberdr708.exe")
EndFunc

Func MKT_WR();Marketing Weekly Report
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc


Func MKT_IQR();Marketing Interval Queue Report
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe")
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
EndFunc

Func MKT_AUX();Marketing AUX Report
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc

Func MKT_VDN();Marketing VDN Grouping Report
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe")
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
EndFunc

Func MKT_ASM();Marketing ASM Weekly Report
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc

Func OPS_LL();Operations Login/Logout Report
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe")
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
EndFunc

Func OPS_WR();Operations Weekly Report
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc

Func OPS_FM();Operations FM Scorecard Report
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe")
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
EndFunc

Func OPS_ADM();Operations Admin Performance Report
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc

Func FSG_WR();Road Service Weekly (Friday) Report
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe")
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
EndFunc

Func FSG_IR();Road Service Interval Report
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc

Func BEN_WR();Benefits Weekly Report
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe")
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
EndFunc

Func ICS_LL();ICS Login/Logout Report
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc

Func ICS_WR();ICS Weekly Report
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe")
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
EndFunc

Func GTK_RPT();Gatekeeper Report
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc

Func VRU_REF();Driver VRU Refresh
EndFunc

While 1
    
                
    $msg = GUIGetMsg()

    Select 
        Case $msg = $exititem
            ExitLoop
    
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        
        Case $msg = $exititem2
            ExitLoop
    
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

        Case $msg = $selectall
            CheckThemAll()
                    
        Case $msg = $deselectall
            UncheckThemAll()
            GUICtrlSetState($deselectall, $GUI_UNCHECKED)
        
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop        

        Case $msg = $aboutitem
            MsgBox(0, "About")
        
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        
        Case $runrpts
            Call GetCheckboxes()
        
  EndSelect
  
  WEnd

Thank you!!!

Edited by big_daddy
Link to comment
Share on other sites

Ok, i have looked and tried but I keep getting the following error when I try to run it now.

Line (253) : ==> Error parsing function call.

All I am trying to do, is make the Run button count which checkboxes are checked and launch them. I know it's something small, but I can't find anything even when I search for that type of error. Please let me know if you have any recommendations.

Line 253, you have :

Call GetCheckboxes()

You shouldn't need to use "Call" as I'm reading it, so you should be able to just change the line to:

GetCheckboxes()

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Line 253, you have :

Call GetCheckboxes()

You shouldn't need to use "Call" as I'm reading it, so you should be able to just change the line to:

GetCheckboxes()
I tried that when I first started out, and I received this error.

"Subscript used with non-Array variable"

So i assumed that I would have to call the function since I couldn't set the script up with array's due to the tab order (my limited Autoit capabilities is the cause).

Thanks,

btw, line 78 is what errors out when you don't call the function, i.e:

IF Guictrlread($checkmktll[0]) = $GUI_CHECKED then call ("MKT_LL")

Link to comment
Share on other sites

Hi,

From what I can see your calling a variable as if it was an array when it's not array...

eg:

$checkmktll = GUICtrlCreateCheckbox ("Marketing Login/Logout Report", 20, 40)

.......

IF Guictrlread($checkmktll[0]) = $GUI_CHECKED then call ("MKT_LL")

I know you didn't want to go through the hassle of putting your control id's in an array... but it works for me .

#include <Date.au3>
#include <GuiConstants.au3>
#include <Misc.au3>

Global $CheckBox[18], $Tab[8], $cy = 40 
Global $sName = StringSplit("Marketing Login/Logout Report|Marketing Weekly Report|Marketing Interval Queue Report|" & _
                                "Marketing AUX Report|Marketing VDN Grouping Report|Marketing ASM Weekly Report|" & _
                                "Operations Login/Logout Report|Operations Weekly Report|" & _
                                "Operations FM Scorecard Report|Operations Admin Performance Report|" & _
                                "Road Service Weekly (Friday) Report|Road Service Interval Report|" & _
                                "Benefits Weekly Report|ICS Login/Logout Report|ICS Weekly Report|" & _
                                "Gatekeeper Report|Driver VRU Refresh", "|")
; GUI
$hwnd = GUICreate("Main Menu", 400, 400)
GUISetIcon(@SystemDir & "\osk.exe", 0)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000);fade-in

; TEXT
GUICtrlCreateLabel("Date: " & @MON & "-" & @MDAY & "-" & @YEAR & " " & @CRLF & "", 20, 260)
GuiCtrlCreateLabel("Time: "  & @HOUR &  ":" & @MIN & ":" & @SEC, 20, 280)
GUICtrlCreateLabel("UserID: " & @UserName & "" & @CRLF & " " &@CRLF  & " ", 20, 300)

; BUTTONS
$openrpts = GUICtrlCreateButton (" Open Reports ",280, 260, 100)
$runrpts = GUICtrlCreateButton (" Run ",280, 290, 100)
$exititem2 = GUICtrlCreateButton(" Exit ",280, 320, 100);This causes the application to exit

; MENU
$filemenu = GUICtrlCreateMenu("File")
$exititem = GUICtrlCreateMenuitem("Exit", $filemenu)
$helpmenu = GUICtrlCreateMenu("Help")
$aboutitem = GUICtrlCreateMenuitem("About", $helpmenu)
GUICtrlCreateGroup("", 10, 190, 120, 55)
$selectall = GUICtrlCreateRadio("Select All", 20, 200, 100)
$deselectall = GUICtrlCreateRadio("Deselect All", 20, 220, 100)
GUICtrlCreateGroup("", -99, -99, 1, 1)

; PROGRESS BAR
ProgressOn("Progress Meter", "Increments every second", "0 percent")
For $i = 1 To 100 Step 10
    ProgressSet($i, $i & " percent")
Next
ProgressSet(100, "Done", "Complete")
Sleep(500)
ProgressOff()

; TAB
$Tab[0] = GUICtrlCreateTab(1, 0, 400, 190)
For $i = 1 To 17
    If $i = 7 Or $i = 11 Or $i = 13 Or $i = 15 Or $i = 16 Or $i = 17 Then $cy = 40
    If $i = 1 Then $Tab[1] = GUICtrlCreateTabItem("Marketing")
    If $i > 0 And $i < 7 Then $CheckBox[$i] = GUICtrlCreateCheckbox($sName[$i], 20, $cy)  
    If $i = 7 Then $Tab[2] = GUICtrlCreateTabItem("Operations")
    If $i > 6 And $i < 11 Then $CheckBox[$i] = GUICtrlCreateCheckbox($sName[$i], 20, $cy)
    If $i = 11 Then $Tab[3] = GUICtrlCreateTabItem("Road Service")
    If $i > 10 And $i < 13 Then $CheckBox[$i] = GUICtrlCreateCheckbox($sName[$i], 20, $cy)
    If $i = 13 Then $Tab[4] = GUICtrlCreateTabItem("Benefits")
    If $i > 12 And $i < 14 Then $CheckBox[$i] = GUICtrlCreateCheckbox($sName[$i], 20, $cy)
    If $i = 14 Then $Tab[5] = GUICtrlCreateTabItem("ICS")
    If $i > 13 And $i < 16 Then $CheckBox[$i] = GUICtrlCreateCheckbox($sName[$i], 20, $cy)
    If $i = 15 Then $Tab[6] = GUICtrlCreateTabItem("Gatekeeper")
    If $i > 15 And $i < 17 Then $CheckBox[$i] = GUICtrlCreateCheckbox($sName[$i], 20, $cy)
    If $i = 17 Then $Tab[7] = GUICtrlCreateTabItem("VRU")
    If $i > 16 And $i < 18 Then $CheckBox[$i] = GUICtrlCreateCheckbox($sName[$i], 20, $cy)  
    $cy += 20
Next    
GUISetState()

Func CheckThemAll()
    For $i = 1 To 17
        GUICtrlSetState($CheckBox[$i], $GUI_CHECKED)
    Next
EndFunc  ;==>CheckThemAll

Func UncheckThemAll()
    For $i = 1 To 17
        GUICtrlSetState($CheckBox[$i], $GUI_UNCHECKED)
    Next
EndFunc  ;==>UncheckThemAll

Func GetCheckboxes()
    Dim $sfn = StringSplit("MKT_LL|MKT_WR|MKT_IQR|MKT_AUX|MKT_VDN|MKT_ASM|OPS_LL|OPS_WR|" & _
                            "OPS_FM|OPS_ADM|FSG_WR|FSG_IR|BEN_WR|ICS_LL|ICS_WR|GTK_RPT|VRU_REF", "|")
    For $i = 1 To 17    
        If GUICtrlRead($CheckBox[$i]) = $GUI_CHECKED Then Call($sfn[$i])
    Next    
EndFunc;==>GetCheckboxes

;Add Automation Scripts here
Func MKT_LL();Marketing Login/Logout Report
    MsgBox(0, "Marketing Login/Logout Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\AdobeReader\AdbeRdr708.exe /S /v/qn","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("Adberdr708.exe")
EndFunc

Func MKT_WR();Marketing Weekly Report
    MsgBox(0, "Marketing Weekly Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("lannetscan.exe")
EndFunc


Func MKT_IQR();Marketing Interval Queue Report
;~     Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("update.exe")
    MsgBox(0, "Marketing Interval Queue Report", "Bitte Warten...", 1)
EndFunc

Func MKT_AUX();Marketing AUX Report
    MsgBox(0, "Marketing AUX Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("lannetscan.exe")
EndFunc

Func MKT_VDN();Marketing VDN Grouping Report
;~     Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("update.exe")
    MsgBox(0, "Marketing VDN Grouping Report", "Bitte Warten...", 1)
EndFunc

Func MKT_ASM();Marketing ASM Weekly Report
    MsgBox(0, "Marketing ASM Weekly Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("lannetscan.exe")
EndFunc

Func OPS_LL();Operations Login/Logout Report
;~     Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("update.exe")
    MsgBox(0, "Operations Login/Logout Report", "Bitte Warten...", 1)
EndFunc

Func OPS_WR();Operations Weekly Report
    MsgBox(0, "Operations Weekly Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("lannetscan.exe")
EndFunc

Func OPS_FM();Operations FM Scorecard Report
;~     Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("update.exe")
    MsgBox(0, "Operations FM Scorecard Report", "Bitte Warten...", 1)
EndFunc

Func OPS_ADM();Operations Admin Performance Report
    MsgBox(0, "Operations Admin Performance Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("lannetscan.exe")
EndFunc

Func FSG_WR();Road Service Weekly (Friday) Report
;~     Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("update.exe")
    MsgBox(0, "Road Service Weekly (Friday) Report", "Bitte Warten...", 1)
EndFunc

Func FSG_IR();Road Service Interval Report
    MsgBox(0, "Road Service Interval Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("lannetscan.exe")
EndFunc

Func BEN_WR();Benefits Weekly Report
;~     Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("update.exe")
    MsgBox(0, "Benefits Weekly Report", "Bitte Warten...", 1)
EndFunc

Func ICS_LL();ICS Login/Logout Report
    MsgBox(0, "ICS Login/Logout Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("lannetscan.exe")
EndFunc

Func ICS_WR();ICS Weekly Report
;~     Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("update.exe")
    MsgBox(0, "ICS Weekly Report", "Bitte Warten...", 1)
EndFunc

Func GTK_RPT();Gatekeeper Report
    MsgBox(0, "Gatekeeper Report", "Bitte Warten...", 1)
;~     Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
;~     ProcessWaitClose("lannetscan.exe")
EndFunc

Func VRU_REF();Driver VRU Refresh
    MsgBox(0, "Driver VRU Refresh", "Bitte Warten...", 1)
EndFunc

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $exititem
            ExitLoop
    
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        
        Case $msg = $exititem2
            ExitLoop
       
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

        Case $msg = $selectall
            CheckThemAll()
                    
        Case $msg = $deselectall
            UncheckThemAll()
            GUICtrlSetState($deselectall, $GUI_UNCHECKED)
        
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop        

        Case $msg = $aboutitem
            MsgBox(0, "About", "About")
        
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $runrpts
            GetCheckboxes()
    EndSelect
WEnd

Cheers

Link to comment
Share on other sites

you could even use a matrix

Ie:

$controls[100][100];$controls[tab][control]
$tab=0
$control=0

$controls[$tab][$control] = GUICtrlCreateTabItem("MKT")
$control+=1
$controls[$tab][$control] = GUICtrlCreateDummy()
$control+=1
$controls[$tab][$control] = GUICtrlCreateCheckbox("checkmktll", 20, 40)
$control+=1
$controls[$tab][$control] = GUICtrlCreateCheckbox("checkmktw", 20, 60)
$control+=1
$controls[$tab][$control] = GUICtrlCreateCheckbox("checkmktq", 20, 80)
$control+=1
$controls[$tab][$control] = GUICtrlCreateCheckbox("checkmktaux", 20, 100)
$control+=1
$controls[$tab][$control] = GUICtrlCreateCheckbox("checkmktvdn ", 20, 120)
$control+=1
$controls[$tab][$control] = GUICtrlCreateCheckbox("checkmktasm", 20, 140)
$control+=1
$controls[$tab][$control] = GUICtrlCreateDummy()
$tab+=1
$control=0
...
...
...

and use only that matrix for easyer control

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

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