URL Link Tester
Description
Originally presented by Niel at the Apple Forum, this subroutine will let you do a quick test of whether a given URL link is working.
The Code
on verify_Link(theURL)
--Originally presented by Niel at http://discussions.apple.com/message.jspa?messageID=10726800
set the_page to do shell script "curl -si " & theURL & ""
set the_code to items 10 thru 12 of the_page as string
set the_offset to offset of "<title" in the_page
set the_title_1 to items (the_offset + 7) thru (the_offset + 300) of the_page as string
set the_offset_2 to offset of "</title" in the_title_1
set the_title_2 to items 1 thru (the_offset_2 - 1) of the_title_1 as string
end verify_Link
--Originally presented by Niel at http://discussions.apple.com/message.jspa?messageID=10726800
set the_page to do shell script "curl -si " & theURL & ""
set the_code to items 10 thru 12 of the_page as string
set the_offset to offset of "<title" in the_page
set the_title_1 to items (the_offset + 7) thru (the_offset + 300) of the_page as string
set the_offset_2 to offset of "</title" in the_title_1
set the_title_2 to items 1 thru (the_offset_2 - 1) of the_title_1 as string
end verify_Link
Quick Links
Want to open the script right away?
Click here to open it in your Script Editor
Click here to open it in your Script Editor
Using Snippets to manage your code?
Save this into Snippets
Save this into Snippets
New To AppleScript?
- Here's how to use the AppleScripts you find here and -- to make them even easier to use -- here's how run them with simple keyboard shortcuts!
- Be sure to check out other great AppleScripts in the Veritrope.com Code Library -- and share your own AppleScript projects using the quick submission form!




No Comments / Add Yours!