Jump to content
amphoric

Array in to List View and Updated after Loop

Recommended Posts

amphoric

Hi,

I am struggling converting my 1D array to a 2D array and then showing that in my List View. Below is my current code, where I would like to take the array from the input box, and have that displayed as a list within the list view this is a list of computer names, and then update the 2nd column of each line once I have ran a ping and a registry change on each computer name, with either 'Completed' and 'Failed'

I have checked out the AutoIt Arrays page here: https://www.autoitscript.com/wiki/Arrays , but unfortunately I cannot get my head around it. Any help would be greatly appreciated.

I hope this makes sense.

Thanks

 

#include <Date.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <GUIListBox.au3>
#include <GuiListView.au3>


#Region ###
$Form1 = GUICreate("Title", 515, 533, -1, -1)
GUISetBkColor(0xFFFFFF)
$Pic2 = GUICtrlCreatePic("Images\pic.jpg", 16, 16, 212, 28)
$Label1 = GUICtrlCreateLabel("Label", 240, 16, 271, 33, $SS_CENTER)
GUICtrlSetFont(-1, 17, 800, 0, "")
$Combo1 = GUICtrlCreateCombo("", 256, 406, 241, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
$Label2 = GUICtrlCreateLabel("Please select the location", 45, 401, 210, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "")
$ChangeButton = GUICtrlCreateButton("Change", 286, 487, 75, 25)
$RePromptButton = GUICtrlCreateButton("Re-prompt User", 366, 487, 139, 25)
$Checkbox1 = GUICtrlCreateCheckbox("I have ensured that my selection is correct.", 10, 487, 273, 25)
GUICtrlSetFont(-1, 10, 400, 0, "")
$ManLocation = GUICtrlCreateLabel("Please enter the location:", 59, 448, 189, 20, $SS_RIGHT)
GUICtrlSetFont(-1, 10, 800, 0, "")
GUICtrlSetState(-1, $GUI_HIDE)
$ManLocInput = GUICtrlCreateInput("", 256, 445, 241, 24)
GUICtrlSetState(-1, $GUI_HIDE)
$Label5 = GUICtrlCreateLabel("for this device:", 138, 418, 109, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "")
$Label3 = GUICtrlCreateLabel("Asset Number:", 98, 72, 107, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "")
$Input1 = GUICtrlCreateInput("", 215, 69, 241, 24)
$AddMulti = GUICtrlCreateLabel("Add Multiple Assets", 356, 55, 98, 13, $SS_RIGHT)
GUICtrlSetFont(-1, 8, 400, 6, "")
GUICtrlSetColor(-1, 0x808080)
GUICtrlSetCursor (-1, 0)
$List1 = GUICtrlCreateListView("", 16, 104, 481, 278)

$Add = GUICtrlCreateButton("Add", 461, 68, 35, 25)
GUISetState(@SW_SHOW)
#EndRegion ### 



;### StartForm ###
    $FormaMultiple = GUICreate("Title", 277, 418, -1, -1)
    GUISetBkColor(0xFFFFFF)
    $Label1 = GUICtrlCreateLabel("Please add 1 asset number per line.", 8, 11, 253, 20, $SS_CENTER)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $OK = GUICtrlCreateButton("OK", 56, 375, 75, 25)
    $Edit1 = GUICtrlCreateEdit("", 20, 40, 233, 329)
    $Cancel = GUICtrlCreateButton("Cancel", 136, 375, 75, 25)
    GUISetState(@SW_HIDE)
;### EndForm ###



;### Add List View Columns START ###

;### Add List View Columns END ###




;### Read Locations START ###
    ;Read the LOCAL ini file SECTIONS
    Global $aSections = IniReadSectionNames("Locations.ini")

    ;If the above succeeded, convert the array to a string with each item separated by a | (pipe) and set the default selected item to $aSections[1]
    If(Not @Error) Then GUICtrlSetData($Combo1, _ArraytoString($aSections, "|", 1), $aSections[1])
;### Read Locations END ###



;### Require Admin START ###
    ;#RequireAdmin
;### Require Admin END ###



While 1
    $nMsg = GUIGetMsg()


;### Data Validation START ###
    ;Set Checkbox = ENABLE/DISABLE
    if not GUICtrlRead($Combo1) = "" AND GUICtrlRead($Combo1) = "Not In List" then
        if not GUICtrlRead($ManLocInput) = "" Then
            If not ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_ENABLE)
        Else
            If ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_DISABLE)
        EndIf
    Else
        if GUICtrlRead($Combo1) = "" Then
            If ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_DISABLE)
        Else
            If not ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_ENABLE)
        EndIf
    EndIf

    ;Set Button = ENABLE/DISABLE
    If GUICtrlRead($Checkbox1) = 1 Then
        If Not ControlCommand($Form1, "", $ChangeButton, "IsEnabled") Then GUICtrlSetState($ChangeButton, $GUI_ENABLE)
    Else
        If ControlCommand($Form1, "", $ChangeButton, "IsEnabled") Then GUICtrlSetState($ChangeButton, $GUI_DISABLE)
    EndIf
