Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Serial Read for Action

If you have a question or need help, this is the place to be.
Post Reply
Wilson2517
Posts: 8
Joined: Thu Nov 05, 2009 5:55 pm

Serial Read for Action

Post by Wilson2517 »

Hi,

I need know how can do capture of "log" and execute an action, but I need to do capture a block to string.
for example:

I have a this string from "Log"
19:26:18 Puerto Virtual.├Á├Á├▓"├│RSWXCHA├┤P01:0├Á├Á├▓ ├│RMINSPR├┤09 03 010000000

Now I need capture only (P01:0)

How can to do for capture this block?

Attach image.

Thanks for Help.
Attachments
Log Eventghost.jpg
miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orl├®ans, France

Re: Serial Read for Action

Post by miljbee »

From what I understand you would like to extract the content of the event payload.

You can get the data from eg.event.payload.

1-Create a new macro
2-Add the action python script
3-Add this to the script : print eg.event.payload
4-Assign your event to this macro
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
Wilson2517
Posts: 8
Joined: Thu Nov 05, 2009 5:55 pm

Re: Serial Read for Action

Post by Wilson2517 »

Hi miljbee

I'm beginner on this forum, and I need learn how to use to eventghost but I use almost less pythonscript.
I need see a example for know how to do.
You could help me with example while learn to program?

Thanks
miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orl├®ans, France

Re: Serial Read for Action

Post by miljbee »

Try this (copy from here, paste in EG)

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1610">
    <Macro Name="Python Script" Expanded="True">
        <Event Name="Puerto Virtual.├â┬Á├â┬Á├â┬▓" />
        <Action>
            EventGhost.PythonScript(u'data = eg.event.payload\nprint data')
        </Action>
    </Macro>
</EventGhost>
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
Wilson2517
Posts: 8
Joined: Thu Nov 05, 2009 5:55 pm

Re: Serial Read for Action

Post by Wilson2517 »

Hi miljbee.

The event name works, but I have a block the string.

My string is 17:07:11 Alarmas.90100032 Date Time MAY 02/12 5:31a0B

How can capture only "Time" from this string??? if I put 17:07:11 "Alarmas.90100032 Date Time MAY 02/12 5:31a0B" works perfect but I need Only capture Time
Dragon470
Experienced User
Posts: 205
Joined: Thu Feb 10, 2011 2:16 am

Re: Serial Read for Action

Post by Dragon470 »

in the python script use:

variable[x:y]


Where x is the starting position of the time and y is the end position.
REMINDER the first position is 0.
Post Reply