Sign in to follow this  
Followers 0
grimmlock

Help with adding array

3 posts in this topic

#1 ·  Posted (edited)

I can get most of this to work, however I am at the last few steps of finalizing my code and need some help. I have a mysql database with tons of data that is refreshed every night. The things I need help with is to get the data from mysql to the list box, seperating each name to a new line. Then what I am trying to accomplish is, I want to be able to highlight the computer name and have the buttons perform their action.

Example: If I choose branch 1 from the drop down list, and it pulls all the computers (8 of them) from mysql and displays them in the list box one pc per line. Then if I click Ping it scrolls through the list and returns the output of the ping into the read-only display boxes. Then if I stop the ping and select computers 2, 4, and 7 from the list box, I want to be able to get the IP addresses of those PC's (using mysql) and send the IP

to a seperate program. Lastly I would like to be able to select computers 1, 3, and 8 (if they are not reponding) and get thier IPs and their MAC addresses (from mysql) and send that data to the Wake On Lan Function.

Here is my code:

#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <WinAPI.au3>
#include <GUIComboBox.au3>
#Include <String.au3>
#include <mysql.au3>


; Declare a flag
Global $fPing = False
Global $Input1 = False
Global $Input2 = False


GUICreate("Am I Asleep?", 315, 850)


GUISetState()

;~ IP Addresses
$List1 = FileRead("c:\dhcp2.txt") ; Branch1
$List2 = FileRead("\server.test1.local\Installers\dhcp2.txt") ; Branch2
$List3 = ("") ; Branch3
$List4 = ("") ; Branch4
$List5 = ("") ; Branch5
$List6 = ("") ; Branch6
$List7 = ("") ; Branch7
$List8 = ("") ; Branch8
$List9 = ("") ; Branch9
$List10 = ("") ;Branch10
$List11 = ("") ; Branch11
$List12 = ("") ; Branch12
$List13 = ("") ; Branch13
$List14 = ("") ; Branch14
$List15 = ("") ; Branch15
$List16 = ("") ; Branch16
$List17 = ("") ; Branch17
$List18 = FileRead("C:\SC_PC.txt") ; Branch18
$List19 = ("") Branch Servers
$List20 = ("") ; Core Servers

Local $Combo1 = GUICtrlCreateCombo("", 10, 20, 125, 10)
GUICtrlSetData(-1, "Branch1|Branch2|Branch3|Branch4|Branch5|Branch6|Branch7|Branch8|Branch9|Branch10|Branch11|Branch12|Branch13|Branch14|Branch15|Branch16|Branch17|Branch18|Branch Servers|Core Servers")

; Set Cuebanner rather than add an extra element to the combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Get handle of combo edit
$tInfo = $tagCOMBOBOXINFO
_GUICtrlComboBox_GetComboBoxInfo($Combo1, $tInfo)
$hComboEdit = DllStructGetData($tInfo, "hEdit")
; Write CueBanner
$tText = _WinAPI_MultiByteToWideChar("Select one")
_SendMessage($hComboEdit, $EM_SETCUEBANNER, False, $tText, 0, "wparam", "struct*")

Local $Input1 = GUICtrlCreateList("", 150, 20, 150, 815, BitOR($ES_READONLY, $WS_BORDER, $WS_VSCROLL))
GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling
Local $Input2 = GUICtrlCreateList("", 440, 20, 150, 815, BitOR($ES_READONLY, $WS_BORDER, $WS_VSCROLL))
GUICtrlSetState(-1, $GUI_HIDE)

;~ Controls
Local $Button_1 = GUICtrlCreateButton("Ping", 10, 340, 115)
Local $Button_2 = GUICtrlCreateButton("Wake On Lan", 10, 380, 115)
Local $Button_3 = GUICtrlCreateButton("Netsupport Manager", 10, 440, 115)
Local $Button_4 = GUICtrlCreateButton("Remote Desktop", 10, 475, 115)
Local $Button_5 = GUICtrlCreateButton("VNC", 10, 510, 115)
Local $Button_6 = GUICtrlCreateButton("Start WHD", 10, 750, 115)
Local $Button_7 = GUICtrlCreateButton("Stop WHD", 10, 780, 115)
Local $Display1 = GUICtrlCreateEdit("", 10, 70, 125, 30, BitOR($ES_READONLY, $ES_CENTER)) ;, 0)
Local $Display2 = GUICtrlCreateEdit("", 10, 110, 125, 30, BitOR($ES_READONLY, $ES_CENTER)) ;, 0)


