Page 1 of 1

Getting the Computers 'name' on a Mac and Windows

Posted: Thu Aug 12, 2010 10:37 pm
by andyh1234
Is there a quick way to get the computers name on a mac and windows (and potentially linux) with rev?

I dont really want to go down the executing vbscript or applescrip t route as its just a small detail in an app im working on to sync a database between a few computers, and it would be neat to pre-fill the computer name in a form field as a suggestion for the user when they are initially setting up the sync.

I just wondered if there was a simply system style var in runrev that would give me access to this so I can pop it in the field when the card opens.

Thanks

Andy

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Thu Aug 12, 2010 11:31 pm
by mwieder
Yep.

OSX (and possibly linux distros):
put shell("echo $HOSTNAME")

Windows:
put $COMPUTERNAME

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Thu Aug 12, 2010 11:34 pm
by andyh1234
Thanks Mark,

I had tried put $COMPUTERNAME on my mac, I didnt think it might be different cross platform!

Ill use...

if the platform is "Win32" then
put $COMPUTERNAME into tComputerName
else
put shell("echo $HOSTNAME") into tComputerName
end if

That should work a treat!

Thanks again.

Andy

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Fri Aug 13, 2010 12:27 am
by mwieder
Yeah - I tried viewing the $ environment variables with the message box (click on the fourth icon) but it didn't show anything useful, so I brought up a terminal window and typed "set" to see what was available.

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Fri Aug 13, 2010 8:12 pm
by trevordevore
On Mac you could just use 'the hostname' property in Rev. 'the hostname' may return the same value as $computername on Windows as well though I haven't tested.

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Fri Aug 13, 2010 8:40 pm
by mwieder
Trevor-

Good catch. Both the hostname and $COMPUTERNAME return the same value on Windows, although if it matters, hostname is in lowercase and for some reason $COMPUTERNAME is in uppercase.

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Sat Aug 14, 2010 12:31 am
by bn
Trevor,
a bit off topic: today I searched for your wonderful enhancedQT external and eventually found it.
The link you currently have in your post to your developer resources
Releasable Revolution: Resources for Application Developers
is broken.

Thanks again for all the help and resources you provide

regards
Bernd

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Sat Aug 14, 2010 9:33 pm
by trevordevore
Thanks Bernd. It is back up now.

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Mon Aug 16, 2010 3:36 pm
by bn
Trevor,

sorry to bug you, but the link in your 'tag' is still broken.

So are the download links on
http://knowledgefaucet.com/developer/re ... cedqt.html

I was trying to direct someone to that link and did not notice that the download links are broken.

It would be a pitty if people could not reach your wonderful resources for Revolution.

Thank you
regards
Bernd

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Mon Aug 16, 2010 3:54 pm
by trevordevore
I just tested the link in my signature and it works fine. The link you posted is not the actual site. That looks like an old version of the site from some time ago.

Re: Getting the Computers 'name' on a Mac and Windows

Posted: Mon Aug 16, 2010 5:11 pm
by bn
Trevor,

thanks, after emptying the cache of my browser the link works. Sorry about that.

Now your resources are easy to find.

regards
Bernd