New system plugin "Write result to file"

Got a good idea? You can suggest new features here.
User avatar
Pako
Plugin Developer
Posts: 2280
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

New system plugin "Write result to file"

Post by Pako » Mon Feb 11, 2008 3:14 pm

I made new system plugin "Write result to file".

Using:
Handover information the other program. For example for co-operation with application Samurize.


Testing:
a)Copy file WriteResultToFile.py to folder (for example) "C:\Program Files\EventGhost\plugins\System\"
b)Edit file __init__.py in folder (for example) "C:\Program Files\EventGhost\plugins\System\"
1)Find line "from Execute import Execute"
2)Before or behind this line insert new line with text "from WriteResultToFile import WriteResultToFile" (without quotes).
3)Find line " self.AddAction(ResetIdleTimer)"
4)Behind this line insert new line with text " self.AddAction(WriteResultToFile)" (without quotes).
Attention ! Must to be the same indent !
c)Copy file page_white_edit.png to folder (for example) "C:\Program Files\EventGhost\plugins\System\icons\"
d)Restart EG

Pray for corrections mine bad English.

Pako
Attachments
page_white_edit.png
page_white_edit.png (1.04 KiB) Viewed 8203 times
WriteResultToFile.py
(3.29 KiB) Downloaded 332 times

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

Re: New system plugin "Write result to file"

Post by Pako » Thu Feb 28, 2008 2:51 pm

I have new version of my plugin.
He has enhancement about option codepage.
Perhaps needs more improve, because for some options discovers UnicodeEncodeError.
Has it but sense solve ?

For data transfer to Samurize I advise use RAMdisk. Work it very nice.

Pako
Attachments
WriteResultToFile.py
Version 0.1.1
(5.1 KiB) Downloaded 290 times

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

Re: New system plugin "Write result to file"

Post by Bitmonster » Tue Mar 11, 2008 7:02 pm

Well, I looked at it and I'm not sure if we should add it to the System actions. I think most people who knew how to use the eg.result variable and like to write some data to a file, will in most cases have no problem to write a simple script like:

Code: Select all

outfile = open("C:\\myfile.txt", "w")
outfile.write(str(eg.result) + "\n")
outfile.close()
or something like that.

And for most cases I can imagine, it is not enough to only write eg.result. It will very seldom be enough or the user would have to construct his eg.result with some additional actions. And then we are back in the domain of PythonScripts, that are much more versatile.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

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

Re: New system plugin "Write result to file"

Post by Pako » Tue Mar 11, 2008 8:19 pm

Well, I receive.
I'm think of less efficient user, which could make for instance this (see picture)
for example for logging.

Pako
Attachments
Demo.jpg
Demo.jpg (6.96 KiB) Viewed 8048 times

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

Re: New system plugin "Write result to file"

Post by Pako » Wed Jun 04, 2008 11:58 am

I'm remake "Write result to file" plugin.
Now he have name "Write text to file". He is more versatile and he isn't system plugin, but "other" plugin.
Now he can write down not only {eg.result}, but also a variable - for instance "{eg.globals.RStitle}".
Plugin nowadays can serve also like a logger (added option "Log Times").
I think, that in these form would this plugin already may be incorporation to beta version.
Or still appear to be useless ?

Pako
Attachments
WriteTextToFile.jpg
Screenshot
__init__.py
Version 0.1.0
(8.03 KiB) Downloaded 326 times

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

Re: New system plugin "Write result to file"

Post by Bitmonster » Mon Jun 23, 2008 6:22 pm

Looks much more practical. I will take a deeper look once 0.3.6 is officially released.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

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

Re: New system plugin "Write result to file"

Post by Pako » Tue Sep 30, 2008 10:23 am

I made a new, greatly expanded version of the plugin "WriteTextToFile".
I used here the slightly modified function "ParseString" by Bitmonster.
New options:
Independent choice of input and output coding as well as "error handling."
New is choice of coding using the ComboBox. List of coding is stored in a separate file codecsList.py and everyone can adjust according to your needs.
In any coding can pick the "String write in the HexDump form". It is a very useful when debugging.
Pako
Attachments
WriteTextToFile.zip
Alpha version of plugin "WriteTextToFile"
(4.2 KiB) Downloaded 278 times
wttf.gif

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

