Re: Responding to events
Re: Responding to events
- Subject: Re: Responding to events
- From: Lee Phillips <email@hidden>
- Date: Wed, 16 Apr 2003 15:59:12 -0400
- Mail-followup-to: email@hidden
I found the thread, almost exactly one month old, and I finally got this to
work. Since you have to process the script each time you change it, I decided
it was easier to just make a script that responds to the event by passing the
url to another program, and put all the actual functionality in that program.
I wrote that program in Python, but anything that you are comfortable with
would do. Any further appleevents can be sent using the osascript command
from this program.
My script is just
on open location theurl
do shell script "source ~/.bashrc; handlemail " & theurl
end open location
on run
display dialog "I am intended to respond to mailto: links."
end run
The "source ~/.bashrc" is there because I couldn't seem to get my environment
variables passed through without it. "Handlemail" is my python script.
Save the script as an application and open it in ResEdit (is there a way
to edit resource forks without starting Classic yet?). As Joshua See said,
delete the BNDL and FREF resources, and modify the plst resource, A look at
that shows that it contains the creator and type codes, which you want to change
to arbitrary four-letter strings that are not being used by anything else. I
picked something strange and hoped for the best. If you delete the plst resource
the script application gets turned into a Classic program, which is not what I
wanted.
Using the SetFile command, change the creator and type codes to match what
you chose in the previous step. I found that deleting the BNDL resource unset
the bundle bit.
Now you want to tell the system to hand off mailto: (or whatever) protocols
to your application. I used the "More Internet" System preference pane, but
you can use Internet Explorer's preferences (or I suppose you can edit a file
somewhere if you know where it is - I don't). I recommend this preference pane:
you can just drag your application to it and it makes the association.
My Python program checks that it has a mailto: link, extracts the address,
and beings a message with Mutt by sending a command to Terminal. It doesn't
look for encoded subjects, but could easily be made to do so. Let me know if
you want to see it.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.