SuperCard 4.8 Indexed Address

Need help with a script? This is the place to discuss how to get your code running!

SuperCard 4.8 Indexed Address

Postby codegreen » Fri Apr 08, 2016 4:51 pm

SuperCard has a global property called the address (which can also be invoked as a function) that returns the current application's AppleEvent target address.

Originally the address consisted solely of the program name (i.e., SuperCard, SuperCard Player, or the name of your standalone). In OS X this grew into the application's remote event address, which also includes its host's local network address if any (e.g., eppc://192.168.1.100/SuperCard).

As a result this property gradually began to be used as much or more for obtaining your host's IP address as for your event target id.

Nowadays though (between multiple Ethernet ports and Airport) it's not uncommon for Macs to have more than one IP address. But how can you find out what they all are?

Starting in SuperCard 4.8b13 you can pass address() a one-based index to iterate over the active network addresses.

For example, say your Mac isn't connected to a local network:

Code: Select all
  put the address -- SuperCard
  put address[1]  -- SuperCard
  put address[2]  --

If you have one network address:

Code: Select all
  put the address -- eppc://192.168.1.100/SuperCard
  put address(1)  -- eppc://192.168.1.100/SuperCard
  put address(2)  --

And if you have two:

Code: Select all
  put the address -- eppc://192.168.1.100/SuperCard
  put address(1)  -- eppc://192.168.1.100/SuperCard
  put address(2)  -- eppc://192.168.1.101/SuperCard
  put address(3)  --

Etc.

Enjoy!
-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm

Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 1 guest

cron