I wanted to use local variables in my script related to event mouseclick.
But I have found out that for Execute ST code those local variables are not visible (even in Input assistant).
The strange is that if I use function Write/Toggle variable those variables are available for use.
Do you know if there is any chance to use there variable inside the script. It would be much easier for use and keep HMI part separated from PLC part.
just up of the topic;)
IsnΒ΄t there any possibility of using local variables of screen in corresponding Input configuration event - Execute ST code?
It would be really helpful.
Just update: Even in other input actions they can be used, e.g. Open Dialog etc. See picture. I still do not get why they are hidden for ST-Code.
may I have a couple additional question to local vars?
1) Is it possible to monitor value of them during Login?
2) Are they initialized always as soon as the visualisation is opened/closed?
(I struggle a little bit how to realized initialization of some values when the screen is opened/closed -> usually in HMI sw there are scripts corresponding to those events but I cannot find easy way in Codesys visu for that -> only create PLC program to handle that which is not as easy;)).
Btw. -> your hint works perfectly.
Thanks a lot.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I wanted to use local variables in my script related to event mouseclick.
But I have found out that for Execute ST code those local variables are not visible (even in Input assistant).
The strange is that if I use function Write/Toggle variable those variables are available for use.
Do you know if there is any chance to use there variable inside the script. It would be much easier for use and keep HMI part separated from PLC part.
Thanks a lot.
Regards.
more posts ...
Hi,
just up of the topic;)
IsnΒ΄t there any possibility of using local variables of screen in corresponding Input configuration event - Execute ST code?
It would be really helpful.
Just update: Even in other input actions they can be used, e.g. Open Dialog etc. See picture. I still do not get why they are hidden for ST-Code.
Thanks a lot.
M.
Last edit: macros8 2023-07-18
Hi,
you can use local variables in the ST code action
it's just not shown in the input assistant.
as workaround use
THIS^.iPassFirstTry
Hi Fless,
awesome, I believed itΒ΄s somehow possible.
Thanks a lot.
M.
Hi Fless,
may I have a couple additional question to local vars?
1) Is it possible to monitor value of them during Login?
2) Are they initialized always as soon as the visualisation is opened/closed?
(I struggle a little bit how to realized initialization of some values when the screen is opened/closed -> usually in HMI sw there are scripts corresponding to those events but I cannot find easy way in Codesys visu for that -> only create PLC program to handle that which is not as easy;)).
Btw. -> your hint works perfectly.
Thanks a lot.