Re: Test for valid URL?
Re: Test for valid URL?
- Subject: Re: Test for valid URL?
- From: Matt Deatherage <email@hidden>
- Date: Wed, 15 Sep 2010 20:32:11 -0500
On Sep 15, 2010, at 8:10 PM, "Mark J. Reed" <email@hidden> wrote:
> On Wed, Sep 15, 2010 at 8:48 PM, Michael Grant <email@hidden> wrote:
>> Does AppleScript provide any way of testing whether a string is a
>> valid URL before using it as the argument of the "open location"
>> command?
>
> What do you mean by a "valid URL"? How valid does it have to be? You
> can write a syntax check, but that's a low barrier to entry that
> doesn't in any way guarantee that it will open as a location...
On top of that, since applications can register URL schemes, a given string may be a valid URL that takes action on one system but not on others. For example, systems with OmniFocus installed will respond to "ofocus:" URLs, but systems without it will not.
You can use one of the popular regular expressions to test for URLs with a scripting addition (or a shell script or an application), but it's a much trickier proposition to know if a syntactically valid URL will actually take action in some application or not.
--Matt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden