getting applescript event from safari

i am trying to launch a dialer application from safari, the way i have it so far is by using a protocol “phone://9,904-555-5555”

now i have a scriptable dialer application as well

i need to put the two together, i know how to assign an application as the handler for the “phone://” protocol, but how can i make it get the value of what was in the URL (phone number)?

Could you expand or re-word your question.

Is the Ph # in the address field of Safari’s window, and you need this to be a variable?

yes, that is exactly it- the phone number is in the address field like phone://1112223344, i need the number to be a variable in the applescript application that handles that protocol.

I appreciate any input on how to do that.

tell application "Safari" to set PhoneUrl to (URL of document 1) as string

Safari uses “document” to get the URL property. “window” has no URL property. “document 1” is the frontmost Safari window; Take note of that when getting the URL.
ie The last Safari window to open will be the frontmost unless you bring another Safari window to the front.

thank you, i believe i have it now