Afficher le nom du PC [resolu]

Discussion en Français sur NeoBook

Moderator: Neosoft Support

Locked
elcoco6262
Posts: 13
Joined: Wed Nov 19, 2014 3:36 am

Afficher le nom du PC [resolu]

Post by elcoco6262 »

Bonjour à tous,
Tout est dans le titre. Est-il possible d'afficher dans une variable le nom du PC... Si possible sans plugin payant!

Merci d'avance :wink:
Last edited by elcoco6262 on Tue Jun 21, 2016 2:53 am, edited 1 time in total.
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: Afficher le nom du PC

Post by dpayer »

You can get the machine name using a DOS variable and either copy it to the clipboard or to a file.

Example:
In a cmd.exe window type this:
echo %computername% |clip

and then paste the result from the clipboard

or

echo %computername% > file.txt

and then read the value from the file.txt file.

You can do this from a NB RUN command using cmd.exe as the executable and the info above as the parameters
David Payer
Des Moines, Iowa
USA
elcoco6262
Posts: 13
Joined: Wed Nov 19, 2014 3:36 am

Re: Afficher le nom du PC

Post by elcoco6262 »

Mille mercis Dpayer, ça fonctionne bien. ;-) :D

Mon collègue a trouvé une autre solution, pour ceux que cela pourrait intéresser.

Créer une nouvelle fonction VB (F11) :

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


enregistrer la nouvelle commande, par exemple: ComputerName.

Ensuite dans les actions du bouton (ou autre) appeler la fonction avec la commande: call

Pour finir, il ne reste plus qu'à afficher ma variable [thecomputername] dans une zone texte (ou autre) et le tour est joué.

Je n'y pense pas assez à cette bibliothèque de fonctions.
Locked