Jump to content

Recommended Posts

Posted (edited)

Hello Guys,

i've got a Problem, which i wasn't able to solve by myself. I got a Task with data from an Array. in my Skript I then have to find the values of the Array by search with some "key".

I did some convenient example Skript to make myself clear

Local $testarray[2]= ["P4.SitePage1.TarifLine3Minutes","P4.SitePage1.StandortTarifLine3"]
_ArrayDisplay($testarray)
$i = _ArraySearch($testarray,'P4.SitePage1.StandortTarifLine3',0,0,0,3,1,1,False)
ConsoleWrite($i)
ConsoleWrite(@error)

What i'm trying to achieve is: find the exact match of the "...StandortTarifLine3" (index 2) but the Skript only finds the "...StandortTarifLine3Minutes" (index1) which Comes first in the Array. I don't have Access to Change the Key values.

Is there some way to make ArraySearch search the exact term?

I tried solving it with this post, but wasn't able to do it though.

Local $testarray[2]= ["P4.SitePage1.TarifLine3Minutes","P4.SitePage1.StandortTarifLine3"]
_ArrayDisplay($testarray)
$i = _ArraySearch($testarray,'(^|,\h*)(P4.SitePage1.StandortTarifLine3)(,|$)',0,0,0,3,1,1,False)
ConsoleWrite($i)
ConsoleWrite(@error)

Thanks for any advice

Best Julia

 

Edited by Julia_Muc
grammar changes
Posted (edited)

If i had to bet, i'd bet the regex had a problem, but i dont know regex so..

Scratch that, My test here resulted in 1. so Its correct.

1 is the

P4.SitePage1.StandortTarifLine3
Edited by careca
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Since you have 2 arrays in there you can just search them by their corresponding numbers, if you read the tutorial about arrays you should know that array starts with 0 to 1, if you want to display the exact array, which is the second one, if that's the question, then


This is $testarray[0]

P4.SitePage1.TarifLine3Minutes

This is $testarray[1]
 

P4.SitePage1.StandortTarifLine3

If you want it to find that just search for it like
 

$i = _ArraySearch($testarray[1],'P4.SitePage1.StandortTarifLine3',0,0,0,3,1,1,False)

I don't know why your method if doing that is this way but I use different method,
 

if isArray($testarray[1]) then
;do something
;Do something
EndIf

Could also work if you are just looking for that exact array.

Posted
  On 12/19/2017 at 1:54 PM, careca said:

If i had to bet, i'd bet the regex had a problem, but i dont know regex so..

Scratch that, My test here resulted in 1. so Its correct.

1 is the

P4.SitePage1.StandortTarifLine3
Expand  

totally confused over here. i just mixed up the numbers. Normally i know that it's 0 &1 and not 1&2 as index of the Array.  *facepalm*

 

So Sorry for that, Problem (which apparently wasn't even one) solved

Posted
  On 12/19/2017 at 2:04 PM, Julia_Muc said:

totally confused over here. i just mixed up the numbers. Normally i know that it's 0 &1 and not 1&2 as index of the Array.  *facepalm*

 

So Sorry for that, Problem (which apparently wasn't even one) solved

Expand  

Never need to apologize for asking help! No one got hurt and people can use the time to learn as well from reading this, hope everything goes well, good luck.

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
  • Recently Browsing   0 members

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