Windows 10/11 slow text Operation

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

Windows 10/11 slow text Operation

Post by mikelpapamike » Sat Apr 01, 2023 6:32 pm

Hello Everyone,

I have a simple script running on windows that is running quite slowly. I tried the same script in MacOS and is running perfectly. Any way to improve it inside windows?

The problem specifically is that i want to read the text of an html page from the browser widget every 100 milliseconds, to take a running time field at a fraction of 100 milliseconds.

The codee:

Code: Select all

on mouseUp
   rCommand
end mouseUp


command rCommand
   lock screen
   
   get matchText(Text of widget "browser", "<td class=" & quote & "r_27899h_2g_2l_4c_6  tg tw align_right" & quote & ">(.*.)</td>", R )
   set the itemDel to "</td"
   put item 1 of R into fld "Field2"
   //unlock screen
   if the hilite of button "check" then
      send rCommand to me in 50 millisec
   end if
end rCommand

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Windows 10/11 slow text Operation

Post by stam » Sat Apr 01, 2023 6:43 pm

Does grabbing the text and putting it into a variable before scraping it help?

mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

Re: Windows 10/11 slow text Operation

Post by mikelpapamike » Sat Apr 01, 2023 7:24 pm

Nope, no difference at all. Maybe slightly worse sometimes.

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Windows 10/11 slow text Operation

Post by stam » Sat Apr 01, 2023 7:30 pm

mikelpapamike wrote:
Sat Apr 01, 2023 7:24 pm
Nope, no difference at all. Maybe slightly worse sometimes.
well, it was a thought...

looking at your regex, this may be a bit malformed - you don't escape the slash in </td>, but you could also probably shorten it to:

Code: Select all

r_27899h_2g_2l_4c_6.+>(.*)<\/td>
Impossible to test without source text to search, but this *should* work...
if it doesn't, can you post a some of the text you're scraping?
Mind you, not sure this will speed things up in Windows - but probably makes it easier to manage the regex ;)

S.

mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

Re: Windows 10/11 slow text Operation

Post by mikelpapamike » Sat Apr 01, 2023 8:04 pm

Thanks a lot again for your prompt reply. I tried your code,but for some reason,which ever text i try to scrap,it always reads one speecific field.

I'm not sure if I can post here the data I'm scraping as it is a website where ski results come realtime from US races, which is the same APP/Web page that the local races in my country use,so i'm preparing the scraping using the US page. But you can find it easily at vola dot ussalivetiming dot com

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Windows 10/11 slow text Operation

Post by stam » Sat Apr 01, 2023 8:36 pm

mikelpapamike wrote:
Sat Apr 01, 2023 8:04 pm
Thanks a lot again for your prompt reply. I tried your code,but for some reason,which ever text i try to scrap,it always reads one speecific field.
I should have said I'm at work and occasionally checking not the phone while waiting for stuff to happen... (yep, lots of waiting for staff...)
if you mean that only the first result is found, perhaps try

Code: Select all

(?msixU)r_27899h_2g_2l_4c_6.+>(.*)<\/td>
Ultimately you probably need Thierry's input for the regex (I am but a mere amateur!) but he doesn't really frequent the forum any more...

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Windows 10/11 slow text Operation

Post by stam » Sun Apr 02, 2023 9:27 am

I tried the URL you provided - it works in a normal browser but for the life of me I can't get it to load in a widget browser (it only loads the top header bar, none of the results...). I'm on MacOS 13.2.1, using LC 10 DP4, and practically all sites load normally but this one doesn't....

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Windows 10/11 slow text Operation

Post by FourthWorld » Sun Apr 02, 2023 10:51 am

Will usually require some additional cleanup, but:

Code: Select all

set the htmlText of fld "Converter" to \
 the text of widget "browser"
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Windows 10/11 slow text Operation

Post by Klaus » Sun Apr 02, 2023 10:52 am

Hi stam,

no problem with that URL in LC 9.6.9 rc3 on macOS 12.6.4!?


Best

Klaus

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Windows 10/11 slow text Operation

Post by stam » Sun Apr 02, 2023 12:54 pm

the text of the widget "browser" is empty on this site and as mentioned only the top banner loads for me. No idea why as sites with complex layout work just fine...

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Windows 10/11 slow text Operation

Post by jacque » Sun Apr 02, 2023 5:31 pm

The interval is short enough that there may be stacked pending messages in the queue. I also removed the lockscreen command since there's no redraw happening until the field content changes at the end. That may not be necessary. Try this:

Code: Select all

command rCommand 
   get matchText(Text of widget "browser", "<td class=" & quote & "r_27899h_2g_2l_4c_6  tg tw align_right" & quote & ">(.*.)</td>", R )
   set the itemDel to "</td"
   put item 1 of R into fld "Field2"
   if the hilite of button "check" and "rCommand" is not in the pendimgMessages then
      send rCommand to me in 50 millisec
   end if
end rCommand
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Windows”