;### Data Validation END ###



    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit



        case $Add








        Case $AddMulti
            GUISetState(@SW_SHOW, $FormaMultiple)

        Case $Cancel
            GUISetState(@SW_HIDE, $FormaMultiple)
        Case $OK
            $sText = GUICtrlRead($Edit1)
            $aText = StringSplit($sText, @CRLF, 1)
            $bText = _ArrayToString($aText, ";", 1, -1)
            $cText = StringStripWS($bText, $STR_STRIPALL )
            $dText = StringReplace($cText,";;",";")
            GUICtrlSetData($Input1, $dText)
            GUICtrlSetData($Edit1, "")
            GUISetState(@SW_HIDE, $FormaMultiple)
            For $i = 1 To $aText[0]
            Next

        Case $Combo1 ; If the combo is actioned
            Switch GUICtrlRead($Combo1)
                Case "Not In List" ; Show the manual input controls
                    GUICtrlSetState($ManLocation, $GUI_SHOW)
                    GUICtrlSetState($ManLocInput, $GUI_SHOW)
                    if ControlCommand($Form1, "", $Checkbox1, "IsChecked") then ControlCommand($Form1, "", $Checkbox1, "Uncheck")
                    GUICtrlSetData($ManLocInput, "")

                Case Else ; Hide them
                    GUICtrlSetState($ManLocation, $GUI_HIDE)
                    GUICtrlSetState($ManLocInput, $GUI_HIDE)
                    if ControlCommand($Form1, "", $Checkbox1, "IsChecked") then ControlCommand($Form1, "", $Checkbox1, "Uncheck")
                    GUICtrlSetData($ManLocInput, "")

            EndSwitch

        Case $ChangeButton
            ChangeReg()

        Case $RePromptButton
            RemoveReg()
    EndSwitch
WEnd

Func ChangeReg()

            $MultiAssets = StringSplit(GUICtrlRead($Input1), ";", 1)
            For $i = 1 To $MultiAssets[0]



    ; Ping with a timeout of 250ms.
    Local $iPing = Ping($MultiAssets[$i], 250)

    If $iPing Then ; If a value greater than 0 was returned then do the following:

        if not GUICtrlRead($ManLocInput) = "" Then

            RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "Location", "REG_SZ", "# - " & GUICtrlRead($ManLocInput))
            RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "Location", "REG_SZ", "# - " & GUICtrlRead($ManLocInput))
            RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC)
            RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC)
            MsgBox($MB_SYSTEMMODAL, "Completed", "Completed")

        Else
            If not GUICtrlRead($Input1) = "" Then

                RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "Location", "REG_SZ", GUICtrlRead($Combo1))
                RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "Location", "REG_SZ", GUICtrlRead($Combo1))
                RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC)
                RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC)
                MsgBox($MB_SYSTEMMODAL, "Completed", $MultiAssets[$i] & @CRLF & " Changed to: " & GUICtrlRead($Combo1))
            Else
                MsgBox($MB_SYSTEMMODAL, "Error", "Please ensure all boxes are completed")
            EndIf
        EndIf

    Else

        MsgBox($MB_SYSTEMMODAL, "Error", "This asset may be OFFLINE, unable to complete")
    EndIf
            Next