Re: New system plugin "Write result to file"

Post by Bitmonster » Tue Sep 30, 2008 4:45 pm

Very nice. But the dialog gets to tall. Maybe the options for the encoding errors can be combined, since it will seldom make a difference if the error comes from the encoding or decoding.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

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

Re: New system plugin "Write result to file"

Post by Pako » Tue Sep 30, 2008 6:44 pm

Bitmonster wrote:... dialog gets to tall. Maybe the options for the encoding errors can be combined, since it will seldom make a difference if the error comes from the encoding or decoding.
Now it looks like maybe a little better. :)

Can someone please try it?
Pako
Attachments
WriteTextToFile.zip
Alpha version of plugin WriteTextToFile
(4.09 KiB) Downloaded 280 times
wttf.gif

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

Re: New system plugin "Write result to file"

Post by Pako » Thu Oct 02, 2008 12:46 pm

You can approve committal of this plugin to SVN ?

Thanks, Pako

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

Re: New system plugin "Write result to file"

Post by Bitmonster » Thu Oct 02, 2008 2:36 pm

I think we can slim the dialog even more, by using only a wx.Choice for the encoding and adding "utf-8" and "current system codepage" (and maybe "hex dump" also) to the beginning of the list. Since there is only a fixed number of encodings available in Python, it doesn't make much sense to use a wx.ComboBox. The whole list of encodings you can see, if you open lib/python25.zip and list the "encodings" directory (except aliases.pyc and __init__.pyc). I guess, I can write a little helper function for this, like eg.GetAvailableEncodings() that will work with a normal Python installation and the py2exe setup. But for the start your list file is enough.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

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

"Write text to file"

Post by Pako » Thu Oct 02, 2008 7:09 pm

Bitmonster wrote:I think we can slim the dialog even more, by using only a wx.Choice for the encoding and adding "utf-8" and "current system codepage" (and maybe "hex dump" also) to the beginning of the list.
Well, this is not a problem to do. But HexDump choice I leave as is, because the conversion to hexadecimal view pass till after the encoding.
Bitmonster wrote:Since there is only a fixed number of encodings available in Python, it doesn't make much sense to use a wx.ComboBox.
Of course, I know that the user can not write any name coding. I had two reasons why I used wxComboBox and not wxChoice:
1) wxComboBox have the method SetValue and I am therefore able to write with the program into the box, for example, "System code page".
2) The user may prefer the keyboard and directly enter the name of the coding to box.

Because now everything will be on the list, paragraph 1) not relevant anymore. There is therefore no need (only for the paragraph 2) use the ComboBox.
Pako

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

Re: New system plugin "Write result to file"

Post by Bitmonster » Thu Oct 02, 2008 7:54 pm

A wx.Choice can also be used with the keyboard. It will advance in the list as you type the keys. And it has the great benefit, that the user can't input an invalid encoding.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

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

Re: New system plugin "Write result to file"

Post by Pako » Fri Oct 03, 2008 5:44 pm

Here is the result. Finally, I not only rework layout, but have also been made small changes in function.
Instead of "Without decoding" is now in the list "unicode internal."
Pako
Attachments
WriteTextToFile.zip
Plugin WriteTextToFile 0.1.0
(3.73 KiB) Downloaded 351 times
wttf2.gif
Last edited by Pako on Fri Oct 03, 2008 7:27 pm, edited 1 time in total.

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

Re: New system plugin "Write result to file"

Post by Bitmonster » Fri Oct 03, 2008 6:01 pm

Yes, the layout looks very good.

But after thinking about it, I'm not sure, if an input data encoding is really needed. Actually everything that comes from an action or piece of (right) code inside EG should already be unicode. Even if you type some Cyrillic text into a wx.TextCtrl, the result will already be an unicode string. So there is actually only a question how the output file should be encoded.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

Post Reply