$iIndex = 0
_GUICtrlListBox_ClickItem($Input1, $iIndex)
$iCount = _GUICtrlListBox_GetCount($Input1)

; _AddHorzSep(10, 40, 290)
_AddHorzSep(10, 325, 125)
_AddHorzSep(10, 420, 125)
;~ _AddHorzSep(10, 690, 125)

; Get a timestamp
$iBegin = TimerInit()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit


Case $Button_1
Switch GUICtrlRead($Button_1)
; What does the button tell us we are going to do?
Case "Ping"
; We need to ping
$fPing = True
; And set the button text accordingly
GUICtrlSetData($Button_1, "Stop")
; Disable the combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetState($Combo1, $GUI_DISABLE)
Case Else
; Now we need to stop pinging
$fPing = False
; And again change the button text
GUICtrlSetData($Button_1, "Ping")
; Enable the combo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetState($Combo1, $GUI_ENABLE)
EndSwitch


Case $Combo1
Switch GUICtrlRead($Combo1)
Local $ip = mysql("PC1")
Local $mac = mysql("PC1")
Case "Branch1"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch1
GUICtrlSetData($Input1, "|" & $List1)
;~ GUICtrlSetData($Input2, "|" & $List21)
Case "Branch2"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch2
GUICtrlSetData($Input1, "|" & $List2)
;~ GUICtrlSetData($Input2, "|" & $List22)
Case "Branch3"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch3
GUICtrlSetData($Input1, "|" & $List3)
;~ GUICtrlSetData($Input2, "|" & $List23)
Case "Branch4"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch4
GUICtrlSetData($Input1, "|" & $List4)
;~ GUICtrlSetData($Input2, "|" & $List24)
Case "Branch5"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch5
GUICtrlSetData($Input1, "|" & $List5)
;~ GUICtrlSetData($Input2, "|" & $List25)
Case "Branch6"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch6
GUICtrlSetData($Input1, "|" & $List6)
;~ GUICtrlSetData($Input2, "|" & $List26)
Case "Branch7"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch7
GUICtrlSetData($Input1, "|" & $List7)
;~ GUICtrlSetData($Input2, "|" & $List27)
Case "Branch8"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch8
GUICtrlSetData($Input1, "|" & $List8)
;~ GUICtrlSetData($Input2, "|" & $List28)
Case "Branch9"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch9
GUICtrlSetData($Input1, "|" & $List9)
;~ GUICtrlSetData($Input2, "|" & $List29)
Case "Branch10|"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch10
GUICtrlSetData($Input1, "|" & $List10)
;~ GUICtrlSetData($Input2, "|" & $List30)
Case "Branch11"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch11
GUICtrlSetData($Input1, "|" & $List11)
;~ GUICtrlSetData($Input2, "|" & $List31)
Case "Branch12"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch12
GUICtrlSetData($Input1, "|" & $List12)
;~ GUICtrlSetData($Input2, "|" & $List32)
Case "Branch13"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch13
GUICtrlSetData($Input1, "|" & $List13)
;~ GUICtrlSetData($Input2, "|" & $List33)
Case "Branch14"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch14
GUICtrlSetData($Input1, "|" & $List14)
;~ GUICtrlSetData($Input2, "|" & $List34)
Case "Branch15"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch15
GUICtrlSetData($Input1, "|" & $List15)
;~ GUICtrlSetData($Input2, "|" & $List35)
Case "Branch16"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch16
GUICtrlSetData($Input1, "|" & $List16)
;~ GUICtrlSetData($Input2, "|" & $List36)
Case "Branch17"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch17
GUICtrlSetData($Input1, "|" & $List17)
;~ GUICtrlSetData($Input2, "|" & $List37)
Case "Branch18"
ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch18
GUICtrlSetData($Input1, "|" & $List18)
;~ GUICtrlSetData($Input2, "|" & $List38)
Case "Branch Servers"
;~ ConsoleWrite("Hit" & @CRLF) ; <<<<<<<<<<<<< Branch Servers
GUICtrlSetData($Input1, "|" & $List19)
Case "Core Servers"
MsgBox(0, "", GuiCtrlRead($ip[1]))

EndSwitch

; Get new count <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$iCount = _GUICtrlListBox_GetCount($Input1)


Case $Button_2
WakeOnLan()


Case $Button_3
If ProcessExists("PCICTLUI.EXE") Then
Netsupport()
Else
Run("C:\Program Files (x86)\NetSupport\NetSupport Manager\PCICTLUI.EXE", "")
Netsupport()
EndIf


Case $Button_4
RDP()


Case $Button_5
VNC()


Case $Button_6
WHD_Start()


Case $Button_7
WHD_Stop()


EndSwitch

If $fPing Then
; Have we waited long enough since the last ping?
If TimerDiff($iBegin) > 1000 Then ; 1 sec delay
; Click the current item
_GUICtrlListBox_ClickItem($Input1, $iIndex)
; Read the current item
$sItem = GUICtrlRead($Input1)
$var = Ping(GUICtrlRead($Input1), 999)
If $var <> 0 Then
GUICtrlSetData($Display1, $sItem) ; & " - " & $var & " ms")
GUICtrlSetBkColor($Display1, 0x00FF00)
GUICtrlSetColor($Display1, 0x000000)
GUICtrlSetData($Display2, " " & $var & " ms")
GUICtrlSetBkColor($Display2, 0x00FF00)
GUICtrlSetColor($Display2, 0x000000)
Else
GUICtrlSetData($Display1, $sItem)
GUICtrlSetBkColor($Display1, 0)
GUICtrlSetColor($Display1, 0xFFFFFF)
GUICtrlSetData($Display2, "Request Timed Out ")
GUICtrlSetBkColor($Display2, 0)
GUICtrlSetColor($Display2, 0xFFFFFF)
EndIf
; Reset the timestamp for the next ping
$iBegin = TimerInit()
; Increase the index to select the next item
$iIndex = Mod($iIndex + 1, $iCount)
EndIf
EndIf

WEnd

Func _AddHorzSep($iX, $iY, $iW)

GUICtrlCreateLabel("", $iX, $iY, $iW, 1)
GUICtrlSetBkColor(-1, 0x000000)

EndFunc ;==>_AddHorzSep

; MySQL Function
Func sql($branch)
; establish an array with too many elements
Local $output[80]

; establish a counter starting at zero
$count = 0


; put query together
$sql = _MySQLConnect("DHCP","Yvl1234","test","192.168.26.18")
$var = _Query($sql,"SELECT * FROM Leases WHERE Branch='" & $branch & "'")

With $var


;loop through the query result
While NOT .EOF

;put data into array
$output[$count]=.Fields("IP").value


;increment the counter
$count += 1

; end of the loop
wend

; resize the array to the number of elements
ReDim $output[$count]
EndWith
; return the proper sized array
return $output
EndFunc

Func WHD_Start()
Run("cmd.exe")
Sleep(1000)
Send("cd /{Enter}")
Sleep(1000)
Send("cd pstools{Enter}")
Sleep(1000)
Send("psexec \\192.168.26.17\cmd.exe{Enter}")
Sleep(5000)
Send("cd /{Enter}")
Sleep(1000)
Send("cd Program Files\WebHelpDesk{Enter}")
Sleep(1000)
Send("whd_start.bat{Enter}")
EndFunc

Func WHD_Stop()
Run("cmd.exe")
Sleep(1000)
Send("cd /{Enter}")
Sleep(1000)
Send("cd pstools{Enter}")
Sleep(1000)
Send("psexec \\192.168.26.17\ cmd.exe{Enter}")
Sleep(5000)
Send("cd /{Enter}")
Sleep(1000)
Send("cd Program Files\WebHelpDesk{Enter}")
Sleep(1000)
Send("whd_stop.bat{Enter}")
EndFunc

