If you are trying to open the main screen when a PLC variable tag goes true the following code in this code im assuming your PLC variable is of a boolean data type for simplicity, if it is an Interger adjust accordingly, im typing this code from memory so you would need to adjust it accordingly if my syntax is wrong, if you see a ' symbol it means its the identifier for comments i highlighted this in bold letters
'Start your main Function
Sub Main()
'Create the Variable that we will store the value of the actual PLC variable in this case the variable is called p
Dim p As Boolean
'Lets reference your actual PLC tag thats a tag in cimplicity to the variable that we created called p
p = PointGet("PLC Variable tag")
'Now that your p is referencing the plc tag you have assigned, start your If statment to open a .cim screen that you specify type the name of the screen excluding the .cim part into the parameter CIM_SCREEN_TO_OPEN
If p = TRUE Then
Set MyApplication = CreateObject("CimView")
Set MyScreen = MyApplication.ActiveScreen
MyProjectDir = Environ("SITE_ROOT")
MyNewScreen = MyProjectDir & "screens\"CIM_SCREEN_TO_OPEN".cim"
Myproject = PointGet("$PROJECT")
Newscreen = Myapplication.Open(MyNewScreen,Myproject,True)
End if
End Sub
This code should open a .cim screen when a plc tag that you assign goes true. Hope this helps