Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Convert URL to text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Convert URL to text?



I'm trying to write a small utility that performs some actions based upon the URL of the current web page. I assumed that the following would give me a variable of the correct type for searching the keychain, however it appears I'm wrong. If I hard-code 'keyName' to the address of the page then the retrieval works fine.

tell application "Safari"
	set theURL to the URL of document 1
end tell
set keyName to theURL as text
-- at this point 'keyName' seems to be correct, but doesn't work.
-- if I 'set keyName to "www.apple.com"' then it works

I'm assuming that the coercion of URL to text is not working as I expect and 'keyName' actually contains some extraneous non-visible characters.

What's the correct way to get a URL as plain text?

I did try searching the archives and tried a few things that I saw there but I'm still stuck. Suffice to say this is very frustrating. This is my first AppleScript and I would never have thought I'd be stumped by something that seems so simple!

Thanks for your help,

Scott.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Fwd: Validating email address (From: has <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.