I don't believe I've missed anything, but I figure I'll ask anyway. Is there currently a way to call the native control method from a script that launches the built-in control dialogue box? In the past/present we use a scripted solution to work around it but was hoping there may be a more simple workaround to just use what's there. An example workflow is we have an embedded mimic that has a script on it, the user clicks the embedded mimic and the script has a menu pop up with something like:
neat thing 1
neat thing 2
neat thing 3
super neat thing
user clicks control and rather than calling our scripted sub, we'd just call something like obj.interface.control with no parameters and it would open the ViewX control dialogue.
Gee that's a good one.
I've obviously forgotten all the traps of that, I was thinking it would be as easy as just calling the method without providing arguments. But that complains about not having the right number of arguments.
I'm therefore as stumped as you in regards to this.
Ok that made me curious if I could get it to work.
This is what I just came up with.
On the control button I set the PickType to 5
Then did this vb script.
Mimic.Layers(0).Item("Btn_2").PickParam = "SCX:////CPointDigitalManual/.Daily Test?CurrentState"
So you just have to construct the string for the Pick Parameter.
I got the SCX... string by setting up a button's Pick Action to do a Method control and then going back and changing from Method to System Command. after selecting system command I press the next button and then copied the string that was shown for Command.
Also of note, I am sure you'll be tsting this outside of your templates first, so you'' be able to switch the mimic into edit mode after the function is run. then you can check and see if it set the pick action correctly, but it does not show up in the PickParam animation, you have to look in the standard Pick action configuration.
Good workaround 🙂
But it wouldn't work if it was used on a shared embedded mimic right? since Mimic_Load would only get called on first entry into the cache, and hence the PickParam would be identical for every instance..
There must be a way to do it with pure script though, perhaps if there was a User Method configured on the point which just called the Control / CurrentValue method (as appropriate) and then you could call that User Method via the object interface model...
That might get around the VBA complaint I got on the incorrect arguments
Looks like you went down a similar path that I did! Ultimately this still won't do what we're trying to do though. The goal is to have a pick action load menu list, then from the list call the native dialogue. if from the list we change the pick of the object altogether (which often times is an embedded mimic) we'd have to have a way of changing it back to the normal list behavior after the user enters a value, which just over complicates things a bit.
Your solution works in the event that the pick param is configured to call the method, but I'm still not sure a way to call this from a script out of a menu list.
Workflow in my head would go...
1) click the object to reveal a menu list that is built dynamically though script
2) click "control" from the scripted pick menu. this would call a internal method that launches the dialogue
There has got to be a way! lol
I just tried the way I thought of with the User Method, and the User Method itself doesn't allow to call the Control.Control (or HandControl on an Internal Point) without providing an argument.
Which makes me think that it's just not possible 😞 (without doing some really wacky stuff)
Perhaps if you created a ViewX Interface (the unsupported COM way) then you could use that to call the Control, but then I don't think it would be nice at all.... typically it doesn't have a visible instance, so I'm not sure how you'd go about getting a visible instance, and then it would be separate from the existing ViewX instance.. and there might be some weird stuff in that...
I'm not even sure there is a clean way for Schneider / AVEVA to implement what we'd like in the framework. It couldn't be a new method call on the object itself, since what would that mean if there wasn't a ViewX client to display the dialog... so it would need to be like a script method, but then it only applies on certain objects, so that seems like it wouldn't fit the script model either.
I suddenly thought that maybe passing 'nothing' or 'null' into the action might have done the job... but it appears to consider that equivalent to 0 and sets this value (rather than prompting), at least when I tested it on the Override of an internal analog point.
I think it needs another scripting function, perhaps like App.InvokeMethod( string PickParam from Method animation )
I've tried taking the 'link' from the PickParam of the method and passing it into all the various Navigate / Open options.. none seemed to do the job. For my internal point, the method PickParam looked like this.
SCX:////CPointAlgManual/!test.New Analog Point?CurrentValue
My thought was that in the App.InvokeMethod syntax I propose it would then be:
App.InvokeMethod( "SCX"////CPointAlgManual/!test.New AnalogPoint?CurrentValue")
It does seem like it might be quite a bit of development effort for this, or similar, from Schneider/AVEVA... so I'm not sure it would get on a roadmap. But worth feature requesting something all the same 🙂
EDIT: My API was bad.. keeping in line with the animation property would be better.
Discuss challenges in energy and automation with 30,000+ experts and peers.
Find answers in 10,000+ support articles to help solve your product and business challenges.
Find peer based solutions to your questions. Provide answers for fellow community members!