Quick File Edit
Posted: 06 Nov 2008 23:23
Just a little script to allow you to quickly edit small text files directly within XY without the need of any external app -- especially useful for quick edits on text files, INI/Config files, etc
Note that the limit to 100 KB files is totally arbitrary, I didn't do any test to see how much XY could actually handle or anything, just seemed a right choice for me. XY probably supports for more, but obviously this is probably best suited only for small files, otherwise you'll want a real text editor.
Code: Select all
"Quick File Edit... : QuickFileEdit"
sub (getinfo("CountSelected") == 1) ? ((report("{Size RAW}", 1) <= 102400) ? "_QuickFileEdit" : "_qfeSizeError") : "_qfeSelError";
"_qfeSelError"
msg "You need to have one (and only one) selected item !";
"_qfeSizeError"
msg "You can only edit files of 100 KB (102 400 bytes) and less !";
"_QuickFileEdit"
$file = report("{Fullname}", 1);
input $data, "Quick File Edit: $file", readfile($file), w;
status writefile($file, $data) ? "File saved" : "Error writing file";