Identifying a certain Windows machine

Joe F. joef1 at mac.com
Tue Mar 30 04:06:17 EDT 2010


Wow- that is some answer. Thank you Monte.

I was actually expecting something like "getSystemID" to be built into  
Revtalk, but...

You inspired me to make myself a script library.

Thanks,
Joe F.

On Mar 30, 2010, at 12:07 AM, Monte Goulding wrote:

>
> On 30/03/2010, at 2:51 PM, Joe F. wrote:
>
>> Does anyone know of a way to identify the Windows machine of a  
>> certain user in a reliable way.
>>
>> I want my app to download a stack file which will only run on one  
>> user's machine.
>> Is there a way to access something like a MAC number or some unique  
>> identifier on Windows machines.
>
> Yep:
>
> # GetMACAddress()
> #
> # Function to return the MAC address
> #
> # Makes use of ifconfig on OS X and ipconfig on Windows
>
> function getMACAddress
>  -- value to return
>  local retVal
>  switch (the platform)
>  case "MacOS"
>    if the systemVersion < 10 then
>      -- MacOS
>      set the directory to specialFolderPath("apple")
>      put "tell application" && quote & "Apple System Profiler" & \
>          quote & cr & "get appletalk address" & cr & "end tell" into  
> getMACScript
>      put "tell application" && quote & "Apple System Profiler" & \
>          quote & cr & "close window" && quote & "Apple System  
> Profiler" & quote & \
>          cr & "end tell" into quitASPScript
>      do getMACScript as AppleScript
>      put the result into retVal
>      do quitASPScript as AppleScript
>      replace "{" with "" in retVal
>      replace "}" with "" in retVal
>      replace quote with "" in retVal
>    else
>      -- OS X
>      put shell("ifconfig en0") into ifConfigs
>      if char 1 to 4 of ifConfigs = "zsh:" then
>        return "Error retrieving interface configuration."
>      else
>        get matchText(ifconfigs,"(?s)ether (.*?) ",retVal) -- These  
> are spaces on either side of (.*?)
>        if it is false then
>          return "Error retrieving MAC address."
>        end if
>      end if
>    end if
>    break
>  case "Win32"
>    -- All Windows
>    put (there is a file (specialFolderPath("system") & "/ 
> IPCONFIG.EXE")) into winExists
>    put (there is a file (specialFolderPath("system") & "/SYSTEM32/ 
> IPCONFIG.EXE")) into sys32Exists
>    if winExists or sys32Exists then
>      set the hideConsoleWindows to true
>      put shell("ipconfig /all") into temp
>      get matchText(temp,"Physical Address[\. ]*: ([A-Z0-9-]*)",retVal)
>    else
>      return "Error retrieving MAC address."
>    end if
>    break
>  end switch
>  return retVal
> end getMACAddress
>>
>>
>> Bonus question:
>> Is there a good way to make a stack self-destruct?
>
> Just don't let the user save the file if you only want it run just  
> after the download.
> use:
> go stack url http://www.myserver.com/test.rev
>
> Cheers
>
> Monte
> _______________________________________________
> 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