MozillaZine

AppleScript Address

Talk about the native Mac OS X browser.

Moderator: Camino Developers

NovaScotian

User avatar
 
Posts: 92
Joined: July 6th, 2004, 8:40 am

Post Posted February 11th, 2005, 10:37 am

I'd like to see a foot in the door of AppleScriptability; i.e., that Camino at least respond to a request:
Code: Select all
tell application "Camino"
    Open URL "www.myURL.com/etc.."
end tell

As it is, I have to use Firefox which is scriptable. Camino is always running on my machine, and Firefox is not a quick starter.

cflawson

User avatar
 
Posts: 4721
Joined: December 26th, 2004, 2:54 pm
Location: Flying over your house in a red, white, and blue jet

Post Posted February 11th, 2005, 12:09 pm

Camino is scriptable, too.

Problem is, there's a weird bug -- at least, I consider it a bug -- that prevents Camino from responding to AS commands while simultaneously being able to handle Macromedia Director content. If you remove the Location.rsrc file from

Camino.app/Contents/Resources/English.lproj/

AppleScript will then work, but you won't be able to view Director content.

I haven't seen anything that I know to be Director content in about five years, so the choice was easy for me...

cl

NovaScotian

User avatar
 
Posts: 92
Joined: July 6th, 2004, 8:40 am

Post Posted February 11th, 2005, 1:03 pm

Doesn't seem to work, unfortunately. Even this simple script returns an error:
Code: Select all
tell application "Camino"
    openURL "http://www.google.com/"
    activate
end tell
results in: "Camino got an error: URL "http://www.google.com" doesn't understand the open message."
Replacing "Camino" with "Firefox" gets the expected result.

eccoana

User avatar
 
Posts: 813
Joined: February 27th, 2004, 1:43 pm
Location: bavaria

Post Posted February 11th, 2005, 2:23 pm

AppleScript support is still deficient.

but you can try this:
Code: Select all
tell application "Camino"
   open location "http://www.google.com/"
   activate
end tell

NovaScotian

User avatar
 
Posts: 92
Joined: July 6th, 2004, 8:40 am

Post Posted February 11th, 2005, 3:42 pm

Great stuff eccoana, and thanks - "open location" is recognized, but as you said, without a Camino dictionary, you really can't do much except guess what commands its supports. I'll switch to Firefox for this project - it renders the site I'm trying to interact with better as well. Come to that, with the slow progress being made on Camino (because so few, dedicated and skillful as they are, are working on it), perhaps it's time to switch. Too bad Apple seems to have abandonned Safari.

Wevah
 
Posts: 498
Joined: October 5th, 2004, 12:47 am

Post Posted February 11th, 2005, 5:22 pm

Huh? Do you download nightlies at all?

cflawson

User avatar
 
Posts: 4721
Joined: December 26th, 2004, 2:54 pm
Location: Flying over your house in a red, white, and blue jet

Post Posted February 11th, 2005, 9:04 pm

Use Script Editor to open Camino's dictionary and you'll find all you could ever want to know about Camino's script support.

cl

eccoana

User avatar
 
Posts: 813
Joined: February 27th, 2004, 1:43 pm
Location: bavaria

Post Posted February 12th, 2005, 8:56 am

