Page 1 of 3
File Operations
Posted: Sun Oct 05, 2008 5:01 pm
by Pako
Starting a new topic. Will be allocated for the support and discussion about plugin File Operation. The plugin was established on the basis of discussions in the topic
viewtopic.php?f=5&t=732.
Plugin has two actions. Read from a text file and Write to a text file.
Dialog of action Read is as follows:
Dialog of action Write is as follows:
If are these two actions one after another, can be used for recoding a file.
Please help:
1) Check please the functionality of the plugin.
2) Please check the English strings in dialogues
and possibly design a better versions.
3) Please any suggestions for a apposite icon.
Thanks !
Pako
The latest version you can always find here.
EDIT 11-04-2011: download link changed
Re: File Operations
Posted: Wed Oct 08, 2008 9:43 pm
by Bitmonster
I think you can add it to the SVN trunk.
Re: File Operations
Posted: Thu Oct 09, 2008 5:47 am
by Pako
Bitmonster wrote:I think you can add it to the SVN trunk.
Thanks - done.
Pako
Re: File Operations
Posted: Tue May 12, 2009 2:56 pm
by Pako
New feature added - periodical reading.
Available from build 978.
Tarball here.
Pako
Re: File Operations
Posted: Tue May 12, 2009 3:55 pm
by jsonnabend
Pako, to where does the plugin read? Is there an array variable that holds the text lines?
- Jeff
Re: File Operations
Posted: Wed May 13, 2009 6:05 pm
by Pako
In the case of a single reading (action "Read text from file"), the obtained lines are returned as a list in eg.result.
In the case of periodical reading (action "Start periodical reading"), then obtained lines are available as an event payload (also in the form of the list of lines).
Is the answer clear?
Pako
Re: File Operations
Posted: Wed May 13, 2009 7:02 pm
by jsonnabend
Got it. Thanks, Pako.
- Jeff
Re: File Operations
Posted: Thu Jan 21, 2010 1:07 am
by yakovyarmo
i changed the script and added the option to trigger an event if the file hasn't changed.
should i post the new plugin here?
Re: File Operations
Posted: Thu Jan 21, 2010 1:22 pm
by Pako
@yakovyarmo,
I had not thought that someone would need such a function. But I see, that so.
Of course, I can implement myself, but I was also interested in your solution.
Pako
Not able to pass variables to File Operations Output field
Posted: Mon Apr 11, 2011 4:28 am
by steppedup
Hi all,
Windows 7, x64, Eventghost 3.7 r1486.
How can I pass the value contained within a variable to the standard File Operations plugin, specifically to the the File Operations Write Text to File Action's output file field?
If you hardcode a location, it will write to a file:
When you put in a variable, it does not:
Here are the log contents - I've pointed out where passing the variable's contents doesn't work:
Here's the XML:
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1486">
<Folder Name="test" Expanded="True">
<Macro Name="test" Expanded="True">
<Action>
EventGhost.PythonCommand(u'newFile= "C:\\test.txt"')
</Action>
<Action>
FileOperations.Write(2, u'{eg.result}', u'C:\\test.txt', 2, 0, False, False, False, 'cp1252')
</Action>
<Action>
EventGhost.PythonCommand(u'print "That appended something- even if None to that the test file"')
</Action>
<Action>
FileOperations.Write(2, u'{eg.result}', u'{newFile}', 2, 0, False, False, False, 'cp1252')
</Action>
<Action>
EventGhost.PythonCommand(u'print "That did not append anything to the test file"')
</Action>
</Macro>
</Folder>
</EventGhost>
Thank you!
Re: File Operations
Posted: Mon Apr 11, 2011 8:20 am
by Pako
Please do not create unnecessary new topics!
To support File operations plugin is designed just this topic.
Yes, in the edit-box
Output file was not possible to use
python expression.
I added this option. Before the release of new version EG, you can download the modified version of plugin.
Link to download you can find in the first post of this topic.
Pako
Re: File Operations
Posted: Sat Nov 19, 2011 11:08 pm
by InterlinkKnight
I am searching for something that allow me to read a line in a text and create an event when a specific word is there. This plug in allow this?
Re: File Operations
Posted: Sun Nov 20, 2011 6:51 am
by Pako
Of course, it's very simple:

- observedFile_Tree.png (4.04 KiB) Viewed 18330 times
Pako
Re: File Operations
Posted: Sun Jul 01, 2012 6:56 pm
by waffles
Pako wrote:In the case of a single reading (action "Read text from file"), the obtained lines are returned as a list in eg.result.
In the case of periodical reading (action "Start periodical reading"), then obtained lines are available as an event payload (also in the form of the list of lines).
Is the answer clear?
Pako
First off, I have to admit that I am a complete EG newbie and struggling big time with its steep learning curve.
I am trying to periodically read out certain lines of a file and broadcast the result.
I have been progressing in baby steps:
* I got the part working which extracts the data I want - from both, a periodically and one-time read out
* I can print the result of the one-time read out (=> print eg.result). I was thinking of using the print command for the time being till I get the File module properly working, i.e. before I 'graduate' to the Broadcasting part.
Here is where I got stuck:
*I cannot print the result of a periodical readout.
*I cannot get the broadcasting part working for either, periodically or one-time. I am not clear what to put in under 'Observations and event name' in the File Operations module, not under 'Command' and 'Payload' in the Broadcaster module.
I have been searching here and the web for documentation, but thus far found only rather limited information.
Any advise would be greatly appreciated.
Thanks!
Re: File Operations
Posted: Mon Jul 02, 2012 6:29 am
by Pako
When you use the action "Start periodical reading", so you can not print eg.result. This action does not result, this action only starts the periodic reading.
Content (or certain lines) of file you can only receive as eg.event.payload.
You certainly do not need to actually print the "result".
Perhaps it would be better to write exactly what you need.
Pako