A colleague of mine wanted to export all the mapped environments from Natural Studio (SPoD). As we have quite a lot of different environments due to our complex staging concept, manually re-creating this list would be cumbersome.
Long story short: we didn’t find a way to export the environments from within Natural Studio. However, after a quick search I found this file: %PROGRAMDATA%\Software AG\Natural\6.3\Prof\%USERNAME%.PRU
(which translates to C:\ProgramData\Software AG\Natural\6.3\Prof\MACKE.PRU
in my case). It contains all the mapped environments in a text format:
Mapping2 = MAP THEHOST 2720 ALIAS=My environment; MACKE * * fuser=(22,123) ;CONNECTED=FALSE
Here’s a quick regular expression to filter the needed parts from the string:
MAP (.+) ([0-9]+) ALIAS=([^;]+); ([^ ]+) \* \* ([^;]*);.*
- Group 1: Host name (
THEHOST
) - Group 2: Server port (
2720
) - Group 3: Environment name (
My environment
) - Group 4: User ID (
MACKE
) - Group 5: Session parameter (
fuser=(22,123)
)