New topic: 

Shell Class Questions

<http://forums.realsoftware.com/viewtopic.php?t=34272>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        NA9D          Post subject: Shell Class QuestionsPosted: Mon Jun 
14, 2010 1:00 pm                         
Joined: Mon Feb 01, 2010 3:36 pm
Posts: 94                Hey all,

I've got a question about the shell class on the Mac as I'm sometimes seeing 
different results with shell commands run inside my application as compared to 
shell commands run from terminal on my Mac.

For my software, part of the authentication/licensing algorithm uses the host 
name of the computer to generate a code that is then used as part of the 
registration process.  So in my code I have the following lines:

Code: 
 #If TargetWin32 Then
  SystemString1 = System.EnvironmentVariable("COMPUTERNAME")
  SystemString2 = System.EnvironmentVariable("USERPROFILE")
  #Else
  SH.Execute "echo $HOSTNAME"
  
  If Instr(1,SH.Result,".") <> 0 Then               // If the host name has a 
dot in it, then take everything b4 the dot.  Otherwise full name.
  SystemString1 = Mid(SH.Result,1,Instr(1,SH.Result,".")-1)
  ELSE
  SystemString1 = SH.Result
  End
  
  SystemString1= Lowercase(SystemString1)
  
  SystemString2 = System.EnvironmentVariable("HOME")
  #Endif

Now the SH.Execute "echo $HOSTNAME" does not always give me the same result as 
typing "echo $HOSTNAME" in the terminal app.  I have an instance where if I use 
my Sprint data card, I get a hostname in Real Studio that is equal to the IP 
address of the connection with Sprint.  Looking at my network settings, this 
appears to be what my "WINS NetBios" name is.  Yet if I go into Terminal and 
enter "echo $HOSTNAME", I get the correct name of the computer.  So this 
obviously can screw up a user since if the program is run in one network 
connection, it gets one name as part of the authentication process, and gets 
another name when using a different network connection.  I've already had to 
account for the fact that some network connections report back all lower case 
host names and others report back host names with the first letters capitalized 
- hence the "Lowercase" command given above.

So what shell command is Real Studio exactly executing?  How can I get it to 
report just the local name of the computer regardless of whatever network 
connection/name it has been given?

Can anyone provide any insight?

Thanks,

Jon   
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to