Getting the Serial Number of the User's computer

Paul Looney support at ahsomme.com
Tue Dec 9 17:17:49 EST 2008


Ken,
It worked perfectly, of course.
Thank you.
Paul Looney

On Dec 9, 2008, at 2:06 PM, Ken Ray wrote:

>
>> How can I retrieve the computer serial number in OS X, Vista and
>> Linux from Rev?
>
> Here's what I have, Paul... for OS X it can take a while (a few  
> seconds) to
> get the number on OS X (since it has to go through a series of  
> different
> "system_profiler" data types), but it works (watch for wraps):
>
> function stsGetSerialNumber pWinDriveLetter
>    local tID
>    switch (the platform)
>       case "MacOS"
>          put shell("system_profiler SPHardwareDataType") into tData
>          put matchText(tData,"(?s)Serial Number:\W*(.*?)\n",tID) into
> tIsMatch
>       break
>       case "Win32"
>          if pWinDriveLetter = "" then put "C:" into tDriveLetter
>          else put pWinDriveLetter into tDriveLetter
>          if length(tDriveLetter) = 1 then put ":" after tDriveLetter
>          set the hideConsoleWindows to true
>          if the shellCommand <> "command.com" then
>             put shell(tDriveLetter && "& dir") into tData
>          else
>             put "c:\temp.bat" into tBatPath
>             put tDriveLetter & cr & "dir" into url ("file:" &  
> tBatPath)
>             put shell("start" && tBatPath) into tData
>             delete file tBatPath
>          end if
>          put matchText(tData,"(?s)Serial Number is\W*(.*?)\n",tID)  
> into
> tIsMatch
>       break
>    end switch
>    if tIsMatch then
>       return tID
>    else
>       return "STSError: Can't locate serial number."
>    end if
> end stsGetSerialNumber
>
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list