Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Windows platform question

by fauria (Deacon)
on Aug 12, 2008 at 11:37 UTC ( [id://703871]=perlquestion: print w/replies, xml ) Need Help??

fauria has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks!

Im not very used to work with MS systems, and i need to write a script that exports Excel files to plain text.

This may be a silly question, but im not really sure:

Can i write a program, complile it with perlcc to a win32 binary, and place it in the Sendto folder (whatever it is named) and use the Send to context menu of an Excel file to pass it, so i can handle it through @ARGV?
Do you know if it will work when selecting many files?

Thanks so much.

Replies are listed 'Best First'.
Re: "Send To" Perl script in Windows (was: Windows platform question)
by ikegami (Patriarch) on Aug 12, 2008 at 11:47 UTC

    No, because perlcc has never worked and doesn't exist for new versions of Perl.

    But you can accomplish what you want with a trivial batch file.

    @echo off :: This is "parse_excel.bat" perl "C:\Path To\parse_excel.pl" %1 pause

    Place the batch file in the same directory as the .pl (or wherever you want) and create a shortcut (named however you want) to it in the "Send To" folder.

    Update: Switched to more representative file names.
    Update: You could even use pl2bat to convert your .pl into a batch file.

      I missed your desire for it to work with multiple files. Use %* instead of %1 in the batch file.
      @echo off :: This is "parse_excel.bat" perl "C:\Path To\parse_excel.pl" %* pause

      The names of the selected files will be present in @ARGV

      for my $xl_file_name (@ARGV) { ... }

      perlcc has never worked

      It worked a little in 1996... I used it for some small things... But even back then, people warned you away from it.

      -Paul

Re: Windows platform question
by marto (Cardinal) on Aug 12, 2008 at 11:45 UTC
Re: Windows platform question
by Bloodnok (Vicar) on Aug 12, 2008 at 13:31 UTC
Re: Windows platform question
by SilasTheMonk (Chaplain) on Aug 12, 2008 at 13:20 UTC
    I believe there is a Spreadsheet::ParseExcel module. Why not use that?
Re: Windows platform question
by okram (Monk) on Aug 12, 2008 at 20:42 UTC
    I've answered a similar question on node 652223

    Basically, with ActiveState Perl, and using PAR::Packer. You do get an EXE.

    "Send To" passes the file name as arguments: you should get them on @ARGV.
    Check cpan xls2csv for a simple xls to csv "translator".
    What you might want to do in your program is to save the CSV or TSV or whatever file you need in the same folder as the file that has been passed via @ARGV.

    Please do let us know how that went ;)
Re: Windows platform question
by strat (Canon) on Aug 13, 2008 at 06:46 UTC

    Perhaps Re: excelPerl V0.13 released might help you:

    excelPerl.pl -begin "use Text::CSV_XS; $csv = Text::CSV_XS->new( { binary => 1} + )" -ane "$csv->combine(@F); print $csv->string, $/" -f file.xls

    (Just put it all in one line)

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: Windows platform question
by Tux (Canon) on Aug 18, 2008 at 17:27 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://703871]
Approved by marto
Front-paged by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-23 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found