Julia_Muc Posted December 19, 2017 Share Posted December 19, 2017 (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 December 19, 2017 by Julia_Muc grammar changes Link to comment Share on other sites More sharing options...
careca Posted December 19, 2017 Share Posted December 19, 2017 (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 December 19, 2017 by careca Julia_Muc 1 Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
RoundChecker Posted December 19, 2017 Share Posted December 19, 2017 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. careca 1 Link to comment Share on other sites More sharing options...
Julia_Muc Posted December 19, 2017 Author Share Posted December 19, 2017 7 minutes ago, 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 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 Earthshine 1 Link to comment Share on other sites More sharing options...
RoundChecker Posted December 19, 2017 Share Posted December 19, 2017 Quote should know that array starts with 0 to 1 ^ In your example, it starts with 0, then 1, cause you have 2 arrays, if you have 3, then it would be 0, 1, 2 . . and so on. Link to comment Share on other sites More sharing options...
RoundChecker Posted December 19, 2017 Share Posted December 19, 2017 1 minute ago, 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 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. 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