Re: newbie question
Re: newbie question
- Subject: Re: newbie question
- From: Dave Stewart <email@hidden>
- Date: Wed, 13 Oct 2004 14:10:45 -0700
On Oct 13, 2004, at 12:01 PM, Paul Grossmann pondered:
Is there a simple command I can use to make the script wait until the
entire file has been received before opening? I was thinking of using
the file size as the key, but that would limit me to that specific
size.
Since I don't work with AS all that much myself, I'm sort of a
"perpetual newbie" (I know just enough to be dangerous:). Most likely
someone with far more knowledge than me will provide a better answer,
but I had to throw out this thought anyway:
If you're already getting the file size, why limit yourself to a
specific size? The script at the receiving end could simply grab the
file size and sleep for a time, then grab it again and check if the
file size has grown or not (if it has grown, sleep and check again;
otherwise try to open it). Not a perfect answer, mind you, but if you
keep your sleep time set to a long enough interval (5 seconds?) it
might work sufficiently.
AS also does have a "try/catch" type mechanism, so you might "try"
opening the file with the desired app and catch any "error" you
receive. (See the "Try Statements" part of the ASLG, or go to
<http://developer.apple.com/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/index.html> for examples) If the error is as
expected (unexpected EOF), then sleep a time before checking file size
again ...
Combine these two together and it just might work pretty decently.
Sleep for a time, check if the file size has grown. If so repeat, else
try opening the file. If an error is thrown, repeat.
Happy scripting! :-)
Dave Stewart
Aqua~Flo Supply (Goleta CA)
dstewart at aquaflo dot com
Vincent van Gogh visits his psychiatrist, a bloodstained bandage draped
around his ear (or rather, the ear that was). Dutifully, he lies down
on
the couch, his face serene, despite his physical pain. The doctor is
agitated and nonplussed. When he finds the words, he shakes his head
slowly:
"No, no, no, Vincent. I said, take a year off."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden