URL Checker

Scott Prentice sp10 at leximation.com
Wed Apr 30 09:46:55 PDT 2014


You got me thinking about this. Here's some really basic ExtendScript 
code that will iterate over all markers and check the text of "message 
URL" Hypertext markers to see if they are valid files (on the local file 
system). This would need to be cleaned up a bit to make it useful, but 
definitely doable ..

var doc = app.ActiveDoc;
var marker = doc.FirstMarkerInDoc;
while (marker.id) {
     if (marker.MarkerTypeId.Name == "Hypertext") {
         var markerText = marker.MarkerText;
         if (markerText.substr(0,11) == "message URL") {
             var target = markerText.substr(12);
             // tests for local files
             var file = File(target);
             if (file.exists) {
                 Console("GOOD ["+target+"]");
             } else {
                 Console("BAD ["+target+"]");
             }
         }
     }
     marker = marker.NextMarkerInDoc;
}

It turns out that you can test for remote (web-based) URLs using the 
Socket object.

Cheers,

...scott

On 4/29/14 5:55 PM, Scott Prentice wrote:
> Hi John...
>
> Interesting.
>
> First, you'd have to define what it means for a link to be "valid". 
> Are these URLs to content on a web server? If so, does valid mean that 
> it doesn't return a 404 error (page not found)? Or do you need to know 
> that the page actually has the content that you expected it to .. in 
> which case you might want to be able to scan the content at the target 
> URL for text that matches the link text?
>
> Or .. am I blowing this out of proportion, and you're just looking on 
> a local file system for a matching file name?
>
> If the latter, ExtendScript should be able to do what you need, if the 
> former, you might need a bit more processing power like an FDK client.
>
> I'll be interested to see if anyone else has done this sort of thing.
>
> If you need help developing such a script/utility .. give me a holler.
>
> Cheers,
>
> ...scott
>
> Scott Prentice
> Leximation, Inc.
> www.leximation.com
> +1.415.485.1892
>
>
> On 4/28/14 12:11 PM, john.x.posada at us.hsbc.com wrote:
>> Hi, guys...FM 11.
>>
>> I have a section in my books that is just pages and pages of links to text,
>> sql, excel, and PDF files that are out on our Sharepoint system.
>>
>> As we go forward, the links are becoming a maintenance issue. While I know
>> I cannot automate the creation of the links, I'd like to have something
>> that can validate my links.
>>
>> Each link is defined as a "Go to URL" hyperlink and it is an absolute link,
>> not relative.
>>
>> Has anyone done this kind of scripting?
>>
>> Thanks
>>
>> John X Posada
>> AML Syst & Ops Supt Data Analyst | US FCC & RC Systems Control & Analytics
>> | HSBC North America Holdings Inc
>> 330 Madison Ave., NY NY
>>                                                                   
>>   _______________________________________________________________
>>                                                                   
>>                                                                   
>>                                                                   
>>                                                                   
>>                                                                   
>>   Phone
>>        Int: 212-525-5483 Ext: Personal cellphone - 732-259-2874
>>   Mobile
>>        Company Blackberry - 224-600-0570
>>   Email
>>        john.x.posada at us.hsbc.com                                   
>>                                                                   
>>   _______________________________________________________________
>>   Protect our environment - please only print this if you have
>>   to!
>>                                                                   
>>
>>
>>
>> -----------------------------------------
>> ******************************************************************
>> This E-mail is confidential. It may also be legally privileged. If
>> you are not the addressee you may not copy, forward, disclose or
>> use any part of it. If you have received this message in error,
>> please delete it and all copies from your system and notify the
>> sender immediately by return E-mail.
>>
>> Internet communications cannot be guaranteed to be timely, secure,
>> error or virus-free. The sender does not accept liability for any
>> errors or omissions.
>> ******************************************************************
>> SAVE PAPER - THINK BEFORE YOU PRINT!
>> _______________________________________________
>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.frameusers.com/pipermail/framers-frameusers.com/attachments/20140430/f6ae0ea3/attachment.htm>


More information about the framers mailing list