How To Use Internet Suite of Standard Additions?

I’m particularly interested in the commands beyond the often-used outcast open location.

I have searched the Internet through and through without having moved a single inch.

What are these for? Could someone elucidate me by providing real-life scenarios?

I suspect they’re just relics of days gone by.

Many years ago, starting in the 1990’s, you could write an AppleScript application to serve as your Mac-based web server’s CGI handling executable.
So, a visitor to your website could submit a form (or just a URL with a GET request) to your Mac-based web server (maybe using MacHTTP or Webster or some early Mac web server). The Mac would hand that incoming CGI request off to the specified AppleScript applet, which would process the request and return HTML or a file. An example can be found here:
AppleScript Guidebook: Essential Sub-Routines: AppleScript CGI

However, while I don’t know when, it looks like this is no longer supported by Apple, even though the commands remain in the Standard Additions. See Apple’s documentation here:
AppleScript Language Guide (Documentation Archive)

The most recent posts I can find here at MacScripter are from 2008:

So, long story short: I don’t think it would be easy/possible to get this working on modern macOS, but probably still possible, if you can obtain the pieces needed, using an old Mac. Maybe from Tiger or pre-Tiger (10.4) era.

1 Like

So, what do you make of it? My question was straightforward. What’s the real-life context for the URL, Internet address, and webpage classes?

Could you show me the examples?

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

set myURL to "https://www.macscripter.net/t/word-to-pdf-with-osascript/74311"

set myFancyURL to myURL as URL

-- >{scheme:secure http URL, path:"https://www.macscripter.net/t/word-to-pdf-with-osascript/74311", host:{class:Internet address, DNS form:"www.macscripter.net", port:443, dotted decimal form:"164.92.126.237"}}

set myInternetAddress to myFancyURL's host as Internet address

--{DNS form:"www.macscripter.net", port:443, dotted decimal form:"164.92.126.237"}

Not sure about web pages, I think that’s linked to the handle CGI requests and I think those are obsolete (but probably still in the system for backward compatibility?)

2 Likes

Thanks. Your example helped me to break out of the standstill. use scripting additions is critical. In the absence of this condition some properties refused to compile and run. In much older macOS that didn’t make it to get the use construct support, the solution is to coerce the record into a list with subsequent referencing the individual members.

The only ambiguous remainder is web page. Based on its description, it would seem it expects an HTML-formatted object. As far as I’m aware, there isn’t a single AppleScript command or OSAX capable of producing such entities which is unneeded since the biggest clue to understanding the meaning is the description of the handle CGI request handler itself.
The result of its operation is the class of web page with the same properties that are defined as parameters for the handler plus several ones listed explicitly in the dictionary entry for web page.

A huge advantage of this suite is that you can obtain a heap of useful info without involving a browser. Calling the URL element even exposes the IP of the queried ULR, so you don’t have to learn ping.

One oddity hasn’t passed by me: the oddity is that path returns the entire URL string instead of the components following the domain part that exists here by the name of DNS form. I wanted to use it for parsing URLs.