MACSCRPT Archives

January 2010

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Mark J. Reed" <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 8 Jan 2010 09:28:39 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (63 lines)
First you have to get an application object to send the message to.
In Late Night's JavaScript OSA, that looks something like this:

var urls = MacOS.AppBySignature("xxxx")

where 'xxxx' is whatever the raw code for the app is (you can find out
by using Script Debugger to look at the raw events generated by an
AppleScript that does a 'tell application "URL Access Scripting"').
Then you would just do

urls.download(urlstring, filename, true);

But that's the least of the differences between AS and JavaScript.
You've got a pretty steep learning curve ahead. Good luck!

On Fri, Jan 8, 2010 at 4:13 AM, Chris Harbinson
<[log in to unmask]> wrote:
> I have been converting an old Quark AppleScript, which converts all
> instances of sterling in a document into euros, into JavaScript for
> InDesign.
>
> It does the job encouragingly briskly.
>
> However, up to now I have been using an exchange rate, cut and pasted from
> the ECB website.
>
> When it came to getting the rate via scripting I ran into problems. I looked
> up URL Access Scripting in Script Debugger's dictionary and opted for the
> display as JavaScript option...
>
> var result = download(param, to, replacing, unpacking, progress, form_data,
> directory_listing, download_directory, authentication);
>
> ... looked plausible enough.
>
> So I got stuck in an kept on getting "expected )", so brackets were inserted
> until the ExtendScript Toolkit's syntax checker declared no errors.
>
> var result = download(param ('www.ecb.int/rss/fxref-gbp.html'), to
> ('Macintosh HD/Applications/Adobe InDesign CS3/Scripts/EuroRate.txt'),
> replacing (true));
>
> However when I ran it, I was informed that "download is not a function".
> Presumably some JavaScript equivalent of "Tell URL Access Scripting..." is
> required.
>
> When you look up "JavaScript" and "URL Access" on Google you get literally
> thousands of hits, many of which encouraging contain the word FREE, but
> which turn out to mean "FREE" to peruse a price list.
>
> On one site I was offered an MP4 of calming music, maybe what I needed, but
> not what I was looking for!
>
> Sorry for bothering you with this novice JavaScripter stuff... In addition
> to any help on the problem in hand, I'd be glad to be told of any source
> where tyros like myself can find simple instruction./examples
>



-- 
Mark J. Reed <[log in to unmask]>

ATOM RSS1 RSS2