FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
04-28-2022 12:09 PM
Hello Everyone,
I am trying to use this simple example with the WebIQ HTML widget. The code works correctly but if I paste it into the "HTML code" section of the widget then the Java part of the json file no longer works.
You can find the file in the zip folder, I simply copied the html code into "Html Code".
Can you tell me what's wrong? I've tried pointing to the json file and creating the same one with the "code manager" tool and then pointing to that but nothing. I've also tried putting the files in the appropriate folders inside WebIQ for css and local scripts. Both the image and the css settings work, it's only the animation via java script that never works.
Thank you very much!
Solved! Go to Solution.
04-28-2022 12:51 PM
WebIQ is a web HMI and as such all files have to be delivered by the web server.
On the internet the browser security model prevent local access to files, as such you cannot use any local paths on your local disk:
The proper way to implement this with WebIQ would be to create a LocalScript in Code Manager, add the code from animate.js and from the body of the HTML document there, add the LocalScript to your HMI in the Layout Manager, create a new Stylesheet in the Code Manager with the CSS code from style.css.
The HTML widget inserts HTML code into the HMI - the HTML standard forbids multiple DOCTYPE declarations. You can insert HTML using the HTML widget, but not a complete document as this would not be valid HTML.
04-28-2022 01:41 PM
Thank you very much for your reply.
I had already tried to create a local script via the code manager but it didn't work, is it because I only inserted the javascript code inside animated.json? Do I have to insert the html part inside the local script too? If so, could you please tell me where?
This is my local script at the moment
Thank you very much.
04-28-2022 02:04 PM
What are you actually trying to achieve? It might be easier if you explain what you are trying to achieve in detail: animating somethng?
Maybe there's a better way to do that.
04-28-2022 02:17 PM
Yes in general, animate an image or a text.
I was actually trying to figure out how to use custom scripts in webIQ starting with the simplest.
However, an animation like the one in my example or similar does not need to be a specific type.
Thanks you very much.
04-28-2022 02:36 PM
What would be the trigger for the animation? Clicking on something? When an item changes its value?
04-28-2022 02:51 PM
When an item changes its value it would be great, thanks you!
04-29-2022 03:02 PM
I have attached a simple demo using your code illustrating the use. For demonstration purposes the internal item "SInt" has been used and a LocalScript and a custom CSS stylesheet has been created in the Code Manager.
Please also note the class name "brickToAnimate" which has been added to the image widget.
04-29-2022 03:50 PM
Thank you very much,
unfortunately I'm still using version 2.10.0 of webIQ so I can't open it and at the moment I can't update it due to problems with the CtrlX server, if you can pass me a version in 2.10 you'd be doing me a favour if not it's fine as it is, I'll import the files manually.
Thank you very much!
04-29-2022 04:10 PM
Sorry, but you can simply install WebIQ 2.11 on a different system and then see how it was done - then you also know what to copy.
04-29-2022 04:29 PM
I've tried downloading version 2.11 both on a real machine and on a dedicated virtual machine but without connecting to CtrlX CORE it won't start, but on CtrlX CORE I have the app WebIQ Server 02.10.0 so it won't start even if I connect.
05-02-2022 08:02 AM
You can signup on https://www.smart-hmi.com/signup/ and get a free 30-day trial key which you can use locally without any connection to ctrlX.
05-02-2022 08:58 AM
05-02-2022 09:14 AM
Tjanks you, where should I enter the licence? It didn't ask me during the installation and in the licence manager that I see in 2.10 I can't enter it because I would have to connect first. Thank you very much.
05-02-2022 09:21 AM
Thanks you, so there is no 2.11 app for ctrlx core yet? Because I was thinking of updating everything but if so I avoid. Where should I enter the licence? It didn't ask me during the installation and in the licence manager that I see in 2.10 I can't enter it because I would have to connect first. Thank you very much.
05-02-2022 10:51 AM
05-02-2022 11:21 AM
So I have to use an external app to activate the free WebIQ licence? And then how do I do that if I can't connect to ctrlX CORE? Then the license manager asks me for a file not a code andI already have the 150items license for version 2.10 on the ctrlX.
I give up, thanks a lot for the help.
05-02-2022 11:43 AM
If you installed WebIQ 2.11 on your system and start WebIQ Designer using the normal shortcut (i.e. not connecting to ctrlX) it will automatically prompt you to enter your WebIQ license key if you no not yet have a valid license. If not you can follow the instructions here: https://www.smart-hmi.de/user/download/deliver/docs/documentation-manual-license-installation-2-2.11...
05-02-2022 11:58 AM
05-02-2022 12:30 PM
It doesn't to me, I've tried to install several times, on real and virtual machines but all I get is this:
It only works when I connect it to ctrlX but then it says the versions are not compatible.
I also tried in the properties of the desktop link to enter localhost, ip address, different ports, I tried to replicate the local server of version 2.10. Nothing worked. Sorry for the time I have wasted on you.
05-02-2022 12:57 PM
Just to clarify: when you connect with WebIQ Designer to a ctrlX instance using --ws-host command line parameter ctrlX licensing is handling your license.
If you start WebIQ Designer normally there is no connection whatsoever to ctrlX which means that you need to have a WebIQ license which is the one you get for free when signing up for 30 days. This has to be enterd in WebIQ Designer when you are prompted to enter it.
Regarding the error message: If it occurs while you are *not* connecting to ctrlX using the --ws-host parameter please check in the Windows services panel if the two WebIQ services are running - if not please start them manually. Then the error would not be shown.
05-04-2022 10:57 AM
I managed to start WebIQ 2.11 some windows network settings were blocking the start of the web service even manually but I solved it and managed to implement the example project in my own. Thanks a lot for the help. Very useful!
05-04-2022 03:17 PM
WebIQ 2.11 is now available in ctrlX shop for ctrlX CORE. The app for ctrlX CORE virtual is not yet available.