•About the Internet Suite AppleScript SDK January 22, 1999 The Internet Suite is a set of basic classes and events for Internet access in Mac OS 8.5 and later. Event and coercion handlers for basic Internet operations are included in the Standard Additions scripting addition along with terminology for those and other events. The Internet Suite will be extended in the future as more Internet scriptability is added to the Mac OS. Location and Use of the Internet Suite The Internet Suite is included in the Standard Additions Œaete¹ resource, so it is available to all scripts at all times. Additionally, it is published in the form of a Rez file (included in this SDK) for extending in your own applications. Because it is present in the Standard Additions file, the Internet Suite terms are automatically loaded into systemwide terminology by AppleScript at compile time, and the event and coercion handlers associated with the Internet Suite are always present. Internet Suite Events and Classes The Connectivity Suite consists of three major parts: € A set of event handlers that implement basic Internet operations € A set of classes that define basic Internet data types € A coercion handler that translates IP addresses The event handlers are primarily meant to support the Internet Access applets installed in the Apple menu of Mac OS 8, 8.1, and 8.5. The versions in the Standard Additions file of Mac OS 8.5 replace the similar event handlers that were in the Internet Access scripting addition in Mac OS 8 and Mac OS 8.1. Suite kAEInternetSuite Internet suite code: Œgurl¹ ___________________________________________________________ The suite code for the Internet Suite. Because the suite is in the Standard Additions file, you do not need to include it in your own terminology resource. Events kAEISOpenLocation open location suite: ŒGURL¹ code: ŒGURL¹ ___________________________________________________________ Opens a URL with the browser program that has been configured in Internet Config. If no Internet connection has yet been made (signalled by the absence of the Internet Scripting Preferences file in the Preferences folder), a dialog box is raised, asking if the user has configured the Macintosh for Internet access, and offering an opportunity to run the Internet Setup assistant. Parameters keyDirectObject type: ŒTEXT¹ The direct parameter is the URL to open, as a string Note that if a URL class is passed, it should automatically be coerced into a string. kErrorReporting error reporting type: Œbool¹ code: Œerrr¹ If this parameter is true, errors in opening the URL will be reported to the user in a Notification Manager dialog. Notes The symbols kAEISOpenLocation and kErrorReporting are missing in some versions of AEIncludes.h. KAEISHandleCGI handle CGI request suite: ŒWWW‡¹ code: Œsdoc¹ ___________________________________________________________ This event is sent to any application that is registered as a CGI handler in the Web*Star HTTP server or Personal Web Sharing in Mac OS 8.5. There is no systemwide event handler for this event. The terminology is included in the Standard Additions terminology so that scripters may write event handlers to receive this event in script applications. The parameters are defined by the Web*Star server; see for the current definition. Parameters keyDirectObject type: ŒTEXT¹ The path of the URL keyAEResult type: Œhtml¹ An HTML page resulting from the CGI execution kAEISHTTPSearchArgs searching for type: ŒTEXT¹ code: Œkfor¹ the data for the GET method or data after the Œ?¹ in a POST method kAEISPostArgs with posted data type: ŒTEXT¹ code: Œpost¹ the POST arguments kAEISContentType of content type type: ŒTEXT¹ code: Œctyp¹ the MIME content type of POST arguments kAEISMethod using access method type: ŒTEXT¹ code: Œmeth¹ either ŒGET¹ or ŒPOST¹ keyAddressAttr from address type: ŒTEXT¹ code: Œaddr¹ the IP address of the entity making the request kAEISUserName from user type: ŒTEXT¹ code: Œuser¹ the user name associated with the request kAEISPassword using password type: ŒTEXT¹ code: Œpass¹ the password sent with the request kAEISFromUser with user info type: ŒTEXT¹ code: Œfrmu¹ additional information about the user, usually the email address kAEISServerName from server type: ŒTEXT¹ code: Œsvnm¹ the name of the server application sending this request kAEISServerPort via port type: ŒTEXT¹ code: Œsvpt¹ the IP port number of the server kAEISScriptName executing by type: ŒTEXT¹ code: Œscnm¹ the path to the script executing this CGI, in URL form kAEISReferrer referred by type: ŒTEXT¹ code: Œrefr¹ the URL of the page the client used to link to the CGI kAEISUserAgent from browser type: ŒTEXT¹ code: ŒAgnt¹ the name of the client software kAEISActionPath using action type: ŒTEXT¹ code: ŒKapt¹ the path to the file or CGI kAEISAction of action type type: ŒTEXT¹ code: ŒKact¹ either PREPROCESSOR, POSTPROCESSOR, CGI, or ACGI kAEISClientIP from client IP address type: ŒTEXT¹ code: ŒKcip¹ the Internet address of the client kAEISFullRequest with full request type: ŒTEXT¹ code: ŒKfrq¹ the full request as sent to the server kAEISConnectionID with connection ID type: Œlong¹ code: ŒKcid¹ the ID of the connection from the server to the client Notes The symbol for kAEISConnectionID parameter is missing in the AERegistry.h header file. The four-character code for the kAEISActionPath parameter is wrong in some versions of AERegistry.h; the wrong code is ŒKatp¹; the correct code is ŒKapt¹. Classes cURL URL (plural: URLs) code: Œurl ¹ ___________________________________________________________ A Universal Resource Locator or Universal Resource ID (URI). In the form declared in the registry, the URL class can be used either as an object specifier or as a coerced AERecord. Note that the URL class is a specification of a network address, not the contents of the entity that it specifies. Properties pProperties properties type: Œreco¹ code: ŒpALL¹ property that allows getting and setting of multiple properties keyAEName name type: ŒTEXT¹ code: Œpnam¹ a name given to this URL, usually the name of the page it refers to pScheme scheme type: Œesch¹ code: Œpusc¹ the access scheme pHost host type: ŒIPAD¹ code: ŒHOST¹ the host specified by this URL pPath path type: ŒTEXT¹ code: ŒFTPc¹ the location of the target on the host pUserName user name type: ŒTEXT¹ code: ŒRAun¹ the user name by which to access this URL pUserPassword password type: ŒTEXT¹ code: ŒRApw¹ the password by which to access this URL cInternetAddress Internet address (plural: Internet addresses) code: ŒIPAD¹ ___________________________________________________________ An Internet or Intranet address for the TCP/IP protocol. In the form declared in the registry, the URL class can be used either as an object specifier or as a coerced AERecord. Note that the URL class is a specification of a network address, not the contents of the entity that it specifies. Properties pProperties properties type: Œreco¹ code: ŒpALL¹ property that allows getting and setting of multiple properties pDNS DNS form type: ŒTEXT¹ code: ŒpDNS¹ the Domain Name System form of the address (e.g. apple.com) pIADottedDecimal dotted decimal form type: ŒTEXT¹ code: Œpddf¹ the dotted-decimal form of the address (e.g. 17.255.1.1) pIAPort port type: Œlong¹ code: Œport¹ the port number of the requested TCP/IP service Notes The pIADottedDecimal and pIAPort symbols are not defined in some versions of AERegistry.h. cHTML web page (plural: web pages) code: Œhtml¹ ___________________________________________________________ A web page in HyperText Markup Language form. This is a prototype that you will probably want to extend if you use this in your applications, probably by adding a ³contents² property that contains the text of the web page. Ambitious developers may want to add elements that break down the text of the web page into logical HTML groups, like tags, paragraphs, style sheets, headers, etc. Properties pProperties properties type: Œreco¹ code: ŒpALL¹ property that allows getting and setting of multiple properties keyAEName name type: ŒTEXT¹ code: Œpnam¹ the name of the web page pURL URL type: Œurl ¹ code: ŒpURL¹ the universal resource locator for this page pTextEncoding text encoding type: ŒTEXT¹ code: Œptxe¹ the text encoding method used for this page cFTPItem FTP item FTP items code: Œftp ¹ ___________________________________________________________ An item on an FTP server. This is a prototype that you will probably want to extend if you use this in your applications. It may or may not be advisable to provide access to the binary data of the FTP item through a property because of the possibly extremely large size of such data. Properties pProperties properties type: Œreco¹ code: ŒpALL¹ property that allows getting and setting of multiple properties keyAEName name type: ŒTEXT¹ code: Œpnam¹ the name of the FTP item pURL URL type: Œurl ¹ code: ŒpURL¹ the universal resource locator for this item pFTPKind kind type: ŒTEXT¹ code: Œkind¹ the kind of the FTP item (directory or file) Enumerations eURLType Œesch¹ This enumerator is used in the pScheme property of the URL class to denote the type of the URL. You may extend this enumeration in your own application to add additional schemes. eurlHTTP http URL code: Œhttp¹ eurlHTTPS secure http URL code: Œhtps¹ eurlFTP ftp URL code: Œftp ¹ eurlMail mail URL code: Œmail¹ eurlFile file URL code: Œfile¹ eurlGopher gopher URL code: Œgphr¹ eurlTelnet telnet URL code: Œtlnt¹ eurlNews news URL code: Œnews¹ eurlSNews secure news URL code: Œsnws¹ eurlNNTP nntp URL code: Œnntp¹ eurlMessage message URL code: Œmess¹ eurlMailbox mailbox URL code: Œmbox¹ eurlMulti multi URL code: Œmult¹ eurlLaunch launch URL code: Œlaun¹ eurlAFP afp URL code: Œafp ¹ eurlAT AppleTalk URL code: Œat ¹ eurlUnknown unknown URL code: Œurl?¹ Coercions The Internet Suite provides one coercion from a text string to a URL class. typeChar Æ cURL ___________________________________________________________ This returns a coerced AERecord that extracts the pertinent information from the text string and returns it in properties of the URL. It returns the pHost property as a full Internet Address class, also a coerced record. In creating this record it attempts to do a one-way DNS resolution of the domain name to its dotted decimal form (if the host is provided initially in dotted decimal form, it does not do a reverse lookup to find the host name). ________________________________ © 1998 Apple Computer. Inc. All rights reserved. Apple, the Apple logo, LaserWriter, MacTCP, Power Macintosh, Mac, and Macintosh are trademarks of Apple Computer, Inc., registered in the U.S. and other countries. PowerPC is a trademark of International Business Machines Corporation, used under license therefrom. All other product names are trademarks or registered trademarks of their respective holders. Mention of non-Apple products is for information purposes and constitutes neither an endorsement nor a recommendation. Apple assumes no responsibility with regard to the selection, performance, or use of these products. Updated January 22, 1999 v1.0