Topic to discuss the TMSWebBrowser dialog object

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Topic to discuss the TMSWebBrowser dialog object

Post by Grovkillen » Mon Sep 23, 2024 5:41 pm

Just wanted to have a thread that we could use to discuss how to use the experimental object TMSWebBrowser.

Events:
OnBeforeNavigate2
OnClientToHostWindow
OnCommandStateChange
OnDocumentComplete
OnDownloadBegin
OnDownloadComplete
OnDragDrop
OnDragOver
OnEndDrag
OnEnter
OnExit
OnFileDownload
OnFullScreen
OnMenuBar
OnNavigateComplete2
OnNavigateError
OnNewProcess
OnNewWindow2
OnNewWindow3
OnPrintTemplateInstantiation
OnPrintTemplateTeardown
OnPrivacyImpactedStateChange
OnProgressChange
OnQuit
OnRedirectXDomainBlocked
OnSetPhishingFilterStatus
OnSetSecureLockIcon
OnStartDrag
OnStatusBar
OnStatusTextChange
OnTheaterMode
OnThirdPartyUrlBlocked
OnTitleChange
OnToolBar
OnUpdatePageStatus
OnVisible
OnWindowClosing
OnWindowSetHeight
OnWindowSetLeft
OnWindowSetResizable
OnWindowSetTop
OnWindowSetWidth
OnWindowStateChanged

Example code:

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 365
  ClientWidth = 594
  Color = clBtnFace
  object MSWebBrowser1: tMSWebBrowser
    Left = 0
    Top = 0
    Width = 594
    Height = 365
    Anchors = [akLeft, akTop, akRight, akBottom]
  end
end
EndDialog>Dialog1
//SetDialogProperty>Dialog1,MSWebBrowser1,URL,C:\Users\jimmy\Downloads\test.pdf
//SetDialogProperty>Dialog1,MSWebBrowser1,URL,https://www.chartjs.org/docs/2.6.0/charts/line.html
SetDialogProperty>Dialog1,MSWebBrowser1,URL,https://www.whatismybrowser.com/
SetDialogProperty>Dialog1,MSWebBrowser1,RegisterAsDropTarget,False
AddDialogHandler>Dialog1,MSWebBrowser1,OnEnter,TEST_EVENT
Show>Dialog1,r

SRT>TEST_EVENT
**BREAKPOINT**
END>TEST_EVENT
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Topic to discuss the TMSWebBrowser dialog object

Post by Grovkillen » Mon Sep 23, 2024 5:45 pm

This event will update download progress:

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 365
  ClientWidth = 594
  Color = clBtnFace
  object MSWebBrowser1: tMSWebBrowser
    Left = 0
    Top = 0
    Width = 594
    Height = 365
    Anchors = [akLeft, akTop, akRight, akBottom]
  end
end
EndDialog>Dialog1
SetDialogProperty>Dialog1,MSWebBrowser1,URL,https://www.chartjs.org/docs/2.6.0/charts/line.html
AddDialogHandler>Dialog1,MSWebBrowser1,OnProgressChange,TEST_EVENT
Show>Dialog1,r

SRT>TEST_EVENT
Message>%TEST_EVENT_progress%/%TEST_EVENT_progressmax%
END>TEST_EVENT
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Topic to discuss the TMSWebBrowser dialog object

Post by Grovkillen » Mon Sep 23, 2024 5:53 pm

This event trigger when I start downloading a file. Download complete isn't working correctly for me.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 365
  ClientWidth = 594
  Color = clBtnFace
  object MSWebBrowser1: tMSWebBrowser
    Left = 0
    Top = 0
    Width = 594
    Height = 365
    Anchors = [akLeft, akTop, akRight, akBottom]
  end
end
EndDialog>Dialog1
SetDialogProperty>Dialog1,MSWebBrowser1,URL,https://hil-speed.hetzner.com/
AddDialogHandler>Dialog1,MSWebBrowser1,OnDownloadBegin,TEST_EVENT
//AddDialogHandler>Dialog1,MSWebBrowser1,OnDownloadComplete,TEST_EVENT
Show>Dialog1,r
SRT>TEST_EVENT
**BREAKPOINT**
END>TEST_EVENT
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Topic to discuss the TMSWebBrowser dialog object