Func VNC()
Run("C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe")
WinWaitActive("VNC Viewer")
Send(GUICtrlRead($Input1))
Sleep(1000)
Send("{ENTER}")
EndFunc

Func RDP()
Run("mstsc.exe /console")
WinWaitActive("Remote Desktop Connection")
Send(GUICtrlRead($Input1))
Sleep(1000)
Send("{ENTER}")
EndFunc

Func Netsupport()
Local $Input3 = GUICtrlRead($Input1)
Local $Input4 = StringTrimRight(GUICtrlRead($Input1), 12)
WinActivate("NetSupport : ")
Send("!C{Down}")
Send("Q")
Sleep(1000)
Send("^A")
Sleep(1000)
;~ sql()
;~ Send(GuiCtrlRead($fields2))
Send("{ENTER}")
Sleep(1000)
If WinActive("Security") Then
Send("{Tab}")
Sleep(1000)
Send("ceeWee6o")
Sleep(2000)
Send("{Enter}")
Sleep(1000)
Else
Send("!C{Down}")
Send("w{Enter}")

EndIf

EndFunc

Func WakeOnLan() ; need to fix this so that it removes all that funky stuff I need it to
$IPAddress = GuiCtrlRead() ; I want to be able to have this use the IP address associated with the computer name in $Input1
$MACAddress = GUICtrlRead() ; I want to be able to have this use the MAC address associated with the computer name in $Input1


UDPStartUp()

$connexion = UDPOpen($IPAddress, 7)
$res = UDPSend($connexion, GenerateMagicPacket($MACAddress))
MsgBox(0, "", $res)

UDPCloseSocket($connexion)
UDPShutdown()

EndFunc

; ===================================================================
; Functions
; ===================================================================


; This function convert a MAC Address Byte (e.g. "1f") to a char
Func HexToChar($strHex)

Return Chr(Dec($strHex))

EndFunc

; This function generate the "Magic Packet"
Func GenerateMagicPacket($strMACAddress)

$MagicPacket = ""
$MACData = ""

For $p = 1 To 11 Step 2
$MACData = $MACData & HexToChar(StringMid($strMACAddress, $p, 2))
Next

For $p = 1 To 6
$MagicPacket = HexToChar("ff") & $MagicPacket
Next

For $p = 1 To 16
$MagicPacket = $MagicPacket & $MACData
Next

Return $MagicPacket

EndFunc
Edited by grimmlock

Thanks

Grimm

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

grimmlock,

Two things:

1 - You've defined what you want to do but not what is failing

2 - Your code cannot be run as posted to duplicate the error, if any.

If you are seeking advice on technique (as you seem to be doing) then post a small, runnable reproducer.

kylomas

edit: Is this question related to thread?

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Sorry but I no longer want to pursue this route.

Thanks!


Thanks

