On Friday, September 17, 2004, at 12:51 AM, [EMAIL PROTECTED] wrote:


I know I can get the user's name under OSX by querying $user, but how
do I get hold of the computer's name (as given in the Sharing
preferences pane).

Here you go:

on mouseUp
  answer ComputerName()
end mouseUp

function ComputerName
  local tName
  put shell("system_profiler SPSoftwareDataType") into tData
  get matchText(tData,"(?s)Computer Name:\W*(.*?)\n",tName)
  if it is true then
    return tName
  else
    return "Error: Can't locate computer name."
  end if
end ComputerName

Now that I'm thinking about it, there's a much easier way:

function ComputerName
  set the itemDel to ":"
  return (item 1 of the address)
end ComputerName

So easy!

Thanks (again) Ken.

Cheers,

Terry...

Ken Ray Sons of Thunder Software Web site: http://www.sonsothunder.com/ Email: [EMAIL PROTECTED]

Dr Terry Judd
Lecturer in Educational Technology (Design)
Biomedical Multimedia Unit
Faculty of Medicine, Dentistry & Health Sciences
The University of Melbourne
Parkville VIC 3052
AUSTRALIA

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to