UI freeze while thread running .

I make simple thread Desktop application at Windows 10.
But, UI is freeze while thread running.

at PushButton1.Action

Thread1.Start

at Thread1.Run

Dim Command as new Shell Command.ExecuteMode = Shell.ExecuteModes.Synchronous Command.TimeOut = -1 // for Windows Command.Execute("start /w notepad %USERPROFILE%\\Documents\\test.txt && type %USERPROFILE%\\DOcuments\\test.txt") Me.AddUserInterfaceUpdate("TextField1":Command.Result)

at Thread1.UserInterfaceUpdate

For Each arg As Dictionary In data If arg.HasKey("TextField1") Then TextField1.text = arg.Value("TextField1") End If Next

I made this on MS-Windows10.
This is edit test.txt by notepad.exe and show test.txt to TextField1.
It is work, but while notepad is running, the xojo program will freeze.
What can I do to avoid freeze?

Make the shell asynchronous.

Hi Greg! Thank you.
I changed

Dim Command as new Shell // Command.ExecuteMode = Shell.ExecuteModes.Synchronous Command.ExecuteMode = Shell.ExecuteModes.Asynchronous Command.TimeOut = -1 // for Windows Command.Execute("start /w notepad %USERPROFILE%\\Documents\\test.txt && type %USERPROFILE%\\DOcuments\\test.txt") Me.AddUserInterfaceUpdate("TextField1":Command.Result)

It work without UI freeze. But, it can not get Command.Result as “type %USERPROFILE%\DOcuments\test.txt”.
Any help?

seems you really want your app to startnotpad and then be told when notepad changes that file (by saving) or notepad quits

and only then read the contents

thats not what the code you posted will do

https://www.dropbox.com/s/sqdu3w3dm15w6xq/TestForYoshimasa.xojo_binary_project?dl=0

https://www.dropbox.com/s/sqdu3w3dm15w6xq/TestForYoshimasa.xojo_binary_project?dl=0

Oh, this is magic. You are God.

I’ve reworked the program for my own understanding as follows

I put PushButton1,Label1,Shell1.

PushButton1 .Action :

Shell1.ExecuteMode = Shell.ExecuteModes.Asynchronous Shell1.TimeOut = -1 // for Windows Shell1.Execute("start /w notepad %USERPROFILE%\\Documents\\test.txt && type %USERPROFILE%\\Documents\\test.txt")

Shell1.DataAvailable :

It moves very well. Thank you.
Now, I’ve ported this to a web app. There is a new problem on the web app. I will create a new Conversation.
https://forum.xojo.com/59192-shell-run-in-endless-at-web-application

Sorry! Web app work well too.