Mac - Computer Name - Omnis 11.1 - OS Sequoia

Michael Mantkowski michaelj at clientrax.com
Thu Oct 3 21:36:07 UTC 2024


Your right, the subject has expanded. But that is because I am seeing that we developed a lot of extra code because of assumptions made. However, it appears that some of the TCP Omnis commands are not working correctly, leading us down the wrong path.

We made the assumption that TCPPing did not work with the local IP address. But that was because we were not getting the proper address.

The goal was to Ping the Server to make sure it was online. Then we wrote code for the exception of running Omnis on the Server Computer. However, using the Apple Script work arounds, I am seeing that I can in fact Ping the local IP address which makes that part of the code unneeded.

It looks like to me that " TCPGetMyAddr" and " TCPName2Addr " are not working on Mac. At least on 11.1.

I also tried to use "TCPName2Addr" resolve the IP address of some of the other computers on my network that show in the Macs Network list. But they do not work either. Getting "0".

All these commands seem to work fine on the Windows version of 11.1.

I want to send this information off to Omnis Support. But I want to be sure I am not doing something stupid on the Mac first since I am not well versed.

I half expect Kelly to chime in overnight telling me I'm a dummy again and all I had to do was make this one setting change. lol (No, he never really said I was a dummy, but sometimes I feel like it when he points out the simplest issue that makes it all work.)

*********************************************************************
Michael Mantkowski
ClienTrax Software
1-614-875-2245
*********************************************************************


-----Original Message-----
From: omnisdev-en On Behalf Of Joe Maus
Sent: Thursday, October 3, 2024 5:17 PM
To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Subject: Re: Mac - Computer Name - Omnis 11.1 - OS Sequoia

Hi,

I know the original question was about how to get the machine name but it's morphed into something a little more than that so I thought I'd share how I usually get the IP of the machine's internet aware NIC.  I've used this on a Mac or windows machine with good success. But I'll also marry it with some additional scripts (some already covered here) to get the listing of the interfaces in the machine to see if en0 matches the IP given by the below code, if it does, then we're pretty sure that's the primary interface for the machine.

TCPConnect ('www.google.com',80) Returns sock TCPGetMyAddr (sock,kFalse) Returns lvTCPMyAddrIs TCPClose (sock,0)

Might be useful if you changed google.com to point to the local server you're looking for and see if that returns the IP of the NIC that can see it.

Thought it might be helpful

Joe Maus

