You can do it two ways. You can use "zscript:" for the path, adding the switch name. Or you can use the numerical position relative to the button you are using, so one place to the left is -1, one place to the right is 1, etc.
[CODE][ISwitch,"Left",0,"Popup info Text",,,,]
[IButton,"Get States from paths","Get switch states",
[Note,[StrMerge,"Left state is ",[IGet,"zscript:Left"]," Right state is ",[IGet,"zscript:Right"]],,2]
[IButton,"Get States from relative position","Get switch states",
[Note,[StrMerge,"Left state is ",[IGet,-2]," Right state is ",[IGet,1]],,2]
[ISwitch,"Right",0,"Popup info Text",,,,][/CODE]
Note - I've used [IGet] in my example to test if the switch is pressed/unpressed as it is a simpler way to demonstrate the code. [IGetStatus] will show whether the switch is enabled or not just as well.
Fantastic! I never knew about the relative positions! Thanks so much Marcus. Once again you always have the answer I am looking for I just assumed the path "Zscript:" was for the toolbar menu only.
Will the relative position way work in other menus too?
If I remember correctly, the relative position way will work in plugin menus, though I don't use it as I often move stuff around when I'm writing a plugin. It's also easier to read and manage the code if the paths are there.