Re: Tell OS X Application...
Re: Tell OS X Application...
- Subject: Re: Tell OS X Application...
- From: Simon Forster <email@hidden>
- Date: Thu, 10 Jan 2002 17:23:47 +0000
On Thursday, January 10, 2002, at 04:17 pm, Paul Berkowitz wrote:
I've just had to write about 20 times as much
verbiage as necessary, trying to guess what you're talking about.
Apologies for that Paul, I was trying to keep things short.
1. What's wrong with 9 lines if it works? That doesn't seem much to me.
You're absolutely right, it's not much. But this is a small subsection
of one handler to download text prior to stuffing it into a database and
then synchronising it with the database's online brother. If it's
indicative of the way all code will grow things could get unpleasant.
But hell, as long as it works.
If you really do need 'using terms from', then you must be using a
variable.
I like code to be transportable as I write it on my machine but
frequently use it in anger somewhere else. In this instance I need to
get the startup disks name to create the file path to the URL Access app.
Please
provide the 9 lines. That's awfully short, you know, and would make it
possible to see if there's any way to make it more "elegant", whereas
without them we're just stumbling in the dark.
I try to avoid posting scripts 'cause they end up looking like a dogs
dinner but seeing as you asked:
<script snippet>
---------------------
tell application "Finder"
set my_file to ((desktop as string) & "vebraproperties.txt")
set my_app to ((name of startup disk as string) &
":System:Library:ScriptingAdditions:URL Access Scripting.app:")
end tell
with timeout of 300 seconds
using terms from application "URL Access Scripting"
tell application my_app to download
"
ftp://username:password@server_ip/WEBSITE7/vebraproperties.txt" to file
my_file replacing yes
end using terms from
end timeout
---------------------
</script snippet>
Simon Forster
________________________________________________
LDML Ltd, 4/5 Hazlitt Mews, London, W14 0JZ, UK
<tel int="+44 20 7602 9370" uk="020 7602 9370">
<fax int="+44 20 7371 6662" uk="020 7371 6662">
<
mailto:email@hidden>
________________________________________________