File Operations

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

File Operations

Post by Pako » Sun Oct 05, 2008 5:01 pm

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:
FO-Read.png
Dialog of action Write is as follows:
FO-Write.png
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

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: File Operations

Post by Bitmonster » Wed Oct 08, 2008 9:43 pm

I think you can add it to the SVN trunk.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: File Operations

Post by Pako » Thu Oct 09, 2008 5:47 am

Bitmonster wrote:I think you can add it to the SVN trunk.
Thanks - done.
Pako

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: File Operations

Post by Pako » Tue May 12, 2009 2:56 pm

New feature added - periodical reading.
Available from build 978.
Tarball here.
Pako

jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: File Operations

Post by jsonnabend » Tue May 12, 2009 3:55 pm

Pako, to where does the plugin read? Is there an array variable that holds the text lines?

- Jeff

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: File Operations

Post by Pako » Wed May 13, 2009 6:05 pm

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

jsonnabend
Experienced User
Posts: 127
Joined: Wed Apr 23, 2008 7:35 pm

Re: File Operations

Post by jsonnabend » Wed May 13, 2009 7:02 pm

Got it. Thanks, Pako.

- Jeff

yakovyarmo
Posts: 18
Joined: Mon Jul 27, 2009 12:01 am

Re: File Operations

Post by yakovyarmo » Thu Jan 21, 2010 1:07 am

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?

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: File Operations

Post by Pako » Thu Jan 21, 2010 1:22 pm

@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

steppedup
Posts: 7
Joined: Fri Apr 08, 2011 10:58 am

Not able to pass variables to File Operations Output field

Post by steppedup » Mon Apr 11, 2011 4:28 am

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:

Image

When you put in a variable, it does not:

Image


Here are the log contents - I've pointed out where passing the variable's contents doesn't work:

Image

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!

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: File Operations

Post by Pako » Mon Apr 11, 2011 8:20 am

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

User avatar
InterlinkKnight
Posts: 29
Joined: Mon Sep 13, 2010 1:17 am
Contact:

Re: File Operations

Post by InterlinkKnight » Sat Nov 19, 2011 11:08 pm

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?

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: File Operations

Post by Pako » Sun Nov 20, 2011 6:51 am

Of course, it's very simple:
observedFile_Tree.png
observedFile_Tree.png (4.04 KiB) Viewed 13169 times
searchedWord.png
Pako

waffles
Posts: 17
Joined: Sun Jul 01, 2012 3:38 am

Re: File Operations

Post by waffles » Sun Jul 01, 2012 6:56 pm

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!

User avatar
Pako
Plugin Developer
Posts: 2274
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: File Operations

Post by Pako » Mon Jul 02, 2012 6:29 am

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
Attachments
FileOperation_1.png
FileOperation_1.png (9.55 KiB) Viewed 12235 times
FileOperation_2.png

Post Reply