automatically intercept Safari download

Hi:
I’d like to have a way to control my kids downloading on her ‘controlled’ account.
Is there an AppleScript that will watch Safari and whenever a download is clicked, it passes it off to say, an Automator workflow that will require administrator authentification before allowing the download to procede?
In Automator (should this post be in Automator?) I’ve found actions that will throw up a confirmation window and then make an authentication request, but as I say, I first need something that will automatically ‘catch’ the download from Safari (I assume the script will have to be somehow loaded at my kid’s account log-in so that it’ll watch Safari) and trigger the workflow.
Any help would be greatly appreciated by this careful parent.

Easiest is set the download folder to a drop folder. In system get info, permission write only (drop Box).The thing is they could go in to preference and change download location. To stop that you what have to have a UI action, when preferences is open to auto close.

You could backup the download.plist on idle so you got a record.

Need help setting up just ask.

Hey thanx for the quick reply. And for your offer to guide me in the set up.
Yes, I’d thought of watching a download folder (but as you say that could be changed by the kids.
And the UI action to shutdown preferences … well, I’d really rather not just block activities, but present
them with the option of calling me to check it out with them. Y’know, communication :/.)

From what you suggest, should I assume there’s no (easy) way to intercept a Safari download?

It occurs to me though, that perhaps a download folder might be workable, if once the download is
done a script is called to trigger the notification and password authetification request to access that file.
Now would that be possible?

I guess I’m still looking for a script (or workflow or something) that automatically clicks in once some
sort of action is completed or initiated.
Sorry if this seems overly finicky. Balancing protection and respect and all that parental stuff is tricky.
Thanx again.

Drop folder puts it in an other users realm, change user and you only have access. Like a password system. Making the downloadable folder unchangeable is hacking Safari. Apple protects that info so hacker can’t change thing. Some smart cookie might know. You could have a folderaction on the drop folder, to notify you.

On start download, try cocoa or C developers, notification and event watching (like UI action watching) is possiable. Likely someone would have to write a plugin. Theres more parent control in upcoming Leopard (OSX 10.5), maybe they have throught of this.

Thanx again!

Obviously I’m very new to this scripting stuff. Cocoa and C would likely be way over my abilities - or my kids would be grown up before I could figure it out…). Bear with me if my questions seem … stupid.

Just for some clarification for my wee brain :
If I eventually succeed in getting something close to what I want, generally speaking can the resulting plugin, app, or script be loaded as a startup item for the users account? (This no doubt means the scripting will have to include allowing it to idle about, waiting for some sort of event to occur that it responds to; the scripting would have to be figured out… but assuming it can be figured out, as a startup item it could work, right?).

Assuming the above (big assumption?), I’ve found a couple of scripts that 1) can detect path to the download destination
and 2) move files downloaded to one place to another.
With these working in tandem (possible? The second script uses the path revealed by the first script) it wouldn’t matter if the kids change the download destination, the files would always end up in the same place (determined by me).
Another script I saw seemed to be able to detect when a download finished. It monitors changes the of destination folder size and once the size stops increasing, the script can do whatever you want (or so the script creator says).
The “whatever you want”, in my case, could be a message window notifying of the completion (or failure), but if the destination folder is, as you mentioned, a drop box needing my admin password, the notification could say something like “Complete, but inaccessible without first calling Mom or Dad” (who have the password)!
Whew!
What seems crucial here is a) can it load at log-in and idle til needed, and 2) is it possible to string all these scripts together to work step by step to the final result!

Again, sorry for my lack of skill and knowledge.

(My hunch is Leopard won’t have download controls in Parental Controls …)

Thanx again.

If you can detect on download path (post the script please), thats all good but still need a trigger. On folder added (folder action) and watch dowloads is usually an on idle polling which can be beaten if you are quick.

I asked Cocoa Developer on another site how you watch events from other people application. And then trigger AppleScript.

I’m working on a sort of Application Parent Control, Block applicatons that are not on your approved list. Its a problem to do with people upload ACGI (Applescript triggered from internet with acgi dispatcher). Sinces AppleScript is so powerful I need to control it, block or allow.

Out of interest if you can get the download path you maybe able to set it. If So you could use reserve logic and on close and change focus reset the download path.

Have Fun

Bevos, thanks so much for sticking with this. Much appreciated.

The script that supposedly detects the download path is as follows:


set plPath to (path to preferences as Unicode text) & “com.apple.internetconfigpriv.plist”
¨tell application “System Events”
¨ set aliasData to value of property list item “DownloadFolder” of property list file plPath
¨end tell
¨¨-- Save the result (which is raw data, not text) to a temporary file and read it back as an alias.
¨set fRef to (open for access file ((path to temporary items as Unicode text) & “Download Folder Alias.dat”) with write permission)
¨try
¨ set eof fRef to 0
¨ write aliasData to fRef
¨ set downloadFolder to (read fRef from 1 as alias)
¨end try
¨close access fRef
¨¨downloadFolder → The required alias.


Sorry, I don’t know how to get those nice insert boxes for showing scripts in the forum.

Anyways, yes, the automatic ‘trigger’ is essential; obviously a manually triggered script won’t do for our purposes (just how do iGetter and SpeedDownload recognize and intercept a download?! What I’m really after, or want to try and make is a download manager with one and only one feature: admin authentification required. Xcode is potentially very cool, but way over my head…)

One of the reasons (perhaps the main reason) I’m looking into this is because while Apple’s Parental Controls gives a nice way to control Mail (admin approved whitelist), and Parental Control Bar (free!) has a nice control for no-no sites (and chats and messengering), and while I can turn off applications from the Parental Control setting (any other Mail software, any other browsers, chatters, messengerers, p2p, etc.), the kids can simply download others and install them in some secret place (since apps can function outside the Applications folder).

Thanx.

After much looking at stuff way over my head, I guess I’m still at the basic question of
whether, with Automator, or Apple Script (or even Xcode) a download click can be ‘caught’
and then require an admin password in order for the download to start?
If so, then I’d like to narrow it to only require the password if it’s a sit, sitx, zip, dmg, pkg, mpkg,
or any other common compressions used for software downloads )as I say, it’s to keep my kids from
downloading stuff that will circumvent parental controls.

Thanx.