EndFunc   ;==>PingReg


Func RemoveReg()

    $MultiAssets = StringSplit(GUICtrlRead($Input1), ";", 1)
            For $i = 1 To $MultiAssets[0]




    ; Ping with a timeout of 250ms.
    Local $iPing = Ping($MultiAssets[$i], 250)

    If $iPing Then ; If a value greater than 0 was returned then do the following:

        if not GUICtrlRead($ManLocInput) = "" Then

            RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "Location", "REG_SZ", "")
            RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "Location", "REG_SZ", "")
            RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", "")
            RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", "")
            MsgBox($MB_SYSTEMMODAL, "Completed", "Completed")

        Else
            If not GUICtrlRead($Input1) = "" Then

                RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "Location", "REG_SZ", "")
                RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "Location", "REG_SZ", "")
                RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", "")
                RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", "")
                MsgBox($MB_SYSTEMMODAL, "Completed", $MultiAssets[$i] & @CRLF & "CLEARED")
            Else
                MsgBox($MB_SYSTEMMODAL, "Error", "Please ensure all boxes are completed")
            EndIf
        EndIf




    Else

        MsgBox($MB_SYSTEMMODAL, "Error", "This asset may be OFFLINE, unable to complete")
    EndIf
Next
EndFunc   ;==>PingReg1

 

Share this post


Link to post
Share on other sites
careca
$List1 = GUICtrlCreateListView("1|2", 16, 104, 481, 278)

that gives the listview 2 columns.

now you just write to one or the other

I'd suggest that you could write the computer list into the first column, and then ping the items in the column, writing the result to the second column.

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites
amphoric

Thanks Careca!

I now have the columns working a treat, although how would I write to the second column the results? I loop through each computer 1 at a time?

 

Thanks

Share this post


Link to post
Share on other sites
careca

help file says it all about how.

Run through each item, and ping, write the result to the second column, come back with what you tried that didnt work.

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
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

  • Similar Content

    • Burgs
      By Burgs
      Greetings,
        I seem to be having a problem trying to insert values into an array in excess of the size of the array (its Ubound value).  I thought the command would simply 'ReDim' the array in order to add another value...however that does not seem to be happening.  My code is as below:
       
      ;**SET DYNAMIC ARRAY DIMENSIONS... $vValue = Int($_STRUCTURE_LEVEL - 1) ;seek the '$_HIERARCHY' level that is one 'previous' to the 'current' value...! $iStart = 0 ;set to begin search from element "0" in array... Do $_Files_Located = _Arraysearch($_HIERARCHY, $vValue, $iStart) if Int($_Files_Located) <> -1 Then $iEnd = 1 For $_RIGGING = 0 to Ubound($_LINE_DETAIL3) - 1 _ArrayInsert($_STRUCTURES, $_Files_Located + $iEnd, String($_LINE_DETAIL3[$_RIGGING])) _ArrayInsert($_HIERARCHY, $_Files_Located + $iEnd, Int($_STRUCTURE_LEVEL)) _ArrayInsert($_INFERIOR_TMPLS, $_Files_Located + $iEnd, Int(-1)) $iEnd += 1 ;increment EACH ITERATION... Next ;Next $_RIGGING EndIf ;'$_Files_Located' NOT "-1"...value for previous '$_STRUCTURE_LEVEL' ;was located in '$_HIERARCHY' array... $iStart += (Ubound($_LINE_DETAIL3) + 1) ;increment the offset index element position to begin the next search... ;"+ 1" to INCLUDE the 'parent' ('searched') UNIT...! Until $_Files_Located == -1 ;end loop when previous '$_STRUCTURE_LEVEL' is NOT found in '$_HIERARCHY' array... ;**  
        This code routine works perfectly fine except when the 'searched' value ($_Files_Located) happens to be the final element position in the searched array...how can I modify this routine so that the final additions at the end of the array(s) are made?  I thank in advance for any replies. 
       
    • DarkFingers1337
      By DarkFingers1337
      Hey,
      what is more efficient, using multiple arrays or one multidimensional array?
       
      ; Hamster data structure using multiple arrays Global $HamsterCount = 6 Global $HamsterX[$HamsterCount] Global $HamsterY[$HamsterCount] ;giving each hamster an x and y position For $i=0 To $HamsterCount-1 $HamsterX[$i] = 0 $HamsterY[$i] = 0 Next ; The same hamster data structure using one multidimensional array Global $HAMSTER_COUNT = 6 Global Enum $HAMSTER_X, _ $HAMSTER_Y, _ $HAMSTER_MAX Global $Hamsters[$HAMSTER_COUNT][$HAMSTER_MAX] ;giving each hamster an x and y position For $i=0 To $HAMSTER_COUNT-1 $Hamsters[$i][$HAMSTER_X] = 0 $Hamsters[$i][$HAMSTER_Y] = 0 Next  
    • XinYoung
      By XinYoung
      HI! ... this is a big one (at least for me) 
      You guys previously helped me copy the used range in column A and paste them into a Website one at a time in a loop. Cool! Now, for another function, I have 2 columns, A and B, and two input boxes in the Website. I'm having a hard time replicating the loop for the 2 columns. 
      This is how I'm opening the Excel workbook (copied from the previous function that only had 1 column). I need to also get the used range in column B.
      Func OpenExcelForCopy() Global $aBBTableData Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, $ChosenFileName, Default, True, True) $oExcel.Sheets("CopyCourses").Activate ;~ Get all used cells in column A:A Global $aSearchItems = _Excel_RangeRead($oWorkbook, 1, $oWorkbook.Sheets("CopyCourses").Usedrange.Columns("A:A")) ;~ Duplicate the $aSearchItems Array Global $aSearchResult = $aSearchItems ;~ Loop through the array starting at 0 until the end of the array which is (Ubound($aSearchItems) - 1) For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = SearchCourseForCopy($aSearchItems[$i]) Next _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") Finished() EndFunc ;==>OpenExcelForCopy Then we eventually get here. I don't think anything needs to change here but I'm not sure. This is where I paste the data from Column A into an input field (which is a search tool in a website). If the search is good, then we get to the tricky part...
      ;~ OK, we logged in and we searched for a course. Lets COPY it! Func CopyCourseBegin() Local $sResult $iSearchIndex = _ArraySearch($aBBTableData, "Course ID", 0, 0, 0, 1, 1, 0) ;~ If the course was not found, do this. If $iSearchIndex = -1 Then ;~ MsgBox(4096, "Search Error", "Item not found") $sResult = "Source Not Found" _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") ;~ Now go back to the Excel sheet and search for the next one. ;~ If the course was found, begin the COPY process. Else For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = CopyCourseNow($aSearchItems[$i]) Next $sResult = "Copied" _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") EndIf Return $sResult EndFunc ;==>CopyCourseBegin This is the "tricky part" where I'm confused. I can copy and paste what's in column A just fine, but I can't manage to replicate it for column B. I need to paste whats in Column B into "destinationCourseId"
      ;~ The course search was successful. COPY the course now. Func CopyCourseNow($_sSearchResult) ;~ Navigate to the course copy page. _IENavigate($oIE, $urlBBCourseCopy) ;~ Copy the SOURCE course ID from the Excel sheet ;~ Paste whats copied from column A into the Source Course ID text box Local $oForm = _IEGetObjByName($oIE, "selectCourse") Local $oSearchString = _IEFormElementGetObjByName($oForm, "sourceCourseId") _IEFormElementSetValue($oSearchString, $_sSearchResult) ;~ Paste whats copied from column B into the Destination Course ID text box ?!?!?!?! Local $oForm = _IEGetObjByName($oIE, "selectCourse") Local $oSearchString = _IEFormElementGetObjByName($oForm, "destinationCourseId") _IEFormElementSetValue($oSearchString, $_sSearchResult) ;~ Just exit cause im stuck :( _Exit() EndFunc ;==>CopyCourseNow After I paste the data from column A into "sourceCourseId" and column B into "destinationCourseId", I'll make it do some stuff. Then I need it to loop around until the used ranges in column A & B is finished.
      Does the entire code need to change now that there's two columns?
       
       
    • Skysnake
      By Skysnake
      I know how JSON works. However JSON data is typically received from web based servers. 
       
      My question is:
      Has anyone considered to use, or currently actively using JSON as an internal data container? 
      Internal here as in an ordinary AutoIt data type, generated, populated and manipulated within an AutoIt script, without any external data sources. 
      The JSON and BinaryCall UDFs work well and appear the de facto defaults. Are there any thoughts on using JSON for internal variable values instead of the typical array? 
      Also, there can be situations where such a JSON collection contains an array and it will have to be parsed using typical array functions. 
      Currently I am working on a small project where I have to keep and use various identifiers from different sources. There are several ideas in this regard, some involving SQL child tables and arrays stored with keys (maps), which lead me to think that JSON may be a more suitable data container. It readily shrinks and stretches, allowing for dynamic data growth.  JSONs ability to add new repeating data groups on the fly makes it particularly powerful and appealing. 
      Ideas and suggestions welcome
      Skysnake
    • XinYoung
      By XinYoung
      Why hello there! 
      I have a script reading an Excel sheet (currently only looking at A1), copying the data in that cell, and then searching for it in a Website's search tool. Then it does some stuff if it actually finds something.
      After that, I need it to go back to the Excel sheet, write "yes" into column B if the search was good -- "no" if no results were found, then go down to A2 and do the whole thing all over again until column A has nothing left.
      I really suck at loops and have a hard time grasping how it works. Any help or guidance is really appreciated!
       
      SearchCourse() ;~ Now that were logged in, navigate to the course search page. Func SearchCourse() _IENavigate($oIE, $urlBBCourseSearch) ;~ Change the search criteria to "Course ID" _bbCourseSearchCategoryChange("Course ID") ;~ Open the selected Excel file Local $oAppl = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oAppl, $ChosenFileName, Default, Default, True) ;~ Copy whats in the first cell (A1) _Excel_RangeCopyPaste($oWorkbook.Worksheets(1), "A1") Global $WhatsCopied = ClipGet() ;~ Paste whats copied into the search text box and click submit Local $oForm = _IEGetObjByName($oIE, "courseManagerFormSearch") Local $oSearchString = _IEFormElementGetObjByName($oForm, "courseInfoSearchText") _IEFormElementSetValue($oSearchString, $WhatsCopied) _IEFormSubmit($oForm) ;~ Lets see what we got from the search Local $oBBTable = _IETableGetCollection($oIE, 2) Global $aBBTableData = _IETableWriteToArray($oBBTable) _ArrayDisplay($aBBTableData) DeleteCourseBegin() EndFunc ;==>SearchCourse ;~ OK, we logged in and we searched for a course. Lets delete it! Func DeleteCourseBegin() $iSearchIndex = _ArraySearch($aBBTableData, "Course ID", 0, 0, 0, 1, 1, 0) ;~ If the course was not found, do this. If $iSearchIndex = -1 Then MsgBox(4096, "Search Error", "Item not found") ;~ Now go back to the Excel sheet and search for the next one....? ;~ If the course was found, begin the deletion process. Else MsgBox(4096, "Search Success", $aBBTableData[$iSearchIndex][0] & " = " & $aBBTableData[$iSearchIndex][1]) DeleteCourseNow() EndIf EndFunc ;==>DeleteCourseBegin ;~ The course search was successful. Delete the course now. Func DeleteCourseNow() ;~ Click the checkbox located beside the course that has been found. Local $CheckBox = _IEGetObjByName($oIE, "ckbox") _IEAction($CheckBox, "click") _IELoadWait($oIE) ;~ Click the Delete button. _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.href = "javascript:validateRemove();" Then _IEAction($oLink, "click") ExitLoop EndIf Next ;~ Click the "Delete course, including all of its files" radio button. Local $RadioButton = _IEGetObjById($oIE, "removeAllFiles_t") _IEAction($RadioButton, "click") _IELoadWait($oIE) ;~ Click the "Submit" button Local $Submit = _IEGetObjByName($oIE, "bottom_Submit") _IEAction($Submit, "click") _IELoadWait($oIE) ;~ Now go back to the Excel sheet and search for the next one....? EndFunc ;==>DeleteCourseNow  
       
×