• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Convert URL to text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert URL to text?


  • Subject: Re: Convert URL to text?
  • From: has <email@hidden>
  • Date: Sun, 4 Dec 2005 18:02:39 +0000

Scott Dunn wrote:

>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

Are you certain you actually need the URL as a string? Did you try passing keychain the original Unicode text value? While it's not unknown for some gnarly old pre-OS X applications to throw a fit when passed anything but a string, the vast majority should have no problem as they'll have the Apple Event Manager to coerce the given value to their desired type when retrieving it.


>-- if I 'set keyName to "www.apple.com"' then it works

Here's a wild guess: you haven't checked to see what the URL strings returned by Safari actually look like. Might be a good idea to do so before assuming your problem's due to a type issue. If your Keychain keys are domain names, you'll need to extract those from the URL strings returned by Safari first.

has
--
http://freespace.virgin.net/hamish.sanderson/
 _______________________________________________
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

  • Follow-Ups:
    • Re: Convert URL to text?
      • From: Scott Dunn <email@hidden>
  • Prev by Date: Re: Validating email address -- What are the allowed chars?
  • Next by Date: Re: Validating email address
  • Previous by thread: Re: Conversion to numerics with Quark
  • Next by thread: Re: Convert URL to text?
  • Index(es):
    • Date
    • Thread