Jump to content
Sign in to follow this  
Angelo Luchi

Get Computer Name

Recommended Posts

If anyone was ever looking to get the computer name of the client rather than the host, here is the groovy to do that:


import java.util.*;

import java.lang.*;

import java.net.*;



try{

   String computername = InetAddress.getLocalHost().getHostName();

   return(computername);

 }catch (Exception e){

   return("Exception caught ="+e.getMessage());

}

Enjoy!

Angelo Luchi

The Drooling Dog, LLC.

www.thedroolingdog.com

1-877-810-8378

Share this post


Link to post
Share on other sites

That's a good script.

If you want the computer's IP address, network card, gateway, etc, you can also issue a shellscript:

ipconfig /all

using the Run Shell Script function included with SM. For OSX a different function would be used.

Share this post


Link to post
Share on other sites

On Mac you can use plain AppleScript, in a Perform AppleScript function. There is a function, system info, that returns several things:

computer name of (system info)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.