Post by Grovkillen » Mon Sep 23, 2024 6:01 pm

This event captures a link being clicked but no info about the new URL is attached.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 365
  ClientWidth = 594
  Color = clBtnFace
  object MSWebBrowser1: tMSWebBrowser
    Left = 0
    Top = 0
    Width = 594
    Height = 365
    Anchors = [akLeft, akTop, akRight, akBottom]
  end
end
EndDialog>Dialog1
SetDialogProperty>Dialog1,MSWebBrowser1,URL,https://www.w3schools.com/howto/howto_make_a_website.asp
AddDialogHandler>Dialog1,MSWebBrowser1,OnNavigateComplete2,TEST_EVENT
Show>Dialog1,r
SRT>TEST_EVENT
**BREAKPOINT**
END>TEST_EVENT
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Topic to discuss the TMSWebBrowser dialog object

Post by Grovkillen » Mon Sep 23, 2024 6:16 pm

OnBeforeNavigate2 have more variables but they are all blank and MS will crash:

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 365
  ClientWidth = 594
  Color = clBtnFace
  object MSWebBrowser1: tMSWebBrowser
    Left = 0
    Top = 0
    Width = 594
    Height = 365
    Anchors = [akLeft, akTop, akRight, akBottom]
  end
end
EndDialog>Dialog1
SetDialogProperty>Dialog1,MSWebBrowser1,URL,https://www.w3schools.com/howto/howto_make_a_website.asp
AddDialogHandler>Dialog1,MSWebBrowser1,OnBeforeNavigate2,TEST_EVENT
Show>Dialog1,r
SRT>TEST_EVENT
**BREAKPOINT**
END>TEST_EVENT
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Topic to discuss the TMSWebBrowser dialog object

Post by Grovkillen » Mon Sep 23, 2024 6:31 pm

This event will trigger when the URL is downloaded or a file is downloaded.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 365
  ClientWidth = 594
  Color = clBtnFace
  object MSWebBrowser1: tMSWebBrowser
    Left = 0
    Top = 0
    Width = 594
    Height = 365
    Anchors = [akLeft, akTop, akRight, akBottom]
  end
end
EndDialog>Dialog1
SetDialogProperty>Dialog1,MSWebBrowser1,URL,https://samplelib.com/sample-png.html
AddDialogHandler>Dialog1,MSWebBrowser1,OnFileDownload,TEST_EVENT
Show>Dialog1,r
SRT>TEST_EVENT
**BREAKPOINT**
END>TEST_EVENT
The TEST_EVENT_ACTIVEDOCUMENT is blank though. A cool thing is the download progress bar that pop up.
Let>ME=%Script%

Running: 15.0.27
version history

mhcha
Junior Coder
Posts: 33
Joined: Sat Jan 01, 2022 11:10 am

Re: Topic to discuss the TMSWebBrowser dialog object

Post by mhcha » Tue Sep 24, 2024 6:31 am

I like this 15.0.25 update as long as I've waited.
Thank you for opening this thread.

PDF and WebBrowser are both good, but it's a bit unfortunate that TMSWebBrowser is not Chrome or Edge-based, so it's not possible to display web pages that browser doesn't support.

Does TMSWebBrowser work with the JavaScript or Web Automation option in the macro scheduler?

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Topic to discuss the TMSWebBrowser dialog object

Post by Grovkillen » Tue Sep 24, 2024 7:39 am

This version is IE11 based, TMS software seem to have an Edge-based object too but the one in this release isn't that one.
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Topic to discuss the TMSWebBrowser dialog object

Post by Marcus Tettmar » Tue Sep 24, 2024 8:05 pm

Wow. It's the Microsoft WebBrowser control which is part of Windows. TMS stands for Type Macro Scheduler - TWebBrowser becomes TMSWebBrowser, etc. It has nothing to do with TMS Software whoever that is. It supports Javascript. If you want to automate a browser we have Edge/Chrome functions for doing that.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Topic to discuss the TMSWebBrowser dialog object

Post by Grovkillen » Wed Sep 25, 2024 5:03 am

Thanks for clearing that up Marcus.
Let>ME=%Script%

Running: 15.0.27
version history

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts