My goal is to make it so that links clicked on one osx machine are loaded into safari on a remote computer with apple events enabled. To do this, I am trying to create an applescript application which i then make the default browser on the system.
My applescript looks like this:
on run argv
set theurl to item 1 of argv
set dest to "eppc://user:password@ipaddress"
tell application "Safari" of machine dest
activate
open location theurl
end tell
end run
In case argv is not the appropriate method to use to capture the url, I've simplified the script right down to:
tell application "Safari"
activate
open location "http://www.google.com"
end tell
I then save this as an application, and tell Safari that this application should be the default browser, but when I click on links in applications, it completely ignores my applescript and loads the url in Safari anyway (not the url I've specified, the url I've clicked on).
Why is this ? Do I need to do something special for my Applescript to act as a browser ? If I run my applescript application by double clicking on it, it does exactly what it's supposed to do, but if I launch it via the "default browser" feature, it doesn't run at all and instead Safari takes over.
If there's something simple I'm doing wrong or not doing or if I'm going about it totally the wrong way please let me know.