Jump to content

Array.au3 error, Excel.au3 error, or my code error.


Recommended Posts

Hey the following does not return "Yes" when it is true if $Lower is set with a 0 at the end.

Ex $Lower = "Apple10" or "Apple20" or "Apple30"

The range includes all of these. 19 is true, 21 is true, but not 20 . . .

Am leaning toward excel dropping the 0 as a format. -but its text, right?

#include <Array.au3>
#include <Excel.au3>
$UserName = "Test"
$oExcel = _ExcelBookNew(1)

For $i = 1 to 35 
_ExcelRowInsert($oExcel, 1, 1)
_ExcelWriteCell($oExcel, "<Subset><" & $UserName & "><" & "Apple" & $i & ">", 1, 1)
Next
$Lower = "Apple1"

$avArray = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 1)
_ArrayDisplay($avArray)

$iIndex = _ArraySearch($avArray, StringRegExp('(?i)' & $Lower & '(?i)', 0))

If Not @error Then                                                                  
ConsoleWrite("Yes") ;Should be
Else
ConsoleWrite("No")
EndIf

Edit: The error was mine (shocked) :-)

Worked around by breaking into three different column . . . not the best but . . .

Edited by Hatcheda
Link to comment
Share on other sites

  • Developers

What should this func do : StringRegExp('(?i)' & $Lower & '(?i)', 0) ?

That returns 0 or 1 and shouldn't be used in _ArraySearch()

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

What should this func do : StringRegExp('(?i)' & $Lower & '(?i)', 0) ?

That returns 0 or 1 and shouldn't be used in _ArraySearch()

Cell entry format:

<first><Second><third>

<First> is entry type

<Second> is who wrote it

<Third> is what it is

I need to search a sheet and find if any cell in column 1 contains the value of $lower

I will also later need to know who wrote it and what type of entry it is.

That funtion came from this . . . which I wrote first

$sString = "<Subset><David><Planet>"

$array = StringRegExp($sString, '<(?i)(.*?)(?i)>', 3)

$array[2]

I can see now that the first post was a little silly, but am still at a loss for the answer.

Basically I need to check that page for the value of $lower but that value only exsists once th format has been parsed and set to $array[2]

Any Help?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...