URL Checker
russ at weststreetconsulting.com
russ at weststreetconsulting.com
Wed Apr 30 12:30:03 PDT 2014
John and Scott (and Rick),
I have a sample ExtendScript that uses the Socket object, called
"NETWORK_-_Retrieve_text_over_network.jsx". It retrieves text from a
webpage and sticks it into a document. It could be easily modified to
just look for the 200 OK message. All in all, this would be a very short
and generally simple script for an experienced developer. A great idea
for a script, really. I should add it to the group. I could use it
myself.
http://www.weststreetconsulting.com/WSC_ExtendScriptSamples.htm
Russ
------------------------------
Message: 16
Date: Wed, 30 Apr 2014 09:46:55 -0700
From: Scott Prentice <sp10 at leximation.com>
To: john.x.posada at us.hsbc.com, framers
Subject: Re: URL Checker
Message-ID: <536128FF.2060704 at leximation.com>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
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
More information about the framers
mailing list