Jump to content

Search the Community

Showing results for tags 'arrays'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 33 results

  1. Hello, I am currently writing a program that parses a massive table from a website, and need a way to add a progress bar while parsing. I am currently using the function _IETableWriteToArray($oObj, True) to parse the array. I need the progress bar to update as the table is parsed, not just at the end of the parsing. Any help at all would be very much appreciated! *EDIT --> The array I am left with after parsing is $array[0-50000][16]
  2. Associative Array Functions I've seen a couple of UDFs for this on the forum. One of them I quite like. But it's still nearly not as good as this method, IMHO. I don't recall if I discovered the "Scripting.Dictionary" COM object myself or if I got the original base code from somewhere online. I have recently searched the web (and here) hard for any AutoIt references to this, other than my own over the years I've been using this (in ffe, etc..), and I can find nothing, so I dunno. If anyone does, I'd love to give credit where it's due; this is some cute stuff! It could actually be all my own work! lol At any rate, it's too useful to not have posted somewhere at autoitscript.com, so I've put together a wee demo. For those who haven't heard of the COM "Scripting.Dictionary".. If you've ever coded in Perl or PHP (and many other languages), you know how useful associative arrays are. Basically, rather than having to iterate through an array to discover it's values, with an associative array you simply pluck values out by their key "names". I've added a few functions over the years, tweaked and tuned, and this now represent pretty much everything you need to easily work with associative arrays in AutoIt. En-joy! The main selling point of this approach is its simplicity and weight. I mean, look at how much code it takes to work with associative arrays! The demo is bigger than all the functions put together! The other selling point is that we are using Windows' built-in COM object functions which are at least theoretically, fast and robust. I've used it many times without issues, anyhow, here goes.. ; Associative arrays in AutoIt? Hells yeah! ; Initialize your array ... global $oMyError = ObjEvent("AutoIt.Error", "AAError") ; Initialize a COM error handler ; first example, simple. global $simple AAInit($simple) AAAdd($simple, "John", "Baptist") AAAdd($simple, "Mary", "Lady Of The Night") AAAdd($simple, "Trump", "Silly Man-Child") AAList($simple) debug("It is said that Trump is a " & AAGetItem($simple, "Trump") & ".", @ScriptLineNumber);debug debug("") ; slightly more interesting.. $ini_path = "AA_Test.ini" ; Put this prefs section in your ini file.. ; [test] ; foo=foo value ; foo2=foo2 value ; bar=bar value ; bar2=bar2 value global $associative_array AAInit($associative_array) ; We are going to convert this 2D array into a cute associative array where we ; can access the values by simply using their respective key names.. $test_array = IniReadSection($ini_path, "test") for $z = 1 to 2 ; do it twice, to show that the items are *really* there! for $i = 1 to $test_array[0][0] $key_name = $test_array[$i][0] debug("Adding '" & $key_name & "'..");debug ; key already exists in "$associative_array", use the pre-determined value.. if AAExists($associative_array, $key_name) then $this_value = AAGetItem($associative_array, $key_name) debug("key_name ALREADY EXISTS! : =>" & $key_name & "<=" , @ScriptLineNumber);debug else $this_value = $test_array[$i][1] ; store left=right value pair in AA if $this_value then AAAdd($associative_array, $key_name, $this_value) endif endif next next debug(@CRLF & "Array Count: =>" & AACount($associative_array) & "<=" , @ScriptLineNumber);debug AAList($associative_array) debug(@CRLF & "Removing 'foo'..");debug AARemove($associative_array, "foo") debug(@CRLF & "Array Count: =>" & AACount($associative_array) & "<=" , @ScriptLineNumber);debug AAList($associative_array) debug(@CRLF & "Removing 'bar'..");debug AARemove($associative_array, "bar") debug(@CRLF & "Array Count: =>" & AACount($associative_array) & "<=" , @ScriptLineNumber);debug AAList($associative_array) quit() func quit() AAWipe($associative_array) AAWipe($simple) endfunc ;; Begin AA Functions func AAInit(ByRef $dict_obj) $dict_obj = ObjCreate("Scripting.Dictionary") endfunc ; Adds a key and item pair to a Dictionary object.. func AAAdd(ByRef $dict_obj, $key, $val) $dict_obj.Add($key, $val) If @error Then return SetError(1, 1, -1) endfunc ; Removes a key and item pair from a Dictionary object.. func AARemove(ByRef $dict_obj, $key) $dict_obj.Remove($key) If @error Then return SetError(1, 1, -1) endfunc ; Returns true if a specified key exists in the associative array, false if not.. func AAExists(ByRef $dict_obj, $key) return $dict_obj.Exists($key) endfunc ; Returns a value for a specified key name in the associative array.. func AAGetItem(ByRef $dict_obj, $key) return $dict_obj.Item($key) endfunc ; Returns the total number of keys in the array.. func AACount(ByRef $dict_obj) return $dict_obj.Count endfunc ; List all the "Key" > "Item" pairs in the array.. func AAList(ByRef $dict_obj) debug("AAList: =>", @ScriptLineNumber);debug local $k = $dict_obj.Keys ; Get the keys ; local $a = $dict_obj.Items ; Get the items for $i = 0 to AACount($dict_obj) -1 ; Iterate the array debug($k[$i] & " ==> " & AAGetItem($dict_obj, $k[$i])) next endfunc ; Wipe the array, obviously. func AAWipe(ByRef $dict_obj) $dict_obj.RemoveAll() endfunc ; Oh oh! func AAError() Local $err = $oMyError.number If $err = 0 Then $err = -1 SetError($err) ; to check for after this function returns endfunc ;; End AA Functions. ; debug() (trimmed-down version) ; ; provides quick debug report in your console.. func debug($d_string, $ln=false) local $pre ; For Jump-to-Line in Notepad++ if $ln then $pre = "(" & $ln & ") " & @Tab ConsoleWrite($pre & $d_string & @CRLF) endfunc ;o) Cor
  3. Hello, So this may be more of a challenge of effective programming then specific to AutoIT but I want to solve this problem with AutoIT so i'm putting it here. (If someone has a better language to solve with I'm all ears) So the task I'm trying to achieve is that I have multiple .CSV files that have: year, month, day, hour, value. I need to be able to sum up all the values that have the same date/time, then find which date and time has the maximum value. The problem is that each file may or may not have same amount of days/hours as the rest. So I need to devise a way to handle this. Example: File A File B File C 2018 1 1 1:00 10 2018 1 1 2:00 10 2018 1 1 1:00 10 2018 1 1 2:00 12 2018 1 1 3:00 12 2018 1 2 1:00 12 2018 1 1 3:00 14 2018 1 1 4:00 14 2018 2 1 1:00 16 2018 2 1 1:00 16 2018 2 1 1:00 16 Answer I want to be spit out is Feb 1st 2018 at 2:00 with value of 48 So far I've got code to store all .CSV files to an array, then a loop to go through each csv, but not sure how to effectively manipulate the data. Keep in mind each file has over 7000 time entry points. If anyone can solve this that would be pretty awesome! #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> RefineData() Func RefineData() Local $i, $filenum, $file, $csvArray, $FilePath = @ScriptDir $fileList = _FileListToArrayRec($FilePath, "*.csv", 1) ;Create and array of all .csv files within folder Local $chkArray[UBound($fileList)][2] ;=====Loop through the .csv files within the folder====== For $filenum = 1 To UBound($fileList) - 1 Step 1 $file = $fileList[$filenum] $sFilePath = $FilePath & "\" & $file ;=====Create array based on csv file===== _FileReadToArray($sFilePath, $csvArray, $FRTA_NOCOUNT, ",") ;#### Operations here ###### next msgbox(0,"", "Date: " & $date_of_max & "Value: " & $maxVal );display solution endfunc
  4. How do I work with 2D arrays. I've tried this but get errors. Local $aTest[4][4] = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]] ;$aTest[0][] = [10,11,12] ; Error at [] Local $sTest = "" For $i = 0 To UBound($aTest)-1 Local $aExtract = _ArrayExtract($aTest,$i,$i) $sTest = $sTest & MyTest($aExtract) Next Func MyTest($aTemp) _ArrayDisplay($aTemp) ; Error at v $aTemp Return String($aTemp[0]) & " - " & String($aTemp[1]) & " - " & String($aTemp[2]) & @CRLF EndFunc
  5. My esteemed Autoits I need your help once again. I'm trying to figure out how to create a loop that gets 1 value from an array and repeats until each value from the array has been used. I have never used arrays before and I know once I learn more things should get easier for me. Here is what Im trying to do: -Have an array of values that determine what application i log into. ex: app1, app2, app3, app4 etc. -Have a loop that repeats a process sequentially using each value in the array to finish the process for each app1, app2, app 3 and so forth. I have 30 apps that I need to update on a regular basis and getting this sorted out is what I perceive to be the best way to do it. Here is my feeble attempt that obviously fails: #include <msgboxconstants.au3> #include <Constants.au3> #include <array.au3> Login() Func Login() local $array[30] = ["10", "11", "12",etc etc] ;;Local $site = InputBox("ERx Site","What site do you want to login as?","","") Local $userid = InputBox("ERx Login", "What is your username?", "", "") Local $Passwd = InputBox("Security Check", "Enter your UAT password.", "", "*") for $1 = 1 to 30(I need to do the same steps in 30 different apps) run("Z:launch.exe") WinWaitActive("Input") Send (Sequential ARRAY VALUE HERE) Send("{ENTER}") WinWaitActive("window") Send($userid) Send("{TAB}") send($Passwd) Send("{ENTER}") WinWaitActive("[CLASS:SunAwtDialog]") Sleep(500) WinClose("Home Page") Next EndFunc your help is greatly appreciated. Thanks for your time
  6. Hi All, I am fairly new to AutoIT and I am still trying to learn, I have been using _FileListToArray to list all the files with a particular extension in an array and then loop through it for operation ( For $i = 1 To UBound($FileArray) - 1). So far this has been working fine. But I am not able to figure out a problem that I have; what if I have 50 files but I only want to loop through first 10 files and then next ten and so on? Or rather I should say, how I can I only feed max 10 files to the array at a time when I do _FileListToArray regardless of the total number of files in the folder? Any insight/help will be much appreciated
  7. I'm trying to get an array from a website so that I can just get the url, but I am not sure how. I read a bit of arrays but I have a feeling I'd have to be writing a lot more than what I should be. I will include the script I have so far and the API url for what I want. API: https://api.fast.com/netflix/speedtest?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=1 (I want the 'url' array that contains the url) Code: #include <MsgBoxConstants.au3> #include <Inet.au3> #include <Array.au3> $site = _INetGetSource('http://api.fast.com/netflix/speedtest?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=1') MsgBox($MB_SYSTEMMODAL, "Title", $site[1])
  8. Alright, currently I'm trying to merge two loops: Local $aArray[99][13] For $iLoop = 1 to 100 $aArray[$iLoop - 1][0] = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration", $iLoop) If @error <> 0 Then ReDim $aArray[$iLoop - 1][13] ExitLoop EndIf Next For $iLoop1 = 0 to UBound($aArray, 1) - 1 For $iLoop2 = 1 to 12 $aArray[$iLoop1][$iLoop2] = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\" & $aArray[$iLoop1][0], $iLoop2) If @error <> 0 Then ExitLoop Next Next into one. Here's what I have so far: Local $aArray[99][13] For $iLoop1 = 0 to UBound($aArray, 1) - 1 For $iLoop2 = 0 to 12 ConsoleWrite("Loop1 = " & $iLoop1 & ", Loop2 = " & $iLoop2 & @CRLF) If $iLoop2 = 0 Then $aArray[$iLoop1][0] = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration", $iLoop1 + 1) If @error <> 0 Then ReDim $aArray[$iLoop1 + 1][13] ExitLoop EndIf Else $aArray[$iLoop1][$iLoop2] = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration\" & $aArray[$iLoop1][0], $iLoop2) If @error <> 0 Then ExitLoop EndIf Next Next And it keeps error-ing out trying to exceed the dimension range of the array. Does the Loop not recheck the size of the array after the original check or am I doing something else wrong. Thanks.
  9. Hi guys! How are you? Hope you're fine I'm trying to use SQLite for managing some data, and, I would like to display my "retrieved" data, but I'm trying to do a select from 2 table, and seems to not work properly... What I'd like to do is retrieve data from 2 tables and display in a listview... I tried with: Local $aRisultato, $iRighe, $iColonne, $iRVal $iRval = _SQLite_GetTable2d($hDatabase, "SELECT * FROM Magazzino_Rockwell, Magazzino_Siemens;", $aRisultato, $iRighe, $iColonne) If $iRVal = $SQLITE_OK Then ;_SQLite_Display2DResult($aRisultato) _ArrayDisplay($aRisultato) EndIf ... but it displays a single record 41 times, and it does this thing for every record in the database... What do you need to help me? Thanks EDIT: Managed with a double If and double query like this: $iRval = _SQLite_GetTable2d($hDatabase, "SELECT * FROM Magazzino_Rockwell;", $aRisultato, $iRighe, $iColonne) If $iRVal = $SQLITE_OK Then Local $aRisultatoRockwell = $aRisultato $iRval = _SQLite_GetTable2d($hDatabase, "SELECT * FROM Magazzino_Siemens;", $aRisultato, $iRighe, $iColonne) If $iRVal = $SQLITE_OK Then _ArrayConcatenate($aRisultato, $aRisultatoRockwell) Local $i, $sRiga, $s_LV_Item For $i = 1 To Ubound($aRisultato) - 1 $sRiga = $aRisultato[$i][0] & "|" & _ $aRisultato[$i][1] & "|" & _ $aRisultato[$i][2] & "|" & _ $aRisultato[$i][3] & "|" & _ $aRisultato[$i][4] & "|" & _ $aRisultato[$i][5] & "|" & _ $aRisultato[$i][6] & "|" & _ $aRisultato[$i][7] & "|" & _ $aRisultato[$i][8] & "|" & _ $aRisultato[$i][9] & "|" & _ $aRisultato[$i][10] & "|" & _ $aRisultato[$i][11] $s_LV_Item = GUICtrlCreateListViewItem($sRiga, $lv_Lista) Next And so, the listview is created If anyone has another more efficient way, I'm here Thanks guys
  10. Hi people, It's been a while I have been scripting in vbscript for some time but now i'm back using AutoIt for a project: Scripting Adobe Illustrator with AutoIt . This vb code needs to be converted: Set appRef = CreateObject("Illustrator.Application") 'Create a new document and assign it to a variable Set documentRef = appRef.Documents.Add 'Create a new text frame item and assign it to a variable Set sampleText = documentRef.TextFrames.Add 'Set the contents and position of the TextFrame sampleText.Position = Array(200, 200) sampleText.Contents = "Hello World!" The ... = Array(200,200) part is done in one line in vb, is this possible in AutoIt without declaring an array first? I know I sound like a newbie but I never had to use arrays this way before.. what i have: $appRef = ObjCreate("Illustrator.Application") ;Create a new document and assign it to a variable $documentRef = $appRef.Documents.Add ;Create a new text frame item and assign it to a variable $sampleText = $documentRef.TextFrames.Add ;Set the contents and position of the TextFrame ReDim $sampleText.Position[2] = [200, 200] <<<--- doesn't work... $sampleText.Contents = "Hello World!"
  11. I just can't get my head around what I'm trying to do. Ok so I read all the links in a webpage into a 1D array, I then make the array unique as there are some duplicates. I then find all the entries I want from the array and put the number of the row for those entries into another 1D array. So I now have two arrays; one has unique links, the other has the numbers of the rows for the links I actually want. Using the second array I would like to amend the first array, or create a third, with just the links I actually want. Confused? Welcome to my world. I'll put the relevant section of code below to show where I am up to. I've left the _ArrayDisplay in the above code which I am using to check the code does what I wanted. So the above code works fine, I'm just stumped on how to extract the links from $aLinks that I want. $oLinks = _IELinkGetCollection($oIE) Local $aLinks[1] = ["Link"] For $oLink in $oLinks _ArrayAdd($aLinks, $oLink.href) Next ;_ArrayDisplay($aLinks) $aLinks = _ArrayUnique($aLinks) ;_ArrayDisplay($aLinks) $aLinksToClick = _ArrayFindAll($aLinks, "azref", 0, 0, 0, 3) ;_ArrayDisplay($aLinksToClick) Local $aSortedLinks[1] = ["Sorted Links"] For $i = 0 To UBound($aLinksToClick) - 1 $Blah = _ArrayExtract($aLinks, $aLinksToClick[$i], $aLinksToClick[$i]) _ArrayAdd($aSortedLinks, $Blah) Next
  12. I've been searching for a solution on the forum and came across a partial solution in this topic... My problem is that I have a 2D array; column one has the description (a string) of the integer in column two. I want to sort this array by the value of column two from highest to lowest. Only my _ArraySort produces a strange result. Here is the code and the output before and after... Local $PensionsOne = ($MonthlyPensionIncomeOne + $MonthlyPensionCreditIncomeOne) Local $SecondEmploymentOne = ($SecondSalaryOne + $SecondBonusOne + $SecondOvertimeOne + $SecondCommissionOne) Local $aGetHighestFiveAdditionalIncomesForAppOne[8][2] = [ _ ["Occupational pension income", $PensionsOne], _ ["2nd job", $SecondEmploymentOne], _ ["Working Tax Credits", $MonthlyUniversalTaxCreditIncomeOne], _ ["Disability living allowance", $MonthlyStateDisabilityIncomeOne], _ ["Investment or dividend income", $MonthlyInvestmentIncomeOne], _ ["Maintenance", $MonthlyMaintenanceIncomeOne], _ ["Rental income", $MonthlyUnencumberedRentalIncomeOne], _ ["Self-employed income", $SecondNetPreTaxProfitLatestYrOne]] _ArrayDisplay($aGetHighestFiveAdditionalIncomesForAppOne) _ArraySort($aGetHighestFiveAdditionalIncomesForAppOne, 0, 0, 2) _ArrayDisplay($aGetHighestFiveAdditionalIncomesForAppOne)
  13. Hi, This is my first post here. I've searched through the help and these forums and haven't found what I'm looking for. Although I have quite a bit of experience in programming, it's all quite a long time ago (COBOL and dBase/Clipper), and this is my first attempt to write something quite complex using AutoIt. I'm writing an app that reads a single CSV file and then splits it into a number of separate arrays based on the sections in the original file. I then display each of the individual arrays in a ListView control. In order to standardize my code I would like to declare the structure that each array/listview will have, by creating a structure array that contains the following elements: - section name, - number of columns, - an array with the column headers, - an array with the column widths The last two sub-arrays will have a variable number of entries, equal to the second value, the number of columns. Unfortunately, I can't get this to work, I keep getting syntax errors. This is my structure array at present (note that the widths are just placeholders at present) : Global $aStructures[10][4] = [_ ["params", 3, ["parameter", "value", "comments"], [110, 150, 450] ], _ ["notes", 1, ["note"], [500] ], _ ["sizes", 8, ["name", "width", "height", "blockwidth", "blockheight", "hgridsize", "vgridsize", "comments"], [10, 10, 10, 10, 10, 10, 10, 10] ], _ ["templates", 2, ["name", "comments"], [10, 10] ], _ ["elements", 10, ["template", "name", "nature", "frontback", "left", "top", "width", "height", "font", "size"], [10, 10, 10, 10, 10, 10, 10, 10 10, 10] ], _ ["schemes", 4, ["name", "frontbg", "backbg", "comments"], [10, 10, 10, 10] ], _ ["elementcolours", 7, ["scheme", "element", "fg", "bg", "bg2", "gradtype", "gradval"], [10, 10, 10, 10, 10, 10, 10] ], _ ["colours", 7, ["name", "r", "g", "b", "rgb", "hex", "sample"], [10, 10, 10, 10, 10, 10, 10] ], _ ["sheets", 2, ["name", "comments"], [10, 10] ], _ ["items", 10, ["sheet", "size", "template", "scheme", "qty", "f1", "f2", "f3", "f4", "f5"], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10] ] _ ] So, two questions. 1/ Are such arrays allowed, with a variable number of dimensions ? 2/ If so, what am I doing wrong in the above code ? Any help would be welcome. Chris
  14. Assign Array?

    Hello, I need to assign data to array: Global $Test[3][4] $Array = "Test" SetArrayData($Array,"Hello world!",1,3) ConsoleWrite($Array[1][3]&@CRLF) Exit Func SetArrayData($Array,$Data,$1,$2) $Array[$1][$2] = $Data; <-- ??? EndFunc I need that somebody would help me with that function
  15. i have the following snippet... now its working but i have it inside a function and want to be able to use $aThumb[$i] outside the function in the rest of the script, i tried return and keep getting this error "Invalid keyword at the start of this line.:" Global $iRows = UBound($a, $UBOUND_ROWS) Global $iCols = UBound($a, $UBOUND_COLUMNS) $oID = $oID + 1 $oURL = $oString.selectSingleNode("./url") $oName = $oString.selectSingleNode("./name") $oCategory = $oString.selectSingleNode("./category") $oThumb = $oString.selectSingleNode("./image") $oLanguage = $oString.selectSingleNode("./language") $aThumb = [$iRows] _ArrayAdd($aThumb, $oThumb.text) For $i = 1 To UBound($aThumb) - 1 ConsoleWrite($oID & @TAB & $aThumb[$i] & @CRLF) Next Next ConsoleWrite( "rows: " & $iRows & @CRLF) Thanks for your help
  16. Hello, I'm trying to normalize data from 4 different multi-dimension arrays, but they are extremely large and I'm trying to learn a faster way of parsing data. Please note I am rather newb at programming. The following script does exactly what I need, but its really slow. Is there a better way to parse data than nested For loops? Basically the logic is: 1. For All store/lanes in the Quarterly report, find any matches in Current day’s Lane issues 2. (if any), then if lane issues exist and they are in the quarterly report, find match in Revenue report 3. (if any), then if lane issues exist and they are in the quarterly report, that have contract values from Revenue report, then perform calculations and output It I cannot provide the documents due to sensitive data. Quarterly Report array is about 80,000 Rows and 13 Columns Store/lane Issues array is about 25,000 Rows and 3 Columns Revenue array report is about 100 Rows and 13 Columns National Store/Retailer translation array is about 30,000 Rows and 3 Columns Current output takes roughly 0.5 seconds per cycle, so it would be about 11 hours for all 80,000 rows. Any help or advice would be greatly appreciated!! $date = StringReplace(_NowCalcDate(), "/", "-") $ROI_output = @ScriptDir & "\ROI_output_" & $date & ".txt" $ROI_output1 = FileOpen($ROI_output, 1) FileWrite($ROI_output1, "Retailer" & " | " & "Chain-Store" & " | " & "Store Value" & " | " & "Lane" & " | " & "Lane Value" & " | " & "Status" & " | " & "StoreWeight" & " | " & "LaneWeight" & " | " & "RetailerValue " & @CRLF) ;Quarterly report $lanestoreweights = "Z:\STAT\lanestoreweights.xlsx" Local $oApplD2 = _Excel_Open(False); Local $oExcelD2 = _Excel_BookOpen($oApplD2, $lanestoreweights) Local $lanestoreweightsarray = _Excel_RangeRead($oExcelD2, Default, $oExcelD2.ActiveSheet.Usedrange.Columns("C:M"), 1, True) _Excel_BookClose($oApplD2) ;Current Day's lane issues $storelanestatuses = "Z:\STAT\Store_Lane_values-" & $date & ".txt" Local $storelanearray _FileReadToArray($storelanestatuses, $storelanearray) ;Revenue Report $rev = "Z:\STAT\OI_Revenue_Report_PipeDelimited.txt" Local $revarray _FileReadToArray($rev, $revarray) ;Chain to Retailer translation Local $nationallocal = "Z:\STAT\national.xls" Local $oApplD1 = _Excel_Open(False) Local $oExcelD1 = _Excel_BookOpen($oApplD1, $nationallocal) Local $livestores = _Excel_RangeRead($oExcelD1, Default, $oExcelD1.ActiveSheet.Usedrange.Columns("A:C"), 1, True) _Excel_BookClose($oApplD1) For $z = 2 To UBound($lanestoreweightsarray) -1 $split2 = StringSplit($lanestoreweightsarray[$z][0], "-") If UBound($split2) > 3 Then $wtChain = StringFormat("%03i", $split2[1]) $wtStore = StringFormat("%04i", $split2[2]) $wtLane = StringFormat("%02i", $split2[3]) EndIf $storeweight1 = "" $laneweight1 = "" $rev_retailer = "" $rev_val = "" For $x = 1 To UBound($storelanearray) -1 $split = StringSplit($storelanearray[$x], " ") $chain = $split[3] $store = $split[4] $lane = $split[6] $statfilesplit = StringSplit($storelanearray[$x], "***") $lanestatus = $statfilesplit[4] If $chain = $wtChain And $store = $wtStore And $lane = $wtLane Then $storeweight = $lanestoreweightsarray[$z][9] $storeweight1 = $storeweight * 100 $laneweight = $lanestoreweightsarray[$z][10] $laneweight1 = $laneweight * 100 For $y = 1 To UBound($livestores) -1 If $chain = StringFormat("%03i", $livestores[$y][2]) Then If $livestores[$y][0] = "No Chain Group Assigned." Then $retailer = $livestores[$y][1] ExitLoop Else $retailer = $livestores[$y][0] ExitLoop EndIf EndIf Next For $r = 2 To UBound($revarray) -1 $split3 = StringSplit($revarray[$r], "|") If $rev_retailer = "" Then If $split3[1] = "" Then ;ConsoleWrite($retailer & "---" & $split3[3] & @CRLF) If $split3[3] = $retailer Then $rev_retailer = $split3[3] $rev_val = StringLeft($split3[13], (StringLen($split3[13]) - 2)) ExitLoop EndIf Else ;ConsoleWrite($retailer & "-" & $split3[1] & @CRLF) If $split3[1] = $retailer Then $rev_retailer = $split3[1] $rev_val = StringLeft($split3[13], (StringLen($split3[13]) - 2)) ExitLoop EndIf EndIf EndIf Next If $rev_val = "" Then ContinueLoop Else $store_value = $rev_val * $storeweight1 $printer_value = $store_value * $laneweight1 ConsoleWrite($retailer & " | " & $chain & "-" & $store & " | " & "Store Value: " & $store_value & " | " & "Lane: " & $lane & " | " & "Lane Value: " & $printer_value & " | " & "Status: " & $lanestatus & " | " & "StoreWeight: " & $storeweight1 & " | " & "LaneWeight: " & $laneweight1 & " | " & "RetailerVal: " & $rev_val & @CRLF) FileWrite($ROI_output1, $retailer & " | " & $chain & "-" & $store & " | " & $store_value & " | " & $lane & " | " & $printer_value & " | " & $lanestatus & " | " & $storeweight1 & " | " & $laneweight1 & " | " & $rev_val & @CRLF) EndIf EndIf Next Next
  17. Hi guys, I am a fairly new poster and is probably over thinking this. I have 4 arrays, 3 input box and and 1 combo box. The first array is read into the list of the combo box. When the first item in combo box 1 is selected, each of the 3 text box is populated accordingly with the value from index 1 of the different arrays. When the second item in the combo box is selected, it will populate the text boxes with index 2 of the arrays. My question is, how can I do this without hardcoding in the array index number? I have thought about setting a variable to "indexof" array but I was not able to find such thing on autoit. Case $combo_box if GUICtrlRead($combo_box) = $array1[0] Then GUICtrlSetData($inputbox1,$array2[0]) GUICtrlSetData($inputbox2,$array3[0]) GUICtrlSetData($inputbox3,$array4[0]) ElseIf GUICtrlRead($combo_box) = $array1[1] Then GUICtrlSetData($inputbox1,$array2[1]) GUICtrlSetData($inputbox2,$array3[1]) GUICtrlSetData($inputbox3,$array4[1]) Else GUICtrlSetData($inputbox1,$array2[2]) GUICtrlSetData($inputbox2,$array3[2]) GUICtrlSetData($inputbox3,$array4[2]) EndIf
  18. Hello Guys! I wanted to share all my knowledge on arrays! Hope may enjoy the article , Lets start! Declaring arrays! Declaring arrays is a little different than other variables: ; Rules to follow while declaring arrays: ; ; Rule #1: You must have a declarative keyword like Dim/Global/Local before the declaration unless the array is assigned a value from a functions return (Ex: StringSplit) ; Rule #2: You must declare the number of dimensions but not necessarily the size of the dimension if you are gonna assign the values at the time of declaration. #include <Array.au3> Local $aEmptyArray[0] ; Creates an Array with 0 elements (aka an Empty Array). Local $aArrayWithData[1] = ["Data"] _ArrayDisplay($aEmptyArray) _ArrayDisplay($aArrayWithData) That's it Resizing Arrays Its easy! Just like declaring an empty array! ReDim is our friend here: #include <Array.au3> Local $aArrayWithData[1] = ["Data1"] ReDim $aArrayWithData[2] ; Change the number of elements in the array, I have added an extra element! $aArrayWithData[1] = "Data2" _ArrayDisplay($aArrayWithData) Just make sure that you don't use ReDim too often (especially don't use it in loops!), it can slow down you program. Best practice of using "Enum" You might be wondering what they might be... Do you know the Const keyword which you use after Global/Local keyword? Global/Local are declarative keywords which are used to declare variables, of course, you would know that already by now , If you check the documentation for Global/Local there is a optional parameter called Const which willl allow you to "create a constant rather than a variable"... Enum is similar to Const, it declares Integers (ONLY Integers): Global Enum $ZERO, $ONE, $TWO, $THREE, $FOUR, $FIVE, $SIX, $SEVEN, $EIGHT, $NINE ; And so on... ; $ZERO will evaluate to 0 ; $ONE will evaluate to 1 ; You get the idea :P ; Enum is very useful to declare Constants each containing a number (starting from 0) This script will demonstrate the usefulness and neatness of Enums : ; We will create an array which will contain details of the OS Global Enum $ARCH, $TYPE, $LANG, $VERSION, $BUILD, $SERVICE_PACK Global $aOS[6] = [@OSArch, @OSType, @OSLang, @OSVersion, @OSBuild, @OSServicePack] ; Now, if you want to access anything related to the OS, you would do this: ConsoleWrite(@CRLF) ConsoleWrite('+>' & "Architecture: " & $aOS[$ARCH] & @CRLF) ConsoleWrite('+>' & "Type: " & $aOS[$TYPE] & @CRLF) ConsoleWrite('+>' & "Langauge: " & $aOS[$LANG] & @CRLF) ConsoleWrite('+>' & "Version: " & $aOS[$VERSION] & @CRLF) ConsoleWrite('+>' & "Build: " & $aOS[$BUILD] & @CRLF) ConsoleWrite('+>' & "Service Pack: " & $aOS[$SERVICE_PACK] & @CRLF) ConsoleWrite(@CRLF) ; Isn't it cool? XD You can use this in your UDF(s) or Program(s), it will look very neat! Looping through an Array Looping through an array is very easy! . There are 2 ways to loop an array in AutoIt! Simple Way: ; This is a very basic way to loop through an array ; In this way we use a For...In...Next Loop! Global $aArray[2] = ["Foo", "Bar"] ; Create an array ; This loop will loop 2 times because our $aArray contains 2 elements. For $vElement In $aArray ; $vElement will contain the value of the elements in the $aArray... one element at a time. ConsoleWrite($vElement & @CRLF) ; Prints the element out to the console Next ; And that's it! Advanced Way: ; This is an advanced way to loop through an array ; In this way we use a For...To...Next Loop! Global $aArray[2] = ["Foo", "Bar"] ; Create an array ; This loop will loop 2 times because our $aArray contains 2 elements. For $i = 0 To UBound($aArray) - 1 ; $i is automatically created and is set to zero, UBound($aArray) returns the no. of elements in the $aArray. ConsoleWrite($aArray[$i] & @CRLF) ; Prints the element out to the console. Next ; This is the advanced way, we use $i to access the elements! ; And that ends this section! For some reason, many people use the advance way more than the simple way . Interpreting Multi-Dimensional Arrays Yeah, its the most brain squeezing problem for newbies, Imagining an 3D Array... I will explain it in a very simple way for ya, so stop straining you brain now! . This way will work for any array regardless of its dimensions... Ok, Lets start... You can imagine an array as a (data) mine of information: ; Note that: ; Dimension = Level (except the ground level :P) ; Element in a Dimension = Path ; Level 2 ----------\ ; Level 1 -------\ | ; Level 0 ----\ | | ; v v v Local $aArray[2][2][2] ; \-----/ ; | ; v ; Ground Level ; As you can see that $aArray is the Ground Level ; All the elements start after the ground level, i.e from level 0 ; Level 0 Contains 2 different paths ; Level 1 Contains 4 different paths ; Level 2 Contains 8 different paths ; When you want too fill some data in the data mine, ; You can do that like this: $aArray[0][0][0] = 1 $aArray[0][0][1] = 2 $aArray[0][1][0] = 3 $aArray[0][1][1] = 4 $aArray[1][0][0] = 5 $aArray[1][0][1] = 6 $aArray[1][1][0] = 7 $aArray[1][1][1] = 8 ; Don't get confused with the 0s & 1s, Its just tracing the path! ; Try to trace the path of a number with the help of the image! Its super easy! :D I hope you might have understand how an array looks, Mapping your way through is the key in Multi-Dimensional arrays, You take the help of notepad if you want! Don't be shy! Frequently Asked Questions (FAQs) & Their answers Q #1. What are Arrays? A. An Array is an datatype of an variable (AutoIt has many datatypes of variables like "strings", "integers" etc. Array is one of them). An Array can store information in a orderly manner. An Array consist of elements, each element can be considered as a variable (and yes, each element has its own datatype!). AutoIt can handle 16,777,216 elements in an Array, If you have an Array with 16,777,217 elements then AutoIt crashes. Q #2. Help! I get an error while declaring an Array!? A. You tried to declare an array like this: $aArray[1] = ["Data"] That is not the right way, Array is a special datatype, since its elements can be considered as individual variables you must have an declarative keyword like Dim/Global/Local before the declaration, So this would work: Local $aArray[1] = ["Data"] Q #3. How can I calculate the no. of elements in an array? A. The UBound function is your answer, Its what exactly does! If you have an multi-dimensional Array you can calculate the total no. of elements in that dimension by specifying the dimension in the second parameter of UBound Q #4. Why is my For...Next loop throwing an error while processing an Array? A. You might have done something like this: #include <MsgBoxConstants.au3> Local $aArray[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Local $iMyNumber = 0 For $i = 0 To UBound($aArray) ; Concentrate here! $iMyNumber += $aArray[$i] Next MsgBox($MB_OK, "Sum of all Numbers!", $iMyNumber) Did you notice the mistake? UBound returns the no. of elements in an array with the index starting from 1! That's right, you need to remove 1 from the total no. of elements in order to process the array because the index of an array starts with 0! So append a simple - 1 to the statment: #include <MsgBoxConstants.au3> Local $aArray[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Local $iMyNumber = 0 For $i = 0 To UBound($aArray) - 1 $iMyNumber += $aArray[$i] Next MsgBox($MB_OK, "Sum of all Numbers!", $iMyNumber) Q #5. Can an Array contain an Array? How do I access an Array within an Array? A. Yes! It is possible that an Array can contain another Array! Here is an example of an Array within an Array: ; An Array can contain another Array in one of its elements ; Let me show you an example of what I mean ;) #include <Array.au3> Global $aArray[2] $aArray[0] = "Foo" Global $aChildArray[1] = ["Bar"] $aArray[1] = $aChildArray _ArrayDisplay($aArray) ; Did you see that!? The 2nd element is an {Array} :O ; But how do we access it??? ; You almost guessed it, like this: ; Just envolope the element which contains the {Array} (as shown in _ArrayDisplay) with brackets (or parentheses)! :D ConsoleWrite(($aArray[1])[0]) ; NOTE the brackets () around $aArray[1]!!! They are required or you would get an syntax error! ; So this: $aArray[1][0] wont work! More FAQs coming soon!
  19. Hi everyone, I have an array which is populated among results found with the AD UDF. So there can be hundreds of results. This array is output in a txt file in order to read the lines: Here's some lines: 307|3| USERID|CN=XXXX,OU=Users,OU=SITE,OU=Brazil,OU=LA,DC=XXXX,DC=XXXX|NAME, FIRST NAME XXXX|CN=XXXX,OU=Users,OU=XXXX,OU=Mexico,OU=LA,DC=XXXX,DC=XXXX|XXXX XXXX XXXX|CN=XXXX,OU=Users,OU=XXXX,OU=Argentina,OU=LA,DC=XXXX,DC=XXXX|XXXX XXXXThe first value is the number of returned results; the second one is the number of rows of the array. The file will always be outputted like the "code" above. What I would like to achieve is to put all results in a listbox looking like the "windows explorer". I mean that it would contain 5 row that can be sorted by the "headers" (I've uploaded a photo to better explain). Also, I'd like to have the possibility to double click on a line where the value in the "User ID" would be stored in a variable (for further treatment but I know what to do with it ^^) I know this can be a "huge" request but I've no idea where to start or how to achieve it. Thanks in advance to all that can offer help, I'm sure my knowledge will grow Bye
  20. Combining Arrays

    I'm hoping someone here can shed some light on a problem I've been having combining some arrays. I've searched the forum and found some posts but I'm still having troubles My goal is to have an array that I can display with 3 seperate columns, I'd actually be happy with anyway to get 3 arrays on a table. I have a MySQL server that I am pulling 3 different fields from "firstname", "lastname" and "phone" and I can pull the data without any problems, it's just combining them. Here is what I have currently code wise. It's not very pretty but it works... #include "mysql.au3" #include "array.au3" $sql = _MySQLConnect('username','password','table','TestSystem') $row = _Query($sql, "SELECT * FROM fax") Global $aArray Global $sFill Global $aArray_Base [1] [3] $aArray = $aArray_Base Global $aArray2 Global $sFill2 Global $aArray_Base2 [1] [3] $aArray2 = $aArray_Base2 Global $aArray3 Global $sFill3 Global $aArray_Base3 [1] [3] $aArray3 = $aArray_Base3 with $row While NOT .EOF Global $FirstName = .Fields("firstname").value Global $LastName = .Fields("lastname").value Global $FaxNumber = .Fields("faxnumber").value $sFill = $FirstName $sFill2 = $LastName $sFill3 = $FaxNumber _ArrayAdd($aArray, $sFill) _ArrayAdd($aArray2, $sFill2) _ArrayAdd($aArray3, $sFill3) .MoveNext ;MsgBox(0,"TEST",$FirstName &" " & $LastName & " " & $FaxNumber) WEnd EndWith _ArrayDisplay($aArray, "Test Array") _ArrayDisplay($aArray2, "Test Array") _MySQLEnd($sql) Thank you for taking the time to look at my code/problem.
  21. Hello! I am currently facing a problem which I can't seem to be able to solve. What do I want to do with the script ? Extract all the links of the hotels on this website: http://www.yelp.de/search?cflt=hotels&find_loc=Berlin%2C+Germany For example the first link to the first hotel would be: http://www.yelp.de/biz/novum-hotel-city-b-berlin-zentrum-berlin - changes sometimes, so the link will be different. To start off, I tried to export only one hotel at first. I am using this code to read the content from the source and then get the content between two "functions" or whatever these are called: #NoTrayIcon #include <Inet.au3> #include <Array.au3> #include <String.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Global $url = "http://www.yelp.de/search?find_desc=Hotels&find_loc=Berlin&ns=1" Global $content = _INetGetSource($url) Global $string_A = _StringBetween($content, '<div class="media-avatar">', '</div>') MsgBox(0,"",$string_A[0]) It's part of an older project, which did almost the same thing, with the exeption that this one is not as easy The link is saved differently, and I can't find a way to export it. After it's saved into an array, I am going to save the links into a variable with a do - until function. But first I need this step working. Please, if anyone has an idea how to solve this, even the smallest help is appreciated!
  22. Hey, first off, thanks to everyone on this forum who has helped me out yet. I wouldnt have made it this far in such a short time, as I am a beginner. Now this is my last problem: (Well it's not rlly a problem as I could run both seperately, but I would like to create one script. Here is the first script: #NoTrayIcon #include <Inet.au3> #include <Array.au3> #include <String.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Global $url = InputBox("ScoutID","Please enter the Scout-ID (URL)") If StringInStr($url,"http://www.immobilienscout24.de/") = false Then MsgBox(48,"Error","URL not specified. Please make sure you enter the URL !") Exit Else EndIf Global $content = _INetGetSource($url) Global $string_A = _StringBetween($content, '<li data-item="result" data-obid=', 'id="result') $number =UBound ( $string_A ,$UBOUND_ROWS) $timesran = -1 $i=0 $numberarray = $number $numberarray -= 1 Do $i += 1 $timesran += 1 If $timesran = $numberarray = True Then Exit Else EndIf $id= StringReplace($string_A[$timesran],'"',"") $urlscout = "http://www.immobilienscout24.de/expose/"&$id export () Until $i = $numberarray func export () $url = $urlscout If StringInStr($url,"http://www.immobilienscout24.de/expose") = false Then MsgBox(48,"Error","URL not specified. Please make sure you enter the URL !") Exit Else EndIf If FileExists("Immobilien.csv") =false Then FileWrite("Immobilien.csv","Name;Adresse;Telefon;Objekttyp;Ort;Baujahr;Zimmer;Bezugfrei ab;Wfl./ qm;Kaltmiete;Warmmiete;Scout- ID"& @CRLF) EndIf $content = _INetGetSource($url) $name_A = _StringBetween($content, '<span data-qa="contactName" class="font-bold">', '</span>') $preis_A = _StringBetween($content, '<span class="is24-operator">', '<div class="sourcecode section">') $strase_A = _StringBetween($content, '<strong class="font-standard">' , '</strong><br/>') $telefon_A = _StringBetween($content, '<div class="is24-phone-number hide">' ,'</div>') $objekttyp_A = _StringBetween($content, '<dd class="is24qa-wohnungstyp">' ,'</dd>') $ort_A = _StringBetween($content, '<span id="quickCheckHeader" class="is24-f">' , '</span>') $baujahr_A = _StringBetween($content, '<dd class="is24qa-baujahr">','</dd>') $zimmer_A = _StringBetween($content, '<dd class="is24qa-zimmer">','</dd>') $bezugsfrei_A = _StringBetween($content, '<dd class="is24qa-bezugsfrei-ab">' ,'</dd>') $wohnflache_A = _StringBetween($content, '<dd class="is24qa-wohnflaeche-ca">' ,'</dd>') $preiswarm_A =_StringBetween($content, '<strong class="is24qa-gesamtmiete">','</strong>') If IsArray($strase_A) Then $strase_B = $strase_A[0] Else $strase_B = "/" EndIf If IsArray($name_A) Then $name_B = $name_A[0] Else $name_B = "/" EndIf If IsArray($telefon_A) Then $telefon_B = $telefon_A[0] Else $telefon_B = "/" EndIf If IsArray($objekttyp_A) Then $objekttyp_B = $objekttyp_A[0] Else $objekttyp_B = "/" EndIf If IsArray($baujahr_A) Then $baujahr_B = $baujahr_A[0] Else $baujahr_B = "/" EndIf If IsArray($preiswarm_A) Then $preiswarm_B = $preiswarm_A[0] $preiswarm_C = StringReplace($preiswarm_B , "disabled","") $preiswarm_D = StringReplace($preiswarm_C, "disabled","",1) ;caused some bugs $preiswarm_E = StringReplace($preiswarm_D, "disabled","") Else $preiswarm_B = "/" EndIf If IsArray($zimmer_A) Then $zimmer_B = $zimmer_A[0] $zimmer_C = StringReplace($zimmer_B , ".",",") Else $zimmer_B = "/" EndIf If IsArray($ort_A) Then $ort_B = $ort_A[0] Else $ort_B = "/" EndIf If IsArray($bezugsfrei_A) Then $bezugsfrei_B = $bezugsfrei_A[0] Else $bezugsfrei_B = "/" EndIf If IsArray($wohnflache_A) Then $wohnflache_B = $wohnflache_A[0] Else $wohnflache_B = "/" EndIf If IsArray($preis_A) Then $preis_B = $preis_A[0] Else $preis_B = "/" EndIf $aio= $name_B&";"&$strase_B&";"&$telefon_B&";"&$objekttyp_B&";"&$ort_B&";"&$baujahr_B&";"&$zimmer_C&";"&$bezugsfrei_B&";"&$wohnflache_B&";"&$preis_B&";"&$preiswarm_E&";"&$url $sString1 = StringReplace($aio, " ", "") $sString2 = StringReplace($sString1, "<p>", "") $sString3 = StringReplace($sString2, "<span>", "") $sString4 = StringReplace($sString3, "</p>", "") $sString5 = StringReplace($sString4, "Â", "") $sString6 = StringReplace($sString5, '<span class="is24-operator">=</span>', "") ;Filtering the given Data to get a proper CSV Format $sString7 = StringReplace($sString6, "EUR", "") $sString8 = StringReplace($sString7, "</span>","") $sString9 = StringReplace($sString8, "Dieses Objekt im Vergleich zu anderen in ","") $sString10 = StringReplace($sString9, "disabled",",00") ;caused bug $sString11 = StringReplace($sString10, "ü","ü") $sString12 = StringReplace($sString11, "ß","ß") ;Including special characters lower case $sString13 = StringReplace($sString12, "ä","ä") $sString14 = StringReplace($sString13, "ö","ö") $sString15 = StringReplace($sString14, "Ãœ","Ü") ;Including special characters upper case $sString16 = StringReplace($sString15, "Ä","Ä") $sString17 = StringReplace($sString16, "Ö","Ö") $sStringfinal = StringReplace($sString17, @CRLF, "") FileWrite ( "Immobilien.csv", $sStringfinal & @CRLF ) ToolTip("Importing...", 0, 0) Sleep(100) endfunc This script works perfectly fine to extract ALL the data from one page which looks like this : http://www.immobilienscout24.de/Suche/S-T/Wohnung-Miete/Bayern/Muenchen/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/true?enteredFrom=result_list (The export function downloads all data from each object on the side into a cvs file.) BUT this is just one of 19 pages, so I made this script which counts the pages and then in a loop sets $currenturl always +1 until $currenturl and the total pages (19) match and then exits. #NoTrayIcon #include <Inet.au3> #include <Array.au3> #include <String.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Global $url = InputBox("ScoutID","Please enter the Scout-ID (URL)") If StringInStr($url,"http://www.immobilienscout24.de/") = false Then MsgBox(48,"Error","URL not specified. Please make sure you enter the URL !") Exit Else EndIf Global $content1 = _INetGetSource($url) Global $pagecount = _StringBetween($content1, '<li><span>&hellip;</span></li>', '<span class="smallPager">') $filtered = StringRegExp($pagecount[0],"\d{2}",$STR_REGEXPARRAYMATCH) $link0 = StringReplace($url,"http://www.immobilienscout24.de/Suche/S-T/","") $link1 = StringReplace($url,$link0,"") $link2 = "/" & $link0 $pages = $filtered[0] ; 19 in the example $currentpage = 0 Do $currentpage +=1 $currenturl = $link1 & "p-" & $currentpage & $link2 MsgBox(0,"",$currenturl) Until $pages = $currentpage Now my question is, if there is anyway to implent the second into the first script to work the following way: 1.) Basically run the second script to generate the first $currenturl 2.) Run the first script to grab all data from $currenturl 3.) The second script "prints" the second $currenturl 4.) The first script again grabs all data from $currenturl .... 5.) Until $currenturl = $filtered ($filtered = total amount of pages) I tried my best to explain it as good as possible, even tho its complicated to get what I mean... THANKS IN ADVANCE! & best regards, Andrewz
  23. I am having trouble understanding why the following code does not work. THe way it is now, with this line commented out... ;$iRval = _EzMySql_GetTable2d($sSQL ...it works fine and populates the excel spreadsheet with the heading rows "System Impact" etc. However, if I uncomment out the line I mention above, nothing goes to the Excel spreadsheet. Where I have the messagebox reporting the value of Ubound on the array (for debugging purposes) it returns the correct value, i.e. the number of rows the sql has returned. I have also included a screen snap of the array display, showing that the array does indeed contain data. Here is the function Func _Excel_Xport() local $cntr,$wf,$tempresult,$iSval,$iRval[10][10] local $sFilePath = @TempDir & "\Temp.xls" local $oExcel = _Excel_Open() If Not _FileCreate($sFilePath) Then MsgBox(4096, "Error", " Error Creating File - " & @error & " - " & @extended) return 1 EndIf $oExcel = _Excel_BookOpen($oExcel,$sFilePath, Default, Default, True) if $oExcel = 0 Then MsgBox(0,"Error",@error) Return EndIf $oExcel = _Excel_BookAttach("Microsoft Excel - Temp.xls","Title") if $oExcel = 0 Then MsgBox(0,"Error","Unable to attach to spreadsheet") Return EndIf for $cntr = 1 to 8 if GUICtrlRead($r_[$cntr]) = 1 Then Switch $cntr Case 1 $wf="%" Case 2 $wf="%5" Case 3 $wf="1_0" Case 4 $wf=20 Case 5 $wf=30 Case 6 $wf=40 Case 7 $wf=50 Case 8 $wf=3 EndSwitch ExitLoop EndIf next $sSQL="SELECT * FROM rfc_manager.tbl_RFC WHERE RFC_Workflow_Status LIKE """ & $wf & """ AND RFC_Workflow_Status <> ""9999"";" ;$iRval = _EzMySql_GetTable2d($sSQL) $error = @error msgbox(0,"test",Ubound($iRval)) $iRval[0][0]="Test" if uBound($iRval)=1 Then MsgBox(0, $sSQL & " error", $error) ReDim $iRval[UBound($iRval)][26] ; Add a few columns to the array $iRval[0][13]="System Impact" $iRval[0][14]="Tech Est Hours" $iRval[0][15]="Tech Quoted Hours" $iRval[0][16]="Func Est Hours" $iRval[0][17]="Func Quoted Hours" $iRval[0][18]="Admin Est Hours" $iRval[0][19]="Admin Quoted Hours" $iRval[0][20]="Payment Method" $iRval[0][21]="PO Number" $iRval[0][22]="CAB Priority" $iRval[0][23]="CAB Notes" $iRval[0][24]="Vendor Notes" $iRval[0][25]="Reason Notes" _ArrayDisplay($iRval) $iSval = _Excel_RangeWrite($oExcel,$oExcel.Activesheet, $iRval) if $iSval = 0 Then msgbox(0,"Error",@error) EndFunc And here is the array displayed <a href="http://s111.photobucket.com/user/wongdai/media/array_display_zps9832c577.jpg.html" target="_blank"><img src="'>" border="0" alt=" photo array_display_zps9832c577.jpg"/></a> I hope I have explained this clearly enough
  24. I am trying to make a map with little 16x16 rects for each 'coordinate'. Now I have the map size already set in a two dimensional array, and another array that will hold the GUI Graphic ID so I can loop through them and tell whether one was clicked or not (If it was clicked then change the graphic color and set ANOTHER two dimensional array value at the position of the map coordinate). But besides that I can't seem to get past this "Array badly formatted error"... My code: ;----INCLUDES----; #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <array.au3> Global Const $mapX = 51 Global Const $mapY = 31 Global Const $IMGX = 16 Global Const $IMGY = 16 Global $labryinthMap[$mapY,$mapX] ;Our maze Global $GUID[$mapY,$mapX] ;Holds each GUI graphic ID so we can check if it was clicked Global $posX = 16 Global $posY = 16 GUICreate("Labyrinth", 900, 900) Local $y, $x for $y = 0 To $mapY $posX = $IMGX ;Reset posX to start position $posY += $IMGY ;Increase Y axis by 16 (img size) for $x = 0 To $mapX $GUID[$y,$x] = GUICtrlCreateGraphic($posX, $posY, $IMGX, $IMGY) GUICtrlSetGraphic( $GUID[$y,$x], $GUI_GR_RECT, $posX, $posY, $posX + 16, $posY + 16) Next MsgBox(0, "", "Row " & $y & " complete.") Next Local $msg GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd On a side note, how do I draw a rect in a certain color? I didn't see any values to set in GUICtrlSetGraphic for the color. Thanks.
  25. _ArrayConcatenate2D

    NOTICE: The most current update contains script-breaking changes! The function now works exactly like _ArrayConcatenate. It does not return a value, but sets the parent array as the concatenated array. I know there's examples of this, but I thought I share this one with you. It's fully commented to aid those learning the language. Supports vertical and horizontal merging. There's minimal explicit variables by design. Not very elegant, but it works. One advantage this method has is zero dependencies. The dependencies in the download are for the example. EDIT: Updated script to UDF standards. EDIT2: Converted to ByRef and Const ByRef parameters (script breaking change!) Array2DConcat.au3 Previous versions: Examples in next post. Script above contains examples. -cb
×