Hello everyone,
I'm working on one project where I need to send some Hex sequence one by one to serial port and I would like to know how to do it from command line in order to perform action from Jenkins.
Right now I know only how to open saved configuration
ScriptCommunicator.exe -withScriptWindow -notMinimized -CC:\Users\Tijana\Documents\ScriptCommunicator\initialSettingsWin.config
What should I use to start testsequence.seq to execute all lines?
you cannot execute a sequence script or sequences from the Send Window from command line. But you can execute a worker script that contains your sequence:
ScriptCommunicator.exe -withScriptWindow -notMinimized C:/sequence.js
You can find an example worker script in the attachment.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2020-12-23
Hi Stefan,
Thank you so much for your kind help. I manage to create script with sequnces and all is working fine if I start script manually from Scriptcommunicator window. Now, I have tried to create .sce file in order to start actual scenario from command line. I come accross issue that actual script can't be open this is what I get when I execute following command line:
ScriptCommunicator.exe -C"C:\Users\Tijana\Documents\ScriptCommunicator\test.config" "C:/Users/Tijana/Downloads/citanjeserijskog/citanjeerijskog.sce"
If you can please guide me how to resolve this.
Thank you.
Tijana
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
your sce file and your script worked fine. 'The only thing I had to do is to create a folder 'scripts' in the folder of the sce file and put sequence.js inside of it (the path to your script in the sce file is "./scripts/sequence.js").
Regards,
Stefan
Last edit: Stefan Zieker 2020-12-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By the way, you can connect/disconnect the main interface from inside your script. Then you don't need any config file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2020-12-23
Hi Stefan,
I just manage to start script from command line, but I do not see any result of the execution in log file. Do you have some suggestion what to check? You can see in video what is happening.
Kind regards,
Tijana
the reason why your log file is empty is that ScriptCommunicator ingores the config file if a script or a sce file is in the command line options (I will add this information to the manual).
In other words, you have to:
1. connect the main interface from script
2. create your log file from script (writeFile or writeBinaryFile)
If you receive binary data and you want to save it as an hex string you can use conv.byteArrayToHexString to convert the received data (byte array).
If you receive strings then you can use conv.byteArrayToUtf8String to convert the received data.
Regards,
Stefan
Last edit: Stefan Zieker 2020-12-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2020-12-24
Hi Stefan,
Thank you so much for all your help.
I just manage to build completely working script for actual scenario where I'm going to use Script Communicator. It took me a while and some help of my collegues and we are very happy with end result. In case that someone in future need to use ScriptCommunicator in order to send hex data over serial port and collect all output and input in textual file I will attache example of my script.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are using the Main Interface. Is your Main Interface connected?
You can connect it manually (Settings Window) or by script:
scriptInf.connectSerialPort("COM1", 19200);
Last edit: Stefan Zieker 2022-01-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2022-01-24
Thanks I was able to get what i wanted done with your help .. what would i need to do to implement disconnect from the COM1 connection once it has been ran, I must of overlooked this part
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everyone,
I'm working on one project where I need to send some Hex sequence one by one to serial port and I would like to know how to do it from command line in order to perform action from Jenkins.
Right now I know only how to open saved configuration
ScriptCommunicator.exe -withScriptWindow -notMinimized -CC:\Users\Tijana\Documents\ScriptCommunicator\initialSettingsWin.config
What should I use to start testsequence.seq to execute all lines?
Hi,
you cannot execute a sequence script or sequences from the Send Window from command line. But you can execute a worker script that contains your sequence:
ScriptCommunicator.exe -withScriptWindow -notMinimized C:/sequence.js
You can find an example worker script in the attachment.
Hi Stefan,
Thank you so much for your kind help. I manage to create script with sequnces and all is working fine if I start script manually from Scriptcommunicator window. Now, I have tried to create .sce file in order to start actual scenario from command line. I come accross issue that actual script can't be open this is what I get when I execute following command line:
ScriptCommunicator.exe -C"C:\Users\Tijana\Documents\ScriptCommunicator\test.config" "C:/Users/Tijana/Downloads/citanjeserijskog/citanjeerijskog.sce"
If you can please guide me how to resolve this.
Thank you.
Tijana
Hi Tijana,
can you upload your sce file and your script please?
Regards,
Stefan
Last edit: Stefan Zieker 2020-12-23
Hi Stefan,
Thank you for your fast feedback. You can find in attachment script and .sce file.
Kind Regards,
Tijana
Hi Tijana,
your sce file and your script worked fine. 'The only thing I had to do is to create a folder 'scripts' in the folder of the sce file and put sequence.js inside of it (the path to your script in the sce file is "./scripts/sequence.js").
Regards,
Stefan
Last edit: Stefan Zieker 2020-12-23
By the way, you can connect/disconnect the main interface from inside your script. Then you don't need any config file.
Hi Stefan,
I just manage to start script from command line, but I do not see any result of the execution in log file. Do you have some suggestion what to check? You can see in video what is happening.
Kind regards,
Tijana
Hi Tijana,
the reason why your log file is empty is that ScriptCommunicator ingores the config file if a script or a sce file is in the command line options (I will add this information to the manual).
In other words, you have to:
1. connect the main interface from script
2. create your log file from script (writeFile or writeBinaryFile)
example for the serial port:
example log file:
If you want to override/clear the file then you have to do this:
Regards,
Stefan
Last edit: Stefan Zieker 2020-12-23
Hi Stefan,
You have help me a lot. Now the last thing will be: How to save output from serial port in File?
Kind regards,
Tijana
Hi Tijana,
here is an exampe code:
If you receive binary data and you want to save it as an hex string you can use conv.byteArrayToHexString to convert the received data (byte array).
If you receive strings then you can use conv.byteArrayToUtf8String to convert the received data.
Regards,
Stefan
Last edit: Stefan Zieker 2020-12-23
Hi Stefan,
Thank you so much for all your help.
I just manage to build completely working script for actual scenario where I'm going to use Script Communicator. It took me a while and some help of my collegues and we are very happy with end result. In case that someone in future need to use ScriptCommunicator in order to send hex data over serial port and collect all output and input in textual file I will attache example of my script.
Cheers,
Tijana
Hi Tijana,
I'm glad I could help you. And thx for sharing your script.
Cheers,
Stefan
I am just trying to send a hex command to a device that connected via RS-232, when i send command script, nothing happens but this is what i see
You are using the Main Interface. Is your Main Interface connected?
You can connect it manually (Settings Window) or by script:
Last edit: Stefan Zieker 2022-01-24
Thanks I was able to get what i wanted done with your help .. what would i need to do to implement disconnect from the COM1 connection once it has been ran, I must of overlooked this part
You must call scriptInf.disconnect() to disconnect the Main Interface.
Last edit: Stefan Zieker 2022-01-25
Stefan I have to say this program works flawlessly, thanks so much for the time you put into it and the help that you provide afterwards
:-)
HI,
I would like to read data in a loop with some delay in between, how to do that?
thanks
Hi,
what are you exactly trying to do (are you writting a worker script?)?