removeDuplicateElements

Post your questions and help other users.

Moderator: Martin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: removeDuplicateElements

Post by Desmanto » 08 Sep 2017 10:50

Do you have another phone to test this out? Try the same version 1.33.0.

Try to split that removeDuplicateElements(global_x1) into seperate script action, put debug dialog in the middle to check the progress

Try also this simple script, check the value of x afterward

Code: Select all

x = removeDuplicateElements(newList(2,3,1,3,2,3))
You should see x = [2, 3, 1]
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: removeDuplicateElements

Post by simon_magus101 » 08 Sep 2017 12:32

This is newbie question. How do I use debug dialog? I just started using Automagic 2 days ago. I used on screen notification. Got the right result: 2,3,1

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: removeDuplicateElements

Post by Desmanto » 08 Sep 2017 14:16

2 days? What automation app do you use before?

Debug Dialog is the element to check all variables' value at certain point. To add it, add condition > new > find Debug Dialog. The usage just simple, put it after the place you wanna check the variable. Execute the flow and you will hit a message dialog showing every available variables for that flow. You can see the value of the global_x1 then, or even edit its value. In this case, you need to put it after your script.

If you get 2, 3, 1; means the removeDuplicateElements() works properly. Something is wrong in your script. Maybe misstyped? Try to copy your own script from your post before

Code: Select all

global_x2=newList(7350474, 7350475, 1608847, 1618847, 1618846, 1608846, 7350473, 1628846); //eight numbers
global_x3=newList(1124582, 7344998, 7345098, 1134582); //four numbers
global_x4=newList(1608847); //notice this number is a duplicate in global_x2[2]
global_x1=newList();
//combining all elements in global_x1
global_x1=addAllElements(global_x1, global_x2);
global_x1=addAllElements(global_x1, global_x3);
global_x1=addAllElements(global_x1, global_x4);
Paste it in new flow, action script. Then add the debug dialog to it.

Next add action script again after the first debug dialog, and put the last line for removing duplicate

Code: Select all

removeDuplicateElements(global_x1);
Put another debug dialog at it. Check value of global_x1 at each debug dialog.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: removeDuplicateElements

Post by simon_magus101 » 08 Sep 2017 14:25

I was using Llama. All GUI no scripting. Now I am attempting to migrate all my automation from Llama to Automagic. I figured out the Debug Dialog and found out what the problem is after viewing the data in JSON format. I was comparing strings to numbers. There are two more flows that I use: one to backup the numbers in text file and, one more to restore the numbers from the text file. When I restore it became text instead of numbers. Please check out these two flows and see if there is a fix. I need to get back the numbers in number format from a text file.
http://automagic4android.com/flow.php?i ... 03c804ecde

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: removeDuplicateElements

Post by Bluscre » 08 Sep 2017 14:51

I'lL check them out later today,tnx ^^
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: removeDuplicateElements

Post by Bluscre » 08 Sep 2017 15:05

Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: removeDuplicateElements

Post by simon_magus101 » 08 Sep 2017 15:49

Many error messages when executing CID Restore flow. Array indexing errors. I fixed the error, but still the global_homeCell is in string when viewed in JSON format,not numbers.
Here is the fixed flow. See if I did something wrong.
http://automagic4android.com/flow.php?i ... 4492653b24

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: removeDuplicateElements

Post by Bluscre » 08 Sep 2017 16:17

http://automagic4android.com/flow.php?i ... 9cbb9e9ceb

Sorry i must have been braindead ^^
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

simon_magus101
Posts: 38
Joined: 06 Sep 2017 06:59

Re: removeDuplicateElements

Post by simon_magus101 » 08 Sep 2017 16:27

Problem solved. Thanks a lot. Forum support is awesome. Migration from Llama completed.
Last edited by simon_magus101 on 08 Sep 2017 16:33, edited 1 time in total.

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: removeDuplicateElements

Post by Bluscre » 08 Sep 2017 16:32

simon_magus101 wrote:Problem solved. Thanks a lot. Forum support is awesome.
Nächste ma komm isch persöhnlisch ;)

Image
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

Post Reply