Computer Name, etc..

Bonjour,
En vba, on arrive sous excel a recuperer le computerName, le nom de l’username,… Etc…
Le peut-on sous xojo?

Bonjour,

Ca doit tre faisable avec System.EnvironmentVariable

Pour connatre les variables compatible, ouvrir une fentre de commande sur Windows et taper la commande “SET”

avec les plugins MBS:

SystemInformationMBS.ComputerName as String

Sous Windows:

Dim s As String = System.EnvironmentVariable("COMPUTERNAME")

Pour Mac OS, je crois me souvenir que MacOSLib a une fonction pour cela… Elle ne devrait tre trop difficile trouver !

Try this:

[code]Dim sh as new Shell
Dim cmd as String
dim lt_string( ) as string
dim Hostname as string

#If TargetWin32 Then
Hostname = system.environmentvariable(“COMPUTERNAME”)
#Else
cmd = “hostname”
sh.Execute(cmd)
lt_string = split(sh.Result,chr(10))
for i as integer = 0 to lt_string.Ubound
Hostname = lt_string(i)
exit
next
#EndIf[/code]