> On Oct 3, 2024, at 4:57 PM, Michael Mantkowski <michaelj at clientrax.com> wrote:
> 
> BTW...
> 
> Phil's code to get the local IP does work. Just having issues with the Omnis TCP commands.
> 
> Calculate lcApScript as 'set myip to do shell script "'
> Calculate lcApScript as con(lcApScript,"ifconfig | grep 'broadcast' | 
> awk '{print $2}'") Calculate lcApScript as con(lcApScript,'"') Do 
> $runapplescript(lcApScript,lcIP_Address)
> If pos(kCr,lcIP_Address)
>  Calculate lcIP_Address as mid(lcIP_Address,1,pos(kCr,lcIP_Address)-1)
> End If
> Do replaceall(lcIP_Address,'"','') Returns lcIP_Address
> 
> *********************************************************************
> Michael Mantkowski
> ClienTrax Software
> 1-614-875-2245
> *********************************************************************
> 
> 
> -----Original Message-----
> From: omnisdev-en On Behalf Of Michael Mantkowski
> Sent: Thursday, October 3, 2024 4:41 PM
> To: 'OmnisDev List - English' <omnisdev-en at lists.omnis-dev.com>
> Subject: RE: Mac - Computer Name - Omnis 11.1 - OS Sequoia
> 
> With this command...
> 
>     TCPGetMyAddr Returns iLocalIPAddress
> 
> I always get "127.0.0.1" on the Mac - Should be "192.168.1.246" (As 
> shown in the System Settings / Network / Ethernet window)
> 
> On Windows Omnis 11.1 it always returns the proper IP Address.
> 
> 
> The earlier code for getting the computer name works great. In this 
> case "Michael's Mac mini" However,
> 
>     TCPName2Addr (ctComputerName) Returns #S1
> 
> Always returns "0" in the Mac.
> 
> On Windows it returns the proper IP Address.
> 
> Any ideas on these?
> 
> *********************************************************************
> Michael Mantkowski
> ClienTrax Software
> 1-614-875-2245
> *********************************************************************
> 
> 
> -----Original Message-----
> From: omnisdev-en On Behalf Of Doug Easterbrook via omnisdev-en
> Sent: Thursday, October 3, 2024 11:15 AM
> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Cc: Doug Easterbrook <doug at artsman.com>
> Subject: Re: Mac - Computer Name - Omnis 11.1 - OS Sequoia
> 
> hi Michael.
> 
> I know that the question starts with getting the computer name…..   but then the side track seems to really be about getting the ip address of the computer
> 
> 
> 
> I use two ways to get the local ip address of the machine on OSX
> 
> the built in method — which returns the primary IP address and is 
> usually correct
> 
> TCPGetMyAddr Returns iLocalIPAddress
> 
> 
> OR if I want more, I use Kelly Burgess’s TCP tools to grab the list of interfaces, and what it thinks is the local ip address.
> 
> Calculate iInterfaceList as TCPTools.$interfacelist() Calculate 
> iLocalIPAddress as TCPTools.$localip()
> 
> The first command will return you all active interfaces, from ether net card, to wifi, to VPN’s that are available to the computer since things can be multi homed these days.
> 
> Trouble is with getting the machines IP address these days, is that 
> each machine may have many, and they can be ipv4 or ipv6
> 
> 
> 
> 
> As far as the getEnv command goes, it still works as we use it to get the home directory for mac and windows.     You can see what values are available if you go into the terminal and type ‘env’.     
> 
> 
> turns out 'ComputerName’ is no longer one of those things.    The following command will get you the computer name in terminal.
> 
> 
> 
> scutil --get LocalHostName
> 
> All you have to do is wrap that in applescript if you want it as below 
> (I just verified in on my sequoia machine with studio 11.2)
> 
> Calculate applescript as 'do shell script "scutil --get LocalHostName" '
> Do $runapplescript(applescript,result,errorText)
> 
> 
> 
> 
> 
> I know you have a specific reason for doing this.    Since you are sending it a server, I’m guessing it is to track users, logins or what have you.   Depending on the back end database you are using (eg postgres), there are ways to get this from the server itself.
> 
> 
> 
> 
> 
> 
> 
> 
> Doug Easterbrook
> Arts Management Systems Ltd.
> mailto:doug at artsman.com
> http://www.artsman.com
> Phone (403) 650-1978
> 
>> On Oct 3, 2024, at 6:56 AM, Michael Mantkowski <michaelj at clientrax.com> wrote:
>> 
>> Thanks Phile and Nigel,
>> 
>> I will try this and report back.
>> 
>> Michael
>> 
>> *********************************************************************
>> Michael Mantkowski
>> ClienTrax Software
>> 1-614-875-2245
>> *********************************************************************
>> 
>> 
>> -----Original Message-----
>> From: omnisdev-en On Behalf Of Phil (OmnisList)
>> Sent: Thursday, October 3, 2024 9:54 AM
>> To: omnisdev-en at lists.omnis-dev.com
>> Subject: Re: Mac - Computer Name - Omnis 11.1 - OS Sequoia
>> 
>> Michael,
>> 
>> Begin text block
>> Text:computer name of (system info)
>> Get text block lvScript
>> Do $runapplescript(lvScript,lcComputerName)
>> 
>> or for an IP address:
>> 
>> Calculate lcApScript as 'set myip to do shell script "'
>> Calculate lcApScript as con(lcApScript,"ifconfig | grep 'broadcast' | 
>> awk '{print $2}'") Calculate lcApScript as con(lcApScript,'"') Do
>> $runapplescript(lcApScript,lcIP_Address)
>> If pos(kCr,lcIP_Address)
>> Calculate lcIP_Address as mid(lcIP_Address,1,pos(kCr,lcIP_Address)-1)
>> End If
>> Do replaceall(lcIP_Address,'"','') Returns lcIP_Address
>> 
>> 
>> regards
>> Phil Potter
>> Based in Chester in the UK.
>> 
>> On 03/10/2024 13:48, Michael Mantkowski wrote:
>>> We upgraded one of our Mac clients to Omnis 11.1 yesterday after 
>>> they had
>> upgraded their Mac OS to Sequoia and Omnis 4.3.2.1 would no longer 
>> work for them.
>>> 
>>> Running into an issue with getting the computer name of the 
>>> workstation
>> they are on. We had been using the code below to find it. It no 
>> longer seems to work and the built in Omnis getenv() also does not work.
>>> 
>>> Anyone know how to do this with newer Mac OS version?
>>> 
>>> 
>>> f inMac
>>>  Do code method CodeClass/RunMacShell ("grep '<key>ComputerName</key>'
>> /Library/Preferences/SystemConfiguration/preferences.plist -A 1 | 
>> grep '<string>' ") Returns lvReturn
>>>  Calculate lvReturn as mid(lvReturn,pos('>',lvReturn)+1)  Calculate 
>>> ctComputerName as mid(lvReturn,1,pos('<',lvReturn)-1)
>>> Else
>>>  Calculate ctComputerName as getenv("COMPUTERNAME") End If
>>> 
>>> 
>>> This is all used to eventually get the IP Address of the local 
>>> workstation
>> and the database server so that we can Ping it for online verification.
>> Since the above fails the Ping Fails as well. I ended up having to 
>> disable the whole server verification to get them running last night.
>>> 
>>> 
>>> ********************************************************************
>>> *
>>> Michael Mantkowski
>>> ClienTrax Software
>>> 1-614-875-2245
>>> ********************************************************************
>>> *
>>> 
>>> 
>>> 
>>> _____________________________________________________________
>>> Manage your list subscriptions athttps://lists.omnis-dev.com Start a 
>>> new message ->mailto:omnisdev-en at lists.omnis-dev.com
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
>> new message -> mailto:omnisdev-en at lists.omnis-dev.com
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
>> new message -> mailto:omnisdev-en at lists.omnis-dev.com
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
> new message -> mailto:omnisdev-en at lists.omnis-dev.com
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
> new message -> mailto:omnisdev-en at lists.omnis-dev.com
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com Start a 
> new message -> mailto:omnisdev-en at lists.omnis-dev.com

_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list