Author Topic: Detecting if profile is loaded under another profile  (Read 4097 times)

bholcomb007

  • Newbie
  • *
  • Posts: 13
Detecting if profile is loaded under another profile
« on: March 08, 2018, 10:07:06 AM »
Is there a way to detect if a profile is loaded under the "Load commands from another profile" section? In other words, can I detect if it is loaded under a "parent: profile?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Detecting if profile is loaded under another profile
« Reply #1 on: March 08, 2018, 01:04:25 PM »
You can use the "{PROFILE}" token, which will return the name of the currently loaded profile(I.E. the top profile that loads all others below it); If that name isn't the name of your profile, it must logically mean your profile is running as an included profile.

E.G.
Code: [Select]
Begin Text Compare : [{PROFILE}] Does Not Equal 'The name of the profile you're checking'
    Write '[Blue] This profile is loaded as an included profile' to log
Else
    Write '[Blue] This profile is loaded as the active profile' to log
End Condition


If this is for a plugin(as you've posted in the plugin section), you can use the "GetProfileName()" function directly and do basically the same thing:
Code: [Select]
if (vaProxy.GetProfileName() != "The name of the profile you're checking")
{
    vaProxy.WriteToLog("This profile is loaded as an included profile", "blue");
}
else
{
    vaProxy.WriteToLog("This profile is loaded as the active profile", "blue");
}
Assuming you're using C#
« Last Edit: March 08, 2018, 01:09:00 PM by Pfeil »

bholcomb007

  • Newbie
  • *
  • Posts: 13
Re: Detecting if profile is loaded under another profile
« Reply #2 on: March 08, 2018, 02:28:01 PM »
Super thanks!
Yes, I do use C# and that can be helpful since I am making a plugin/profile for adding on to the singularity profile and this will work perfectly so I can inform the user it is required in the display log.