Grimm

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
Sign in to follow this  
Followers 0

  • Similar Content

    • XinYoung
      By XinYoung
      Hello all,
      I've been working on 4 standalone scripts. They each have their own GUI and are now independent .exe's. But instead of having 4 separate icons on my computer, is it possible to put them all together into one .exe?
      What I want is one interface with tabs. Each script's GUI would be on their own respective tab. Is this possible?
      The different scripts don't need to communicate with one another. I just want them all in one .exe.
      I can't find this anywhere... Any help would be greatly appreciated. Thank you!
    • czardas
      By czardas
      Haven't had much time to code recently. However the following thread inspired me.
      The debate about linear, parallel and binary search methods was rather interesting and, in an attempt to be diplomatic, I decided to combine @jchd's suggestion with @LarsJ's binary search example. I decided that the binary search algorithm required modification to make it more linear. As usual, 'if you invent something, it probably already exists and if it already exists, it exists for a reason'. My first attempt was not all that good. The code worked but was really a mess. I blame peer pressure (to post an example of a parallel search method).  I will delete that old code in due course.
      With a little memory jogging and a glance at the help file, the solution turned out to be quite easy: I just needed a better understanding of Euler. Further modification will be needed to work with more complicated unicode strings. The output could be returned as an array or a delimitered string. I'm not so interested in those details. I'm just going to post the algorithm for now and anyone, who wants to, can modify it to suit their needs. Both arrays must contain at least 1 element.
      Local $aFoo = [0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,19,20,23,24,26,30,35,39,40,41] Local $aBar = [0,1,5,6,7,8,9,10,11,12,13,14,17,18,19,21,24,25,26,27,34,35,38,40] ParallelExponetialSearch($aFoo, $aBar) ; Compares two lists - returning positive matches. Each input array must be unique (individually) and in alphabetical order. Func ParallelExponetialSearch($aFoo, $aBar) Local $sFind, _ $iMin_F = -1, $iMax_F = UBound($aFoo) -1, $Lo_F = $iMin_F, $Hi_F, _ $iMin_B = -1, $iMax_B = UBound($aBar) -1, $Lo_B = $iMin_B, $Hi_B While $iMin_F < $iMax_F And $iMin_B < $iMax_B ; Toggle Arrays - Which array has most untested elements? This is the one we want to search next, ; so we can bypass more comparisons because (in theory) mismatches have a greater chance of being skipped. If $iMax_F - $iMin_F >= $iMax_B - $iMin_B Then ; $aFoo has more (or an equal number of) untested elements $Hi_F = $iMax_F $iMin_B += 1 $sFind = $aBar[$iMin_B] While $Lo_F < $Hi_F ; search $aFoo For $i = 0 To Floor(Log($Hi_F - $Lo_F) / Log(2)) $Lo_F = $iMin_F + 2^$i If $aFoo[$Lo_F] = $sFind Then $iMin_F = $Lo_F ; each match should be added to the output [perhaps an array] ConsoleWrite($sFind & " found at $aFoo[" & $Lo_F & "] = $aBar[" & $iMin_B & "]" & @LF) ExitLoop 2 ElseIf $aFoo[$Lo_F] > $sFind Then $Hi_F = $Lo_F -1 $iMin_F += Floor(2^($i -1)) $Lo_F = $iMin_F ContinueLoop 2 EndIf Next $iMin_F = $Lo_F ; minimum increment is one WEnd Else ; $aBar has more untested elements $Hi_B = $iMax_B $iMin_F += 1 $sFind = $aFoo[$iMin_F] While $Lo_B < $Hi_B ; search $aBar For $i = 0 To Floor(Log($Hi_B - $Lo_B) / Log(2)) $Lo_B = $iMin_B + 2^$i If $aBar[$Lo_B] = $sFind Then $iMin_B = $Lo_B ; each match should be added to the output [perhaps an array] ConsoleWrite($sFind & " found at $aFoo[" & $iMin_F & "] = $aBar[" & $Lo_B & "]" & @LF) ExitLoop 2 ElseIf $aBar[$Lo_B] > $sFind Then $Hi_B = $Lo_B -1 $iMin_B += Floor(2^($i -1)) $Lo_B = $iMin_B ContinueLoop 2 EndIf Next $iMin_B = $Lo_B ; minimum increment is one WEnd EndIf WEnd EndFunc ;==> ParallelExponetialSearch I hope this will be useful to someone. I believe it deserved a thread of its own!
    • RC86
      By RC86
      Afternoon!
      I have a requirement to return both a string and an array from a function so as a result I put them both into an array and returned that.  I can access them in their entirety after returning them but then I can't seem to access the array elements after this.  Should I be able to or is there a prettier way?
      #include <Array.au3> ;Memory info returned as a string and an array $memoryInfo = _getMemoryInfo() msgbox(0,"Memory Info",$memoryInfo[0]) _ArrayDisplay($memoryInfo[1],"Memory as an Array") Local $newArray[7] $memoryInfo[1] = $newArray msgbox(0,"Test element",$newArray[0]) _ArrayDisplay($newArray) Func _getMemoryInfo() Local $newArray[7] Local $array = MemGetStats() $newArray[0] = $array[0] ;% of memory in use $newArray[1] = Round($array[1]/1024 * 0.001,2) ;Total physical RAM $newArray[2] = Round($array[2]/1024 * 0.001,2) ;Availaible physical RAM $newArray[3] = Round($array[3]/1024 * 0.001,2) ;Total pagefile $newArray[4] = Round($array[4]/1024 * 0.001,2) ;Available pagefile $newArray[5] = Round($array[5]/1024 * 0.001,2) ;Total virtual $newArray[6] = Round($array[6]/1024 * 0.001,2) ;Available virtual $memoryUsage = $newArray[1] - $newarray[2] $pagefileUsage = $newArray[3] - $newarray[4] ;Output/Return Local $returnArray[2] $returnArray[0] = "Memory: " & $memoryUsage & " GB/" & $newArray[1] & " GB " & @CRLF & "Pagefile: " & $pagefileUsage & " GB/" & $newArray[3] & " GB " $returnArray[1] = $newArray return $returnArray EndFunc A bit messy but hopefully it's understandable what I'm trying to achieve.
      Thanks!
    • kawliga751
      By kawliga751
      I have a workplace GUI that has a search field function that pulls up customer records to allow changes. I am attempting to 1)LOGIN 2)Enter Search field, enter a number and then {ENTER} 3)change specific field once customer record loads. I have very limited experience in GUI manipulation but I am able to login using the below:
      #include <IE.au3> Const $navOpenInNewTab = 0x0800 Dim $oIE = _IECreate('http://asag.xxxxxxx.com/ASAG/index.htm') Call ("RacksheetSignIn") Func RacksheetSignIn () Local $username = _IEGetObjByName ($oIE,"uname") Local $password = _IEGetObjByName ($oIE,"pword") $oIE.Navigate2('http://asag.xxxxxxx.com/apps/RackSheets/LogInSAG/login.asp',2048) _IEFormElementSetValue ($username, "xxxxxxx") _IEFormElementSetValue ($password, "xxxxxxx") Send('{Enter}') EndFunc However I can't seem to use the _IEGetObjByName or Mouseclick to focus on the search field to allow me to enter my search criteria. When I "inspect element" in the Search field I get the attached:
       
      Any help would be MUCH appreciated
       
       
       

    • Jibberish
      By Jibberish
      I am having difficulties getting updated results from GUICtrlCreateInput. I wrote a small script to demonstrate what I am trying to do.
      This script reads a text file into an array and displays the Name and Number from the text file.
      The user can check a name and change the number, and the results are displayed in _ArrayDisplay.
      Only the Checked names are displayed in their original position. This is necessary for future
      plumbing.
      The problem with this script is the original number is returned, not the changed number. I cannot
      figure out how to get the updated number to be displayed.
      ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; This script reads a text file into an array and displays the Name and Number from the text file. ; The user can check a name and change the number, and the results are displayed in _ArrayDisplay. ; Only the Checked names are displayed in their original position. This is necessary for future ; plumbing. ; ; The problem with this script is the original number is returned, not the changed number. I cannot ; figure out how to get the updated number to be displayed. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include-once #include <MsgBoxConstants.au3> #include <array.au3> #include <Date.au3> #include <WinAPIFiles.au3> #include <AutoItConstants.au3> #include <Misc.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Local $iMax = 6 ;Default number of Videos - 1 for the array counter Dim $aTextFile[$iMax][2] ; [start with 5 entries][Name, Number] Don't get confused! [Row][Column] Local $i = 0 Local $iLeft = 30 Local $iTop = 30 Local $sName Local $sNumber Local $aArray Local $iMaxCol = 5 Local $iRow = 0 Local $iCol = 0 Local $aNumberCount[$iMaxCol][2] $aArray1 = ReadFile() $aNamesNumbers = DisplayNames($aArray1) _ArrayDisplay($aNamesNumbers) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; ReadFile() places the contents of the NameNumber.txt file in an array ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Func ReadFile() Local $sFileData = @ScriptDir & "\NameNumber.txt" Local $iStrReturn = 0 Local $aArrayFile Local $aTextFile[$iMaxCol][2] Local $aName Local $sCheckBox1 Const $iL = 10 ; Count from Left for GUI so all buttons line up Local $sFill Local $iA = 0, $iN = 0 ; Put the Names into an Array _FileReadToArray($sFileData, $aArrayFile) For $iA = 0 To $aArrayFile[0] ; Step through the array looking for Names If StringInStr($aArrayFile[$iA], "Name:") Then $aName = StringSplit($aArrayFile[$iA],":") $sFill = $aName[2] If UBound($aTextFile) <= $iRow Then ; Resize the array when $iRow is equal to the element count in the array to prevent subscript error ReDim $aTextFile[UBound($aTextFile) + 1][$iMaxCol] EndIf $aTextFile[$iRow][$iCol] = $sFill $iRow += 1 EndIf Next $iCol = 1 $iRow = 0 $sFill = "" For $iA = 1 To $aArrayFile[0] ; Step through the array looking for Numbers If StringInStr($aArrayFile[$iA], "Number:") Then $aName = StringSplit($aArrayFile[$iA],":") $sFill = $aName[2] If UBound($aTextFile) <= $iRow Then ; Resize the array when $iRow is equal to the element count in the array to prevent subscript error ReDim $aTextFile[UBound($aTextFile) + 1][$iMaxCol] EndIf $aTextFile[$iRow][$iCol] = $sFill $iRow += 1 EndIf Next Return $aTextFile EndFunc ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display the Name and Number ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Func DisplayNames($aArray1) Local $aName[$iMax] Local $aNumbers[$iMax] $iMMCount = UBound($aArray1) $iMMCount -=1 Local $iWidth = 300 Local $iLength = 300;$iMMCount * 30 GUISetFont(12) $hGUI = GUICreate("Edit / Update Number Test", $iWidth, $iLength, -1, -1) GUICtrlCreateLabel(" Name Number",1,5) ;$iTop += 30 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display Name with a Checkbox. Only Checked Names should be saved. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For $i = 0 to $iMMCount Step 1 $sNameText = $aArray1[$i][0] $iNameLength = StringLen($sNameText) $aName[$i] = GUICtrlCreateCheckbox($sNameText,$iLeft, $iTop) $iTop += 30 Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display the number from the text file below each name. Allow the user to change the number and display the ; new number. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $iLeft = 60 GUIStartGroup() $iTop = 28 For $i = 0 to $iMMCount Step 1 $sNumberText = $aArray1[$i][1] $aNumberCount[$i][1] = $sNumberText $aNumberCount[$i][0] = GUICtrlCreateInput($sNumberText,$iLeft, $iTop, 50,18, $GUI_DOCKAUTO) GUICtrlSetPos($aNumberCount[$i][0],200) $iTop += 30 Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Read the checked names and (possibly updated) number ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $iMMCount = UBound($aNumberCount) $iMMNewCount = $iMMCount - 1 Local $aGUICheckbox[$iMMCount] Local $aCheckedNameNumber[$iMMCount][2] $iLeft = 30 Local $idCloseGUI = GUICtrlCreateButton("Close",$iLeft, $iTop) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idCloseGUI For $i = 0 To $iMMNewCount Step 1 Switch GUICtrlRead($aName[$i]) Case $GUI_CHECKED $aCheckedNameNumber[$i][0] = $aArray1[$i][0] Case $GUI_UNCHECKED EndSwitch Switch GUICtrlRead($aNumberCount[$i][0]) Case $aCheckedNameNumber[$i][1] = GUICtrlRead($aNumberCount[$i][1]) EndSwitch Next ExitLoop EndSwitch WEnd For $i = 0 to $iMMNewCount step 1 GUICtrlRead($aNumberCount[$i][0]) If $aCheckedNameNumber[$i][0] <> "" Then $aCheckedNameNumber[$i][1] = $aNumberCount[$i][1] EndIf Next GUIDelete($hGUI) Return $aCheckedNameNumber EndFunc This is the text file I am reading. If you want to try this out put the NameNumber.txt file in your script directory. It's attached to the post.
      * This is a dummy file with a Name and Number * The only purpose of this file is to read the updated Number. Name:Taggart Number:916 Name:Mongo Number:90 Name:Hedley Lamarr Number:22 Name:Bart Number:9999 Name:The Waco Kid Number:2244 If I change the number, the original number is displayed at the end, not the updated/modified number. I need the modified number to be displayed.
      Thanks in advance for any assistance!
      Jibberish
      NameNumber.txt