CaptainBeardsEyesBeard Posted February 6, 2020 Share Posted February 6, 2020 (edited) Can anyone tell me why you can't input an array into a function like this? This hits the error check _IEFormElementOptionSelect($BusinessSectorCodeID,$BusinessSectorCodeDropdownArray[1]) If @Error Then ConsoleWrite(@CRLF & "Error setting dropdown for business sector Code: " & $BusinessSectorCodeDropdownArray[1]) exit Endif however this doesn't _IEFormElementOptionSelect($BusinessSectorCodeID,"test code") If @Error Then ConsoleWrite(@CRLF & "Error setting dropdown for business sector Code: " & $BusinessSectorCodeDropdownArray[1]) exit Endif Edited February 6, 2020 by CaptainBeardsEyesBeard Link to comment Share on other sites More sharing options...
Subz Posted February 6, 2020 Share Posted February 6, 2020 It depends on what $BusinessSectorCodeDropdownArray[1] is? You could try wrapping it with "String(...) Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted February 6, 2020 Author Share Posted February 6, 2020 Oh sorry I forgot to show you my declaration of the array Local $BusinessSectorFullDropdownArray[72] ; Make room for three elements ;Assign some data $file = "H:\Quality Assurance\AutoIT Scripts\EliteClientInceptionAutomation\TestData\BusinessSectorCodeDropdown.txt" FileOpen($file, 0) Global $arr[72] For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) ReDim $arr[_FileCountLines($file)+1] $arr[$i] = $line Next MsgBox(64, "Test Log", "Dropdown is : " & $BusinessSectorCodeDropdownArray[1]) _IEFormElementOptionSelect($BusinessSectorCodeID,$BusinessSectorCodeDropdownArray[1]) When I do the above when it hits the message box it the message is only "Dropdown is : " with no variable in there However if I do an array display it displays all of the variables in the text file (screenshot of top one) _ArrayDisplay($arr, "1D display") Link to comment Share on other sites More sharing options...
Danp2 Posted February 6, 2020 Share Posted February 6, 2020 How is it that you expect the contents of $arr and $BusinessSectorCodeDropdownArray to be the same? 😕 mikell 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Subz Posted February 6, 2020 Share Posted February 6, 2020 You could also just use _FileReadToArray to get your array: #include <Array.au3> #include <File.au3> Local $sFileName = @ScriptDir & "\Data.txt" Local $aBusinessSectorCodeDropdown _FileReadToArray($sFileName, $aBusinessSectorCodeDropdown, 1) If @error Then Exit MsgBox(4096, "Error", "Error reading file to array.") _IEFormElementOptionSelect($BusinessSectorCodeID,$aBusinessSectorCodeDropdownArray[1]) Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted February 6, 2020 Author Share Posted February 6, 2020 1 hour ago, Danp2 said: How is it that you expect the contents of $arr and $BusinessSectorCodeDropdownArray to be the same? 😕 God dammit lol My bad 🙄 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now