05-09-2008, 12:57 AM
In follow up to: http://forums.macresource.com/read/1/490091/490377
System Profiler has a command line equivalent! system_profiler.
man system_profiler will give you all the gory details but here is the summary -
get list of hardware that system profiler can report -
system_profiler -listDataTypes
get just USB devices -
system_profiler SPUSBDataType
search for particular device (in this case, "Canon") -
system_profiler SPUSBDataType | grep Canon
AppleScript that reports whether or the not specified device is connected -
try
do shell script "system_profiler SPUSBDataType | grep Canon"
display dialog "you have it!"
on error
display dialog "you don't!"
end try
---
I'd still like to figure out how to get launchd to run a script as root. its my last task.
System Profiler has a command line equivalent! system_profiler.
man system_profiler will give you all the gory details but here is the summary -
get list of hardware that system profiler can report -
system_profiler -listDataTypes
get just USB devices -
system_profiler SPUSBDataType
search for particular device (in this case, "Canon") -
system_profiler SPUSBDataType | grep Canon
AppleScript that reports whether or the not specified device is connected -
try
do shell script "system_profiler SPUSBDataType | grep Canon"
display dialog "you have it!"
on error
display dialog "you don't!"
end try
---
I'd still like to figure out how to get launchd to run a script as root. its my last task.