Jump to content
Colduction

[SOLVED] combine Arrays respectively

Recommended Posts

Posted (edited)

Hi dear friends!, i'm sorry for creating a new thread (a new problem), i have over than 9 lists that i want to combine them to be this (in this example, there are 3 test files):

TEST.png.6ef3c654296a307d4200527624c38fb1.thumb.png.baa22b5dc305653db6836279fbe726c5.png

I've written a little code for splitting main information, but i really confused how to make results as "Output.txt", here is that code:
 

$sRegex_1 = StringRegExp(FileRead("1.txt"), '(?s:(?<=\=\=\r\n)(.*?)(?=\r\n\=\=))', 3)
$sRegex_2 = StringRegExp(FileRead("2.txt"), '(?s:(?<=\=\=\r\n)(.*?)(?=\r\n\=\=))', 3)
$sRegex_3 = StringRegExp(FileRead("3.txt"), '(?s:(?<=\=\=\r\n)(.*?)(?=\r\n\=\=))', 3)

For $i = 0 To UBound($sRegex_1) - 1
    ConsoleWrite($sRegex_1[$i] & @CRLF)
    For $j = 0 To UBound($sRegex_2) - 1
        ConsoleWrite($sRegex_2[$j] & @CRLF)
        For $k = 0 To UBound($sRegex_3) - 1
            ConsoleWrite($sRegex_3[$k] & @CRLF)
        Next
    Next
Next

 

Edited by Colduction

I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites

You could have posted sample input files instead of an image, that would have saved time.

Local $s = FileRead("1.txt") & @CRLF & FileRead("2.txt") & @CRLF & FileRead("3.txt")
$s = StringRegExpReplace($s, "==\R", "", 2)
Local $a = StringRegExp($s, "(?:\d+\w+\R){2}[-=]{2}\R?", 3)
_ArraySort($a)
Local $sOut = _ArrayToString($a, "", -1, -1, "")
ConsoleWrite($sOut & @LF)

If you have decimal parts > 9 then use a version of _ArraySort which allows numerical sort. Lots of examples already posted.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
11 hours ago, jchd said:

You could have posted sample input files instead of an image

Here you are:

1.txt

2.txt

3.txt

11 hours ago, jchd said:

If you have decimal parts > 9 then use a version of _ArraySort which allows numerical sort. Lots of examples already posted.

In fact, i didn't show main information because it's private, but totally data forms are as showed examples (important datas are between ==)


I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites

Now there is no numeric prefix in the data ... a moving target?

Local $s = FileRead("1.txt") & @CRLF & FileRead("2.txt") & @CRLF & FileRead("3.txt")
$s = StringRegExpReplace($s, "==\R", "", 2)
Local $a = StringRegExp($s, "(?:\w+\R){2}==\R?", 3)
_ArraySort($a)
Local $sOut = _ArrayToString($a, "", -1, -1, "")
ConsoleWrite($sOut & @LF)

Does that fit your bill?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Posted (edited)
2 minutes ago, jchd said:

Does that fit your bill?

No, it was not useful :(

image.thumb.png.28d95cf5bac6f3422c39b0145298671f.png

(there is no numeric prefix in the data ... a moving target?) Unforyunately, No :(

Edited by Colduction

I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites

Please stop posting images, it's very painful to the eye.

Are you sure the files exist in the current working directory?

Because this works for me:

>Running:(3.3.15.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\...\t.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
aa
aa
==
bb
bb
==
bb
bb
==
bb
bb
==
cc
cc
==
+>15:18:23 AutoIt3.exe ended.rc:0
+>15:18:23 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 1.359

 


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Posted (edited)
10 minutes ago, jchd said:

Please stop posting images, it's very painful to the eye.

Sorry, i just wanted to show you what happend.

10 minutes ago, jchd said:

Are you sure the files exist in the current working directory?

Yes!

10 minutes ago, jchd said:

aa aa == bb bb == bb bb == bb bb == cc cc ==

This is not the result that i want, are you decreased some texts in sample files? the output should be this:

Output.txt

Edited by Colduction

I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites
4 hours ago, Colduction said:

are you decreased some texts in sample files?

I copied the sample text files you provided yourself. That is:
1.txt

==
aa
aa
==
aa
aa
==

2.txt
 

==
bb
bb
==
bb
bb
==
bb
bb
==

3.txt
 

==
cc
cc
==

Using the code below, I get:
 

Local $s = FileRead("1.txt") & @CRLF & FileRead("2.txt") & @CRLF & FileRead("3.txt")
Local $a = StringRegExp($s, "==\R(?:\w+\R){2}\R?", 3)
_ArraySort($a)
Local $sOut = _ArrayToString($a, "", -1, -1, "") & "=="
ConsoleWrite($sOut & @LF)


Result:
==
aa
aa
==
aa
aa
==
bb
bb
==
bb
bb
==
bb
bb
==
cc
cc
==

I don't understand why you expect extra entries to get in the way and where the numbers come from.

Can you explain the wanted logic in plain details?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
2 hours ago, jchd said:

Can you explain the wanted logic in plain details?

I have changed image of topic and i have added some tips to understand:
https://www.autoitscript.com/forum/topic/203289-combine-two-arrays-respectively/


I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites

I post (again) my last code which, given the data in the first post provides you with the result you expect in your last post.

Local $s = FileRead("1.txt") & @CRLF & FileRead("2.txt") & @CRLF & FileRead("3.txt")
Local $a = StringRegExp($s, "==\R(?:\w+\R){2}\R?", 3)
_ArraySort($a)
Local $sOut = _ArrayToString($a, "", -1, -1, "") & "=="
ConsoleWrite($sOut & @LF)

This is my last try to catch the butterfly.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
10 hours ago, jchd said:

This is my last try to catch the butterfly.

Thanks for your care.
But i should think about arrays overflows, if first array completed and second array not completed, then continue second array.


I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites
1 hour ago, Colduction said:

But i should think about arrays overflows, if first array completed and second array not completed, then continue second array.

Which "array overflow"?  You concatenate input files, split the result in an 1D array, sort it then glue entries together to build output.
AutoIt arrays can hold 16 million entries. Do you expect your files to contain more than that?

What does "array completed" means.

Aren't you happy with the result provided by my last code?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
15 hours ago, jchd said:

Which "array overflow"?  You concatenate input files, split the result in an 1D array, sort it then glue entries together to build output.
AutoIt arrays can hold 16 million entries. Do you expect your files to contain more than that?

No, i don't mean that, for example i have an array with 2 row and i have to get data via loop, but in this loop i inserted another array with 3 rows, when first array's loop completed, remains 1 row from second array that will not be showed, this is what I mean by overflow and this is my main problem in this thread! RESPECTIVELY AND PERIODIC.

15 hours ago, jchd said:

Aren't you happy with the result provided by my last code?

Sorry sir, no, but thanks for your reply.
I hope that this problem will be solved :(


I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites

My friend @jchd, I want to be this:

1.txt:
 

==
xy
xy
==

2.txt:
 

==
ab
ab
==
ab
ab
==

3.txt:
 

==
cd
cd
==


The output file that i desired, is this:
OUTPUT.txt:
 

==
xy
xy
==
ab
ab
==
cd
cd
==
ab
ab

 


I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites

Like this ? :

#include <Array.au3>
#include <String.au3>


$one = _StrToArr(FileRead("1.txt"))
$two = _StrToArr(FileRead("2.txt"))
$tre = _StrToArr(FileRead("3.txt"))

$end = False

$max1 = UBound($one) / 2
$max2 = UBound($two) / 2
$max3 = UBound($tre) / 2

$max = $max1
If $max2 > $max Then $max = $max2
If $max2 > $max Then $max = $max3

cw("==")
For $x = 0 To $max

    If $x < $max1 Then
        cw($one[($x * 2)])
        cw($one[($x * 2) + 1])
        cw("==")
    EndIf

    If $x < $max2 Then
        cw($two[($x * 2)])
        cw($two[($x * 2) + 1])
        cw("==")
    EndIf

    If $x < $max3 Then
        cw($tre[($x * 2)])
        cw($tre[($x * 2) + 1])
        cw("==")
    EndIf
Next

Func cw($txt)
    ConsoleWrite($txt & @CRLF)
EndFunc   ;==>cw

Func _StrToArr($s)
    Local $a = _StringBetween($s, @CRLF, @CRLF)
    For $x = UBound($a) - 1 To 0 Step -1
        If $a[$x] = "==" Then _ArrayDelete($a, $x)
    Next
    Return $a
EndFunc   ;==>_StrToArr

 


~Dan~ :Emu.Zone now with Desktop Pets / DeskMates - (Bugfixed UniScrMate 4.1)

Share this post


Link to post
Share on other sites
23 minutes ago, Dan_555 said:

Like this ? :

Thanks @Dan_555, i don't know how thank you!

SOLVED!


I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites

Jeez, I now see what you want.  The first problem is that you never explained yourself clearly, and your first example matches what would result from a sort, once elements are split out.

Another skin for that cat, provided the files have the correct format:

Local $iNbFiles = 3
Local $aFiles[$iNbFiles][3] = [["1.txt"], ["2.txt"], ["3.txt"]]

Local Static $iMax = 0
For $i = 0 To UBound($aFiles) - 1
    $aFiles[$i][1] = StringRegExp(FileRead($aFiles[$i][0]), "==\R(?:.+\R){2}", 3)
    $aFiles[$i][2] = UBound($aFiles[$i][1])
    $iMax = _Max($iMax, UBound($aFiles[$i][1]))
Next

Local $sOut, $a
For $i = 0 To $iMax - 1
    For $j = 0 To UBound($aFiles) - 1
        If $i < $aFiles[$j][2] Then $sOut &= ($aFiles[$j][1])[$i]
    Next
Next
$sOut &= "=="

ConsoleWrite($sOut & @LF)

Next time, please, make the minimum effort to fully and clearly explain what you want.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
13 hours ago, jchd said:

The first problem is that you never explained yourself clearly

Yes, i didn't know how to clearing for you to understand what i want! :sweating:

13 hours ago, jchd said:

Next time, please, make the minimum effort to fully and clearly explain what you want.

Roger that!:D:sweating:
At last, i want to say thanks for giving your time on my project!


I recommend to you to get COVID-19, but don't get Wife

Share this post


Link to post
Share on other sites

Another example for your amusement.

#include <Array.au3>

Local $aFiles[][2] = [["1.txt"], ["2.txt"], ["3.txt"]]
Local $iMNCols = 0 ; Maximum Number of Columns (MNC)
Local $sStr = "" ;   This string will be converted into 2D array.

; Files to abbreviated strings
For $i = 0 To UBound($aFiles) - 1
    $aFiles[$i][1] = StringRegExpReplace(FileRead($aFiles[$i][0]), '(?:=+\R)?(\w+)[^=]+(?:=+\R?)?', "\1|") ; De-construct file format.
    StringReplace($aFiles[$i][1], "|", "|")
    $iExt = @extended ;                                @extended contains number of replacements in StringReplace() function.
    $iMNCols = ($iExt > $iMNCols ? $iExt : $iMNCols) ; Get Maximum Number of Columns
Next

; String to 2D array
For $i = 0 To UBound($aFiles) - 1
    $sStr &= StringTrimRight($aFiles[$i][1], 1) & @CRLF ; StringTrimRight() removes trailing "|" .
Next
Local $aData[0][$iMNCols]
_ArrayAdd($aData, StringStripWS($sStr, 2)) ; Append the three rows into the $aData array with $iMNCols number of columns.
_ArrayTranspose($aData) ; Now array has $iMNCols number of rows, with three columns.
;_ArrayDisplay($aData, "", "", 0, Default, "1.txt|2.txt|3.txt")

; 2D array to file re-constructed string with numbers
Local $sRet = "==" & @CRLF
Local $r = 1 ; Counter
For $j = 0 To UBound($aData) - 1
    For $i = 0 To UBound($aData, 2) - 1
        If $aData[$j][$i] <> "" Then
            $sRet &= $r & $aData[$j][$i] & @CRLF & $r & $aData[$j][$i] & @CRLF & "==" & @CRLF
        EndIf
    Next
    $r += 1 ; Increment $r
Next

ConsoleWrite(StringStripWS($sRet, 2) & @CRLF) ; Parameter flag (2) = strip trailing white spaces (@CRLF).

Used the following files with the resultant output.

1.txt:
==
aa
aa
==
aa
aa
==

2.txt:
==
bb
bb
==
bb
bb
==
bb
bb
==
bb
bb
==
bb
bb
==
bb
bb
==

3.txt:
==
cc
cc
==
cc
cc
==
cc
cc
==
cc
cc
==

OUTPUT.txt:
==
1aa
1aa
==
1bb
1bb
==
1cc
1cc
==
2aa
2aa
==
2bb
2bb
==
2cc
2cc
==
3bb
3bb
==
3cc
3cc
==
4bb
4bb
==
4cc
4cc
==
5bb
5bb
==
6bb
6bb
==

 

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By nacerbaaziz
      hello evrybody
      here is an example about how to split your texts using a delimiter with the ability to select how much of delimiters shows in each colum  with $i_number
      e.g
      you have a long text and you want to split it in an array
      that evry colum have a number (n) of lines
      i made a function that do that for you
      just call it with a three params
      $s_text
      your text
      $i_number
      the number that you want to put in each col
      $s_siparator
      the siparator
      default is "|"
      here is the function with example
      i hope that it will be useful for you
       
      ****
       
      #include <Array.au3> $s_txt = "some text1some text2|some text3|some text4|some text5|some text6" $array = splitText($s_txt, 2) _ArrayDisplay($array) Func splitText($s_text, $i_number, $s_siparator = "|") Local $a_TXT = StringSplit($s_text, $s_siparator) Local $a_Return[$a_TXT[0] + 1] If ($a_TXT[0] <= $i_number) Or ($i_number <= 0) Then ReDim $a_Return[2] $a_Return[0] = 1 $a_Return[1] = $s_text Return $a_Return EndIf Local $i_Processed = 1, $i_arrayProcessed = 1 Do For $i = $i_Processed To ($i_Processed + $i_number) - 1 If ($a_TXT[0] < $i) Then ExitLoop If Not ($a_Return[$i_arrayProcessed]) Then $a_Return[$i_arrayProcessed] = $a_TXT[$i] Else $a_Return[$i_arrayProcessed] &= $s_siparator & $a_TXT[$i] EndIf $i_Processed += 1 Next $i_arrayProcessed += 1 Until ($a_TXT[0] < $i_Processed) ReDim $a_Return[$i_arrayProcessed] $a_Return[0] = $i_arrayProcessed - 1 Return $a_Return EndFunc ;==>splitText
      accept my greetings
      thanks to
      @Dan_555
      for his notes
       
    • By MesterPerfect
      good morning
      this is the first post here in the autoit forums
      i hope that you can help me in my problem
      i have a JSON encoded
      it a map of my forums
      where i want to make a treeview that have the same type of map
      e.g
      a system (as category)
      windows (as sub category)
      software (as an child item in the windows category)
      .....
      i don't know how to do that
      so, i know that i can do that using the json functions
      but i need your help about how we can do it as the type that i told you
      by the way i need to put the sub info for each item in an array that give me the ability to manage my items
      e.g
      can post thread
      can reply
      message cound ...
      you just give me a small example and i can continue.
      am sorry if this against the rules of the forum.
      but i realy searched a lot but i couldn't
      i hope some one give me the way.
      thank you very much in advance
       
      here is the link of json forum
      https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn/
      and here is my encoded json file
       
      { "tree_map": { "0": [ 1, 5, 6, 7 ], "1": [ 2 ], "2": [ 4 ], "5": [ 3 ], "6": [ 8 ], "8": [ 9, 10 ] }, "nodes": [ { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 1, "node_id": 1, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "Main category", "type_data": {} }, { "breadcrumbs": [ { "node_id": 1, "title": "Main category", "node_type_id": "Category" } ], "description": "", "display_in_list": true, "display_order": 1, "node_id": 2, "node_name": null, "node_type_id": "Forum", "parent_node_id": 1, "title": "Main forum", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 1, "title": "Main category", "node_type_id": "Category" }, { "node_id": 2, "title": "Main forum", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 1, "node_id": 4, "node_name": null, "node_type_id": "Forum", "parent_node_id": 2, "title": "my forums1", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 2, "node_id": 5, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "Perfect", "type_data": {} }, { "breadcrumbs": [ { "node_id": 5, "title": "Perfect", "node_type_id": "Category" } ], "description": "", "display_in_list": true, "display_order": 2, "node_id": 3, "node_name": null, "node_type_id": "Forum", "parent_node_id": 5, "title": "ahmed", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 3, "node_id": 6, "node_name": null, "node_type_id": "Forum", "parent_node_id": 0, "title": "autoit", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 3, "node_id": 8, "node_name": null, "node_type_id": "Forum", "parent_node_id": 6, "title": "examples", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" }, { "node_id": 8, "title": "examples", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 3, "node_id": 9, "node_name": null, "node_type_id": "Forum", "parent_node_id": 8, "title": "GUI", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [ { "node_id": 6, "title": "autoit", "node_type_id": "Forum" }, { "node_id": 8, "title": "examples", "node_type_id": "Forum" } ], "description": "", "display_in_list": true, "display_order": 31, "node_id": 10, "node_name": null, "node_type_id": "Forum", "parent_node_id": 8, "title": "windowEX", "type_data": { "allow_poll": true, "allow_posting": true, "can_create_thread": true, "can_upload_attachment": true, "discussion_count": 0, "last_post_date": 0, "last_post_id": 0, "last_post_username": "", "last_thread_id": 0, "last_thread_prefix_id": 0, "last_thread_title": "", "message_count": 0, "min_tags": 0, "require_prefix": false } }, { "breadcrumbs": [], "description": "", "display_in_list": true, "display_order": 4, "node_id": 7, "node_name": null, "node_type_id": "Category", "parent_node_id": 0, "title": "vbs", "type_data": {} } ] }  
    • By nooneclose
      I need to dynamically resize my 2d array while looping. 
      I know this code:
      ReDim $rArray[UBound($rArray) + 1] works for the rows, however, I also need to increase the columns. How would i go about increasing both rows and columns while looping? 
    • By Colduction
      Hi guys!, i have a problem to convert Python code to AutoIt code, in fact i had not coded with Python yet!, this code is about permutation a string's case, i will be happy with your comments :)❤;

      Python code:
       
      # Python code to print all permutations # with respect to cases # Function to generate permutations def permute(inp): n = len(inp) # Number of permutations is 2^n mx = 1 << n # Converting string to lower case inp = inp.lower() # Using all subsequences and permuting them for i in range(mx): # If j-th bit is set, we convert it to upper case combination = [k for k in inp] for j in range(n): if (((i >> j) & 1) == 1): combination[j] = inp[j].upper() temp = "" # Printing current combination for i in combination: temp += i print(temp), # Driver code permute("Hello") # This code is contributed by Sachin Bisht
      My code in AutoIt:
      ; https://www.geeksforgeeks.org/permute-string-changing-case/ _PermuteCase("ABC") Func _PermuteCase($sText) If StringRegExp($sText, "^[A-Za-z]{1,}$") Then Local $iLength = StringLen($sText) ; Get length of the text. Local $iMaxPerm = 2 ^ $iLength ; Number of permutations is 2^n Local $sLow_Text = StringLower($sText) ; Converting string to lower case Local $asChrs = StringToASCIIArray($sLow_Text) ; Split the text into array of chars. For $i = 1 To $iMaxPerm Step 1 For $j = 0 To $asChrs[0] ;................................................... Next Next Else Return SetError(-1, 0, "Error: Input is incorrect!") EndIf EndFunc ;==>_PermuteCase  
       
       
       
       
       
      ====================== SOLUTION by @TheXman ======================
       
    • By Zaoka
      Hi guys
      Need little help with filtering.
      I'm trying to filter specific weeks from power pivot table using this code recorded with Excel VBA :
       
      #include <Excel.au3> Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, "C:\Users\....\Orders.xlsb") $oWorkbook.PivotTables("PivotTable1").PivotFields( _ "[Report 2].[Week].[Week]").VisibleItemsList = Array( _ "[Report 2].[Week].&[10]", "[Report 2].[Week].&[11]", _ "[Report 2].[Week].&[12]", "[Report 2].[Week].&[13]", _ "[Report 2].[Week].&[14]", "[Report 2].[Week].&[15]") But get error
      error: Array(): undefined function. Not sure how to resolve this.
×
×
  • Create New...