Difference between revisions of "Development:Camino AppleScript Guide"

From Camino Wiki
Jump to navigation Jump to search
(→‎New in Camino 1.6: more on deprecation)
(add source/text item)
Line 3: Line 3:
  
 
Camino 1.6 features significant improvements in AppleScript support over previous versions of Camino.  Some of these improvements required incompatible changes to commands and properties.  Many scripts will continue to work correctly in Camino 1.6; however, scripts that use certain commands and properties, and text scripts (<tt>.applescript</tt>), will need changes in order to continue functioning.
 
Camino 1.6 features significant improvements in AppleScript support over previous versions of Camino.  Some of these improvements required incompatible changes to commands and properties.  Many scripts will continue to work correctly in Camino 1.6; however, scripts that use certain commands and properties, and text scripts (<tt>.applescript</tt>), will need changes in order to continue functioning.
 +
 +
==New in Camino 2.0==
 +
 +
* Web page source and text
 +
** It is now possible to fetch the HTML source and displayed text of a browser window or tab using the <code>source</code> and <code>text</code> commands.
 +
** If a web page has a selection, it is also possible to return the HTML source and displayed text of just the selection using the <code>selected source</code> and <code>selected text</code> commands.
  
 
==New in Camino 1.6==
 
==New in Camino 1.6==
Line 26: Line 32:
 
* Certain items present in the Standard Suite will compile but are not implemented in Camino at this time ({{bug|394581}}).
 
* Certain items present in the Standard Suite will compile but are not implemented in Camino at this time ({{bug|394581}}).
 
* <code>browser window 0</code> resolves to a browser window (browser window 1) but should not ({{Bug|395716}}).
 
* <code>browser window 0</code> resolves to a browser window (browser window 1) but should not ({{Bug|395716}}).
* If the user has enabled the “closing windows or quitting with multiple pages open” warnings, these alerts will also fire when AppleScripts attempt to perform these actions.  There is currently no way for the script to disable these alerts on a case-by-case basis ({{Bug|391684}})<!-- this probably belongs somewhere, but where? -->
+
* If the user has enabled the “closing windows or quitting with multiple pages open” warnings, these alerts will also fire when AppleScripts attempt to perform these actions.  There is currently no way for the script to disable these alerts on a case-by-case basis ({{Bug|391684}}).<!-- this probably belongs somewhere, but where? -->
  
 
==Migrating Scripts from Camino 1.5 to Camino 1.6==
 
==Migrating Scripts from Camino 1.5 to Camino 1.6==

Revision as of 23:16, 24 April 2009

DRAFT
This page is not complete.

The following page is a guide to the AppleScript features available in Camino 1.6.

Camino 1.6 features significant improvements in AppleScript support over previous versions of Camino. Some of these improvements required incompatible changes to commands and properties. Many scripts will continue to work correctly in Camino 1.6; however, scripts that use certain commands and properties, and text scripts (.applescript), will need changes in order to continue functioning.

New in Camino 2.0

  • Web page source and text
    • It is now possible to fetch the HTML source and displayed text of a browser window or tab using the source and text commands.
    • If a web page has a selection, it is also possible to return the HTML source and displayed text of just the selection using the selected source and selected text commands.

New in Camino 1.6

  • Browser Windows and Tabs
    • Browser windows can now be referenced specifically. Previously, Camino only exposed windows in general, including the Preferences window and the Downloads window in the same collection as browser windows.
    • Browser windows contain tabs.
    • Tabs can be addressed individually, exposing the title and URL of each page the user has open.
  • Bookmarks
    • Bookmarks and bookmark folders can be read, added, and modified by AppleScripts. (But see the important note below.)
  • WWW!OURL AppleEvent is deprecated
    • The old Spyglass WWW!OURL AppleEvent and its corresponding open url command have been deprecated. Scripts using these will not work in Camino 1.6, though they will work again in Camino 1.6.1. See below for a migration path.

Anomalies in the Camino AppleScript Dictionary

  • Making new tabs or browser windows
    Although the make command is present, it is currently not possible to make new tab or make new browser window. For technical information about the reasons for this, see this blog post.
     
    If a user has “Links opened by other applications” checked (in the Tabs preference pane), it is possible to use open location "about:blank" to fake opening a new tab and then use set URL of current tab of front browser window to load the desired URL.
  • Certain items present in the Standard Suite will compile but are not implemented in Camino at this time (Bug 394581).
  • browser window 0 resolves to a browser window (browser window 1) but should not (Bug 395716).
  • If the user has enabled the “closing windows or quitting with multiple pages open” warnings, these alerts will also fire when AppleScripts attempt to perform these actions. There is currently no way for the script to disable these alerts on a case-by-case basis (Bug 391684).

Migrating Scripts from Camino 1.5 to Camino 1.6

  • The Get URL command has been replaced by open location. Compiled scripts should handle this change automatically in most cases.
  • The open url command (and its corresponding «event WWW!OURL») has been deprecated. Scripts should use open location instead. Any compiled scripts using this event will re-resolve to DeprecatedOpenURL terminology when opened in ScriptEditor with Camino 1.6.1 and later, and those instances should be changed manually to use open location to ensure compatibility with future versions of Camino. (Scripts using open url or «event WWW!OURL» will fail in Camino 1.6 but will work again in Camino 1.6.1.)
  • The window class now properly refers to all open windows (including the Downloads and Preferences windows). To target a browser window, use browser window instead.

Implementing Toolbar Script Items