cflawson wrote:Use Script Editor to open Camino's dictionary and you'll find all you could ever want to know about Camino's script support.
anything changed from the nightly (0125) I'm using?
the dictionary says a lot but almost none of the commands does work :-(

herbs
 
Posts: 568
Joined: November 22nd, 2003, 8:39 pm

Post Posted February 12th, 2005, 12:59 pm

cflawson wrote:Use Script Editor to open Camino's dictionary and you'll find all you could ever want to know about Camino's script support.


Howdy,

Hmm... when I try to open the dictionary is Script Editor I get nothing! Could this be related to the MacroMedia bug mentioned above? I'm using the G4 Optimized 2/12 build.

Good Luck,
Herb Schulz

smorgan
Camino Developer
 
Posts: 2430
Joined: March 16th, 2004, 1:50 pm

Post Posted February 12th, 2005, 1:50 pm

Yes, that's what the bug is (bug 184449); you have to remove the Localized.rcsc file in order to open the dictionary with script editor.

NovaScotian

User avatar
 
Posts: 92
Joined: July 6th, 2004, 8:40 am

Post Posted February 12th, 2005, 2:33 pm

smorgan wrote:Yes, that's what the bug is (bug 184449); you have to remove the Localized.rcsc file in order to open the dictionary with script editor.

And now I can continue with the script I was working on in Camino (I really don't like Firefox except on my PC where it pulverizes IE)

herbs
 
Posts: 568
Joined: November 22nd, 2003, 8:39 pm

Post Posted February 12th, 2005, 4:43 pm

Howdy,

Wow, removing the Localized.rsrc file works wonderfully. Now I've re-written the Plug-in script for Address Book that gives you a CM when pointing at an address to show the location on maps.google.com; see MacOSXHints.com. It was written for Firefox but can very simply be adapted to Camino: change the lines

GetURL ....
activate

to

activate
open url ....

and all the occurances of the word Firefox to Camino, just to get things right. Save it as a script calling it "Get Map of (Camino)", place it in "~/Library/Address Book Plug-ins" and enjoy it!

Actually, I don't know why the activate didn't come first in the original.

Good Luck,
Herb Schulz

NovaScotian

User avatar
 
Posts: 92
Joined: July 6th, 2004, 8:40 am

Post Posted February 13th, 2005, 10:31 am

herbs wrote:Wow, removing the Localized.rsrc file works wonderfully.


True. I also got the Google Maps in Camino working - just a bit different from yours.

Now, I'm looking for some way in AppleScript to deal with tabs in Camino. There's nothing about tabs in the dictionary, and if you Get URL "http://www.yourChoice.com/", the activate command doesn't bring it frontmost. A viable alternative would be open a new window in front of whatever is open, but there doesn't seem to be a command to do that either.

This code snippet, for example, only works if the script creates a fresh, tabless window (i.e., no windows are open because if you default to tabbed browsing, this will just open a tab in the background in your current window.)

Code: Select all
tell application "Camino"
   Get URL "http://www.whatismyip.com/"
   activate
   delay 1 -- or whatever is required to avoid the initial "untitled" window title.
   set windowTitle to name of window 1
   set External_IP_Address to word 4 of windowTitle
   display dialog "Your router's IP address is: " & External_IP_Address buttons "Thanks" default button 1
close window 1
end tell

eccoana

User avatar
 
Posts: 813
Joined: February 27th, 2004, 1:43 pm
Location: bavaria

Post Posted February 13th, 2005, 10:40 am

NovaScotian wrote:
Code: Select all
tell application "Camino"
   Get URL "http://www.whatismyip.com/"
   activate
   delay 1 -- or whatever is required to avoid the initial "untitled" window title.
   set windowTitle to name of window 1
   set External_IP_Address to word 4 of windowTitle
   display dialog "Your router's IP address is: " & External_IP_Address buttons "Thanks" default button 1
close window 1
end tell

I'm using the lastest nighly, deleted the localized file but I always get 'NSCannotCreateScriptCommandError' if I use the 'Get URL' command. what have you done that it works for you?

herbs
 
Posts: 568
Joined: November 22nd, 2003, 8:39 pm

Post Posted February 13th, 2005, 11:00 am

eccoana wrote:I'm using the lastest nighly, deleted the localized file but I always get 'NSCannotCreateScriptCommandError' if I use the 'Get URL' command. what have you done that it works for you?


Howdy,

Replace "GetURL" with "open url".

Good Luck,
Herb Schulz

Return to Camino


Who is online

Users browsing this forum: No registered users and 1 guest