Source language: Translate to:

get computername

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

get computername

Postby dpayer » Fri Aug 07, 2009 1:34 pm

I needed to include the machine name in a batch file I was creating via NB.

In batch scripts you can get the computer name of the machine running your application by using the batch variable

%computername%

I didn't see a NB function for this so I found a simple VB script to do this and I thought I'd share it in case it would be useful to anyone else.

Create a function and enter this as its content:

Code: Select all
set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
publication.nbSetVar "[thecomputername]", sComputername


Call the function by whatever name you gave it and the variable [thecomputername] will hold the name of your machine.

This same method can be used to gather almost any kind information about your machine and its configurations. Google is your friend to see how others have created VB / wscript / scripts to get this kind of info.
User avatar
dpayer
 
Posts: 1382
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby cp4w » Mon Aug 17, 2009 2:59 pm

Thank you very much for your function.

Licia
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

cron