Google Answers Logo
View Question
 
Q: USB OS X automatic execution ( No Answer,   3 Comments )
Question  
Subject: USB OS X automatic execution
Category: Computers > Programming
Asked by: nan0-ga
List Price: $75.00
Posted: 21 Nov 2005 11:53 PST
Expires: 11 Dec 2005 09:01 PST
Question ID: 595866
It's quite simple: i want to stick a USB drive in a Mac, and have that
mac execute a program of my choosing upon insertion.

In windows, there is an 'autorun.inf' file that contains a path to the
application. So, any media inserted has the potential to automatically
run an application simply by putting this textfile on the media.

I know there is an 'autostart' thanks to quicktime (since v 2.0) - but
it has a peculiar low level HFS implimentation that requires users to
rely on application developers (toast, being the most common method)
to let them autostart. And such applications only allow authoring of
CD-ROM / DVD ISO, not usb memory stick.

I had the notion of using software
[http://www.cdeverywhere.com/manual/en/script.shtml] to make a
bootable CD-ROM iso, then transfer the ISO to a USB drive, but i don't
know how to do so and not corrupt the ISO.

I have very little experience with OSX, and i cannot seem to find an
easy method of auto-executing upon USB media insertion.

The application i want to run will most likely just be a shell script.
(i simply want to copy files)

thank you!

Clarification of Question by nan0-ga on 21 Nov 2005 13:51 PST
After more research, i have learned that even the quicktime
'autostart' functionality has been *completely disabled* in OS X.

[security issues]

thus i will probably just set up a cron job to grep 'mount' output,
and perform command on drive if any changes.

if anyone has better ideas, chime up, gladly pay.
Answer  
There is no answer at this time.

Comments  
Subject: Re: USB OS X automatic execution
From: happymac-ga on 21 Nov 2005 22:41 PST
 
Depending on what version of OS X you are running you can either set
up an Applescript to execute on media insertion or an create an
Automater application to run at media insertion. In OS X 10.4 Tiger,
there is a selection menu (~/library/preferences) that allows you to
choose what happens when you insert media.

This may be an over-simplistic way of addressing the issue, but
hopefully this will get you headed in the right direction.
Subject: Re: USB OS X automatic execution
From: nan0-ga on 22 Nov 2005 00:08 PST
 
Indeed - this is interesting, and i did not know this.

However, the UI method you speak of only allows configuration of DVD &
CDs, not USB drives.

Since i wrote this, i have gotten my crontab working - but it only
checks every minute (smallest cron resolution)

and frankly, i still cannot find a way to do the ideal:

launch my own script based on the system USB automount event.

thanks again for writing, i'm keeping at it, hopefully something will
turn up in next few days.

cheers
Subject: Re: USB OS X automatic execution
From: nan0-ga on 11 Dec 2005 09:01 PST
 
i figured out a method

see

http://www.apple.com/applescript/folderactions/01.html

i will eventually learn how to do this without UI; some plist somewhere no doubt.

meanwhile - this will work, and is a bit smarter than my cron job.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy