JavaScript without Timer and WebViewStringChange

are you talking about JavaScript?
you do not need a clock, just use the WebViewStringChanged event together with an if statement and a global variable...

Set global action to A
Call A

In the webViewStringChanged event:
If action = A
set A = value
Call B
set B = value


Thank you,
your lines are helpfull!
What I'm trying to ask was: is there a way to put the webViewStringChange "Result" in a variable like a procedure result.
I want to use the Java "call" like an extern function.
Your answer put the hole thing in the webviestringchange event. Is that a good place for a calculation?
Number1 = ASC("a")
Number2 = ASC("b")
Number3 = Number1 + Number2
(( ASC is my extern Java call ))

You declare a variable "Action" is that the only way?

Ich bin aus Deutschland, bitte entschuldigen sie mein schlechtes Englisch!

This is an ongoing problem in AI2 development, and in general any asynchronous environment where you have to coordinate multiple interdependent processes .

It's like a 3 ring circus, where the ringmaster has to watch not to release the elephants until all the clowns are back in the clown car and the lion tamer has caged his lions.

That requires a ringmaster who knows about all the acts, their progress, and their requirements for further progress in the show.

Thank you, I understand.
I will put my stuff to the inventor without caling an extern java script. I think that will be a little bit slow... I hope it will be working.

Procedure sorting a list in ten screens
means ten times the same procedure in ten screens.
like sorting a list

you do not necessarily need 10 screens see also tip 1 here

to sort a list you also can use an extension List Utils Extension by Appybuilder

your English is quite good... btw. I'm also German... :wink:


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

You don't need Javascript or extensions to sort.

See my customizable merge sort blocks in FAQ Section: Lists

Very good, your ListSort Procedure seems to work much faster than the bubble sort example made by Sajal Dutta.

you will get the fastest result if you use an extension or the JavaScript solution, see also
How to sort a list using the webviewer(!)


I never used an extension before and I am a little bit afraid of loosing control. What I was looking for was:

Fill List
Sort List ( MIT or Java )
Work with sorted List

(( execute and wait sort List ))

The merge sort procedure and the bubble sort procedure are doing a nice joh but both of them got if statements in the deepest loop.

The textcompare statement is using the ascii order but I need the German norm order (ä less than b) so I have to write my own textcompare function and put it into the sort algorithmus

Thanks to everybody

(very nice Circus text)

Do you have a sorted alphabet string with all the letters in order, including caps?
My Google searches for German norm order are returning undesired results.

This could be used in a replacement procedure for the compare text block in the merge sort.

The fact that the compare happens in the innermost loop is inevitable, but not so bad considering that the compare happens n*log(n) times, the theoretical minimum.

If you want to sort the german norm you need to change minimum seven letters: ä=a, ö=o, ü=u, ß=ss, Ä=A, Ö=O, Ü=U. There are many more letters (French etc) but I think I will need them not yet
txt = join listStart
replace ä to a, ö to o etc in txt
NormList = Split txt
Sort NormList
If there is a need to swap Item, I swap them in both lists.

Here's a blocks implementation, with a mapping dictionary builtin.

merge_sort_German.aia (5.9 KB)

Gigaset E370HX,

Thank you!

I never worked with a dictionary before but it seems to be very useful.

You are changing the items to German Norm every time you use them, many times the same work?

Is there a way to translate the whole list to German Norm and after that to work with only one list? Perhaps a kind of tag that can remember the original position in the source list?

By the way:

I would like to have the "real" textcompare not binarycompare because I have more steps.

Text1 → lower →German Norm → TextA

Text2 → lower →German Norm → TextB

compare TextA / TextB

The dictionary will be smaller because I do not need Ä Ö Ü any longer.

Thank you again for your help!

This is typically done by turning the list into a table, adding an extra column pre-populated with a sort key pre-calculated to include the original sort key transformed with norming and downcasing. I have seen this done in database tables.

If you go that route and want to apply a merge sort to the table, have the comparison function select the new sort key column to decide which row precedes the other row.

After the table is sorted, select your original data column for display purposes or .Elements

Thanks again!

In the end hopes and wishes for basic text blocks and more::

I know the substitude solutions, but I think this "must" be basic...

LTrim (Space)
LTrim (Letter)

RTrim (Space)
RTrim (Letter)

ASC (Letter)
CHR (digit)
the optic of CHR(32) Space, is just the same as CHR(160) HardSpace ))
Variabe = " "
Space or not... ? CHR(32) is more clearly

Rights (Text, Len)


Global Variables and global Procedures should be global and not restricted to one screen

The answer "under construction" is the best answer...

In fact, the screens are treated as separate applications. Since the screen is an application, the global variable is within one screen. I have long stopped using screens, there are only problems with them. Use Arrangement.

Those are nice ideas, deserving of a separate thread.
Some one with more MIT mojo than me should promote them.

please remember I'm new to MIT so I don't understand the discussion of using more than one screen. Are screens structure elements or not? If we are working with arrangsments we need to write our own screen manager, visible on / off etc. ?

Another thing:
In the block editor are at the left down corner two symbols (show warnings, show errors) but there is no button for find / find next / go to. My browser (firefox) can't search text in pictures (blocks are pics?).

As for looking for errors, click the arrows above and below the error.

MitAi2 is a free website mainly for learning and simple applications. Don't expect miracles from her. If you want something better, learn Java and create in Android Studio. Otherwise, you have to get used to the limitations of AI2 and know how to handle them.

As for the operations on the texts that you presented above, I will take a look at it and introduce it to my extension as part of learning to write extensions.

ASC (Letter)
CHR (digit)

These functions are provided by my extension. You can convert UTF8 encoded character arrays in it.
For example, the string "hello" will convert to "68656C6C6F" and vice versa. Characters outside the ASCII range, e.g. the pound symbol as "C2A3".

There is a "Trim" function in blocks that removes spaces from both sides. "Rights (Text, Len)" is in blocks "Segment text, start, length".