Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What do I want to do?

I would like Firefox to save files with the .pages extension as .zip files automatically.

Scenario

You are browsing through your emails and you notice your friend just sent you an email with a file attached (a .pages in this example). Unfortunately, you have a laptop that runs Windows. Your friend continues to send tons of emails with .pages files attached and you are tired of manually saving the files as a .zip file.

Ultimately, you would like Firefox to be set up so that the download/file manager recognizes the .pages extension and automatically converts it to a .zip file.

What have I done?

I have saved files manually by selecting save as "All Files" and setting the extension to .zip. I've gone through Firefox and their documentation and have not found anything on how to complete this task.

Why am I doing this?

  1. To save time (only a few seconds, not the main reason).
  2. I would like to setup a simple solution that "converts" a file automatically without having to recall steps on how to achieve the task manually (for clients who aren't exactly tech savvy).
  3. So that clients with Windows can access the files.

IMPORTANT NOTE:

I am not trying to save the web page, rather an Apple document equivalent to Microsoft Word.


UPDATE:

The really easy method would be to save one file, right click it, choose properties and open all .pages files up with WinRAR (or any other program that extracts files from a compressed folder). For the sake of learning, I am going to "neglect" this method and continue to do some research on Firefox add-ons. I would still like to have Firefox or the download manager to do the bulk of the work for converting the file.

share|improve this question
3  
Why don't you just assign your ZIP program with the .pages file extension? –  Robert Jul 8 '12 at 7:33
    
@Robert So basically all I need to do is add a .pages folder in HKEY_CLASSES_ROOT and add the same string, binary and expandable values found in the .zip folder? –  mdeitrick Jul 8 '12 at 11:30
1  
Or even easier, just right-click a .pages file, select Open With…, then select your archive program from the dialog, making sure to select the Always use… option. –  Synetech Jul 9 '12 at 0:54
    
You should advise your friend to stop sending files in proprietary and even rare) formats as you are probably not the only one receiving these files from him/her. Tell your friend to use PDF/ODF for sending documents to other people. –  Gurken Papst Jul 9 '12 at 21:37
    
> You should advise your friend to stop sending files in proprietary and even rare) formats Um .pages files are created by the Pages word-processor from the Mac office suite iWork’s. What did you think it was? –  Synetech Jul 13 '12 at 18:00
show 1 more comment

1 Answer

up vote 8 down vote accepted
+50

One way to do so would be to have an external script do the conversion and have Firefox call the script. For example, the following batch script:

@echo off

:loop

if ^<%1^>==^<^> goto :eof

if not exist "%~dpnx1" (
    echo "%~dpnx1" does not exist!
    shift
    goto :loop
)

if ^<%~x1^>==^<.pages^> (
    ren "%~dpnx1" "%~n1.zip"
    start "" "%~dpn1.zip"
) else (
    echo "%~dpnx1" does not have the .pages extension
)

shift
goto :loop

If you set that as the Open With action inside Firefox, it will rename any .pages file to .zip and open it using the default .zip handler.

Screenshot of download settings

This is especially useful if Windows Explorer is your default ZIP handler, or some other program that cares about extensions - a few compression programs will happily open ZIP files no matter their extension, in which case you may as well follow @Synetech's suggestion and set that as the default handler.


Another way is with a renaming mask. It's definitely possible to set one that only activates for a certain extension (i.e. .pages), but I haven't found a way short of writing a custom plugin/addon yet. You can, however, set a global (within DTA) renaming mask in DownThemAll:

Screenshot of DTA setting

This will apply to any extension/DTA download, so it's only effective if you only use DTA for .pages files.

The first time, download with DownThemAll! and set the renaming mask and destination. Se second time, use dTa OneClick! and set it as the default action.

Screenshot of download options

share|improve this answer
    
I was writing the DownThemAll answer right now :D It is the extension I use and recommend it. I think it is the best solution for this problem. –  criziot Jul 9 '12 at 1:10
    
Personally, I'm intrigued by the first option. I'll try it in a bit and let you know what happens! Could you please explain what's going on in the batch file? I am still relatively new to the syntax... specifically the carets, less than signs, and characters enclosed in quotation marks. –  mdeitrick Jul 9 '12 at 20:15
    
The first option works, although the check-box (Do this automatically for files like this from now on.) is grayed out. I have to click "Browse" and find the script every time I want to open up the file. –  mdeitrick Jul 9 '12 at 20:33
    
@MikeDtrick The carets are escape characters. I'm using less than and greater than signs because they can't appear in a path - their special meaning means they need to be escaped, but they are less likely to appear in input. It's just to make sure there's no error when the input string is empty. It also checks if the path exists. The loops is so it in process multiple input arguments, not really necessary (same with the shift). goto :eof basically skips to the bottom (exit). The letters after the tilde are used for special expansions. –  Bob Jul 9 '12 at 20:36
1  
@MikeDtrick While I'm happy to have (partially) helped, it would be interesting to know if someone has created an extension to rename files within Firefox as you were asking. (Your profile says you know JS, perhaps you could try?) –  Bob Jul 9 '12 at 22:21
show 6 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.