Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

Simple new Firefox extension to save text

Options
  • 13-03-2012 10:58am
    #1
    Registered Users Posts: 28


    Hey guys

    So i finished writing my first FF extension the other day and hoping to get some feedback on whether it works or not and any suggestions for improvements would be great.
    Basically the extension writes currently highlighted text on a web-page to a file in the user's home directory. After highlighting some text, right-click the text and select "Write To File" .. thats all thats needed!
    File names have the format HighlightedTextToFile-<todaysdate>.txt

    Can be found/installed from Mozilla at ..
    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/

    Any feedback on this would be greatly appreciated!


Comments

  • Registered Users Posts: 190 ✭✭drag0n79


    bobbyrne01 wrote: »
    Hey guys

    So i finished writing my first FF extension the other day and hoping to get some feedback on whether it works or not and any suggestions for improvements would be great.
    Basically the extension writes currently highlighted text on a web-page to a file in the user's home directory. After highlighting some text, right-click the text and select "Write To File" .. thats all thats needed!
    File names have the format HighlightedTextToFile-<todaysdate>.txt

    Can be found/installed from Mozilla at ..
    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/

    Any feedback on this would be greatly appreciated!

    Hi,
    Good idea.

    Firstly, where exactly does it save to by default? I can't find the file. Windows 7 SP1, Firefox 10.0.2.

    Secondly, I think you should include these options (leave your current settings as the default)
    - Allow the user to choose where to save to
    - Allow a better naming system - let the user create the filename using tags, e.g. <website_domain><incremental_number><datetime> or something like that, so the file would save as BOARDS.IE_1_201203121545, but allow it to be fairly flexible with good tags. I think the DownThemAll extension does something like this but haven't used it in a while.
    - Allow the user to append to a file rather than creating a new file every time.
    - An option to save the current page's URL in the file below the text that has been highlighted

    Good luck. With all of the above I would probably use it regularly.


  • Registered Users Posts: 28 bobbyrne01


    Added my comments below ..
    drag0n79 wrote: »
    Firstly, where exactly does it save to by default? I can't find the file. Windows 7 SP1, Firefox 10.0.2.
    ---- The file is saved in your home directory, so on Windows that would be something like:
    C:\Users\Rob\HighlightedTextToFile-13032012.txt
    I've only tested the file creation on Linux so if you could verify the files are being created on Windows that would be awesome!?


    Secondly, I think you should include these options (leave your current settings as the default)
    - Allow the user to choose where to save to
    ---- Cant believe i never thought of that! :D
    - Allow a better naming system - let the user create the filename using tags, e.g. <website_domain><incremental_number><datetime> or something like that, so the file would save as BOARDS.IE_1_201203121545, but allow it to be fairly flexible with good tags. I think the DownThemAll extension does something like this but haven't used it in a while.
    ---- Nice idea, a better naming convention is definitely going to be used in the future
    - Allow the user to append to a file rather than creating a new file every time.
    ---- This feature is currently in development ;)
    - An option to save the current page's URL in the file below the text that has been highlighted
    ---- Simple but great idea!

    Good luck. With all of the above I would probably use it regularly.

    Really appreciate your feedback drag0n79 and most (if not all) of these suggestions will be included in future releases, thank you!


  • Registered Users Posts: 190 ✭✭drag0n79


    bobbyrne01 wrote: »

    ---- The file is saved in your home directory, so on Windows that would be something like:
    C:\Users\Rob\HighlightedTextToFile-13032012.txt
    I've only tested the file creation on Linux so if you could verify the files are being created on Windows that would be awesome!?

    Just tried on Vista, no joy. I presume you're just using $HOME or ~/ if you are only testing in Linux. You probably need to look at %UserProfile% for Windows.

    In my error console I get this when I try to Write To File:

    Error: uncaught exception: [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]" nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)" location: "JS frame :: chrome://highlightedtexttofile/content/HighlightedTextToFile.js :: <TOP_LEVEL> :: line 53" data: no]

    Should be an easy fix.


  • Registered Users Posts: 28 bobbyrne01


    Thanks for getting back to me dragOn79!
    The problem was due to a "/" file separator hardcoded into the app which is why it didnt save files properly on Windows, although I read that Windows would interpret this fine from javascript but guess that wasn't the case.
    Anyways, the addon now supports Linux+Windows and is updated on Mozilla, if you could try the updated version that would be great!


  • Registered Users Posts: 190 ✭✭drag0n79


    bobbyrne01 wrote: »
    Thanks for getting back to me dragOn79!
    The problem was due to a "/" file separator hardcoded into the app which is why it didnt save files properly on Windows, although I read that Windows would interpret this fine from javascript but guess that wasn't the case.
    Anyways, the addon now supports Linux+Windows and is updated on Mozilla, if you could try the updated version that would be great!

    Working on my current machine (Windows 7, Firefox 11.0) now.

    Nice one. Keep the thread updated if you make further releases!


  • Advertisement
  • Registered Users Posts: 131 ✭✭CuAnnan


    Why are you saving to a file location rather than using the SQLite API that Firefox uses?


  • Registered Users Posts: 28 bobbyrne01


    CuAnnan wrote: »
    Why are you saving to a file location rather than using the SQLite API that Firefox uses?

    The reason I've used a simple text file to store data is because the end-user will want to open the file and read it easily.
    Using the SQLite API would have created a .sqlite file which contains a table format. Each column in the table represents a different "field" or type of information. The end-user wants to be able to simply open the file and see only the text they told the extension to save to file.

    Btw everyone, version 1.0.3 is available now at https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/
    allowing user to specify a download directory, more features to come ..


  • Registered Users Posts: 190 ✭✭drag0n79


    bobbyrne01 wrote: »
    The reason I've used a simple text file to store data is because the end-user will want to open the file and read it easily.
    Using the SQLite API would have created a .sqlite file which contains a table format. Each column in the table represents a different "field" or type of information. The end-user wants to be able to simply open the file and see only the text they told the extension to save to file.

    Btw everyone, version 1.0.3 is available now at https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/
    allowing user to specify a download directory, more features to come ..

    It's not quite working for me - firstly, the options window is small and does not show the new option - you can just see a small line, which you have to click onto before the window scrolls down to see the text box. Hard to explain but just test it in Firefox on Windows to see what I mean.

    Then if I enter C:\ into the textbox, and try to save some text, it adds an extra "/" to the path, so it tries to save to C:\/HighlightedTextToFile.txt, and does not save. You should have some validation on the textbox or just open a file dialog for the user to select a location (rather than just allowing the user to type in free text).


  • Registered Users Posts: 28 bobbyrne01


    Thanks drag0n79, your testing has been very valuable on this extension!

    Version 1.0.4 is available with some improvements:
    1. Improved directory selection for saved files (through dialog)
    2. User can specify the name for saved files
    I've tested on linux and windows and extension works fine, please let me know if you experience otherwise ..

    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/


  • Registered Users Posts: 3,183 ✭✭✭UnknownSpecies


    Something like this would be extremely useful to me. The main features I'd like to see in future developments:

    1. Specifying directory for the file to save in (done already :) )
    2. Being able to name the text file before it saves
    3. Being able to choose to append the new text to a previously saved file (using a dropdown box with previously saved files possibly)

    Other than that, nice add-on, very useful!


  • Advertisement
  • Registered Users Posts: 190 ✭✭drag0n79


    bobbyrne01 wrote: »
    Thanks drag0n79, your testing has been very valuable on this extension!

    Version 1.0.4 is available with some improvements:
    1. Improved directory selection for saved files (through dialog)
    2. User can specify the name for saved files
    I've tested on linux and windows and extension works fine, please let me know if you experience otherwise ..

    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/

    No problem at all!

    Seems to be working fine except for the case where you choose a root directory to save the file (e.g. C: - it replaces it with C:/ and then the save fails in Windows).


  • Registered Users Posts: 28 bobbyrne01


    drag0n79 wrote: »
    No problem at all!

    Seems to be working fine except for the case where you choose a root directory to save the file (e.g. C: - it replaces it with C:/ and then the save fails in Windows).

    dragOn79, regarding the issue your seeing when trying to save to C: on Windows .. this problem here is that Firefox extensions do not have permission to save files in that directory or other important directories e.g. C:\Program Files, C:\Windows
    Therefore the error message you see, "Please check you have specified a valid save path which you have write access to in Highlighted Text To File's preferences", when trying to save to a directory like such is correct, you do not have access. The same behaviour is seen on linux when trying to save to root.

    Version 1.0.5 is now available with some improvements:
    1. Determines context clicked and only shows "Save to File" menuitem if context is text
    2. Handles preferences that may be storing unicode strings (save path)

    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/


  • Registered Users Posts: 28 bobbyrne01


    Version 1.0.6 is now available with some improvements:
    1. Text is encoded in UTF-8 (Unicode) so all international characters can be stored correctly
    2. Changed menuitem's label to "Save Text to File" for better understanding of action performed

    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/


  • Registered Users Posts: 28 bobbyrne01


    Version 1.0.7 is now available with some improvements:
    1. Options to include/exclude time/date stamps in saved file name
    2. Option to show preferences dialog when "Save Text to File" is clicked

    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/


  • Registered Users Posts: 28 bobbyrne01


    Version 1.0.8 is now available with some improvements:
    Localization for - English (en-US), Chinese (zh-CN), French (fr), German (de), Japanese (ja), Polish (pl) and Spanish (es-ES)

    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/


  • Registered Users Posts: 28 bobbyrne01


    Version 1.0.9
    Released July 13, 2012 21.5 KB
    Improvements:
    1. Added support for SeaMonkey web-browser
    2. Added preference to either append text to file or create a new file

    https://addons.mozilla.org/en-US/firefox/addon/highlighted-text-to-file/


  • Registered Users Posts: 28 bobbyrne01


    Version 1.0.12
    Released October 29, 2012 25.4 KB
    Works with Firefox 2.0 and later, SeaMonkey 2.0 and later
    1. Added Russian translations (Jesst)
    2. Code improvements (removing calls to old api)
    3. User can save current URL into saved file
    4. User can include date and/or time stamps in the saved file contents


  • Registered Users Posts: 28 bobbyrne01


    Version 1.1
    Released December 1, 2012 31.4 KB
    Works with Firefox 2.0 and later, SeaMonkey 2.0 and later
    1. Addon rebranding, 'Highlighted Text to File' --> 'Save Text to File'

    New URL ..
    https://addons.mozilla.org/en-US/firefox/addon/save-text-to-file/


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,082 Mod ✭✭✭✭Tar.Aldarion


    Add to chrome please :D


  • Registered Users Posts: 28 bobbyrne01


    Add to chrome please :D

    At the moment Chrome only allows you to save files under the extensions root directory, which is kind of restrictive for this extensions purpose. If this is ever changed then I will port the extension to Chrome :)


  • Advertisement
  • Registered Users Posts: 28 bobbyrne01


    v2.0.2 now released!
    Addon install/upgrades no longer require a browser restart ..

    https://addons.mozilla.org/en-US/firefox/addon/save-text-to-file/


  • Registered Users Posts: 28 bobbyrne01


    v2.1.9 released!
    Widget icon added to addon bar .. and can be removed if prefered
    Save text file with same name as pagename
    Various date formats

    https://addons.mozilla.org/firefox/addon/save-text-to-file/


Advertisement