Web Browser via APL and ActiveX

28 views
Skip to first unread message

Rex Swain

unread,
May 25, 2022, 6:19:15 PM5/25/22
to APLWin
I want to hack together a little application that can read a web page, extract links from it, and then put up other web pages based on those links.  It would be easiest (for me) to do this with APLWin and ActiveX.  But the only browser control that I know of is a version of MS Internet Explorer that I can get with 

  'fm' ⎕wi 'Create' 'Form'
  'fm.wb' ⎕wi 'Create' 'Shell.Explorer'

The trouble is that the resulting browser is a very old version of MSIE.  And the ActiveX interface doesn't really expose the HTML document object model in the same detailed way that Excel.Application and Word.Application do for worksheets and documents.

Does anyone know of another browser control that can be easily manipulated from APL?

(Don't make me use Python and Selenium.  Please!)

Davin Church

unread,
May 25, 2022, 10:09:12 PM5/25/22
to APLWin
I've got a function that can make an HTTP request and return the HTML content as a text result, without using a browser at all. Would that help?

Rex Swain

unread,
May 26, 2022, 8:47:17 AM5/26/22
to APLWin
Thanks, Davin.  I already have a whole bunch of utilities for fetching the url using different techniques (WININET.DLL functions, ⎕NI, etc.).  
Here's the simplest, which works for http and https :

    ∇ ret←HttpGet url;h
[1]   :try
[2]       h←'xmlhttp' ⎕wi 'Create' 'Microsoft.XMLHTTP'
[3]       h ⎕wi 'XOpen' 'GET' url 0
[4]       h ⎕wi 'XSend'
[5]       :while 4≠h ⎕wi 'xreadyState' ⋄ ⎕wgive 0 ⋄ :end
[6]       ret←1 (h ⎕wi 'xresponseBody')
[7]   :catch
[8]       ret←0 ⎕em
[9]   :end
    ∇

But I do need to present and manipulate a browser, so this is only a start.


Davin Church

unread,
May 26, 2022, 10:28:27 AM5/26/22
to APLWin
Have you tried using ShellExecute and just pass it a URL to bring up whatever the default browser is on their system?

Davin Church

unread,
May 26, 2022, 10:30:24 AM5/26/22
to APLWin
Sorry - ShellExecute only presents the browser, but can you combine both methods to both present and interpret data?

On Thursday, May 26, 2022 at 7:47:17 AM UTC-5 Rex Swain wrote:
Reply all
Reply to author
Forward
Message has been deleted
0 new messages