Professional Web Applications Themes

Open file with default application software on Windows ? - PERL Beginners

Hello, I am curious to know that if that is an existed module to open files with it's default application just like I double click on the file with mouse. and I do something just like this with my code : use defaultOpen; defOpen 'C:\temp.gif' or die "$!" ; # Then the image will open with photoshop. defOpen 'C:\temp.doc' or die "$!" ; # then the doent will open with Word. I've made this done by writting a batch like code.. but I sure that's unsafe and unportable. Thanks for any hint, Bee...

  1. #1

    Default Open file with default application software on Windows ?

    Hello,

    I am curious to know that if that is an existed module to open files with it's default application just like I
    double click on the file with mouse. and I do something just like this with my code :

    use defaultOpen;
    defOpen 'C:\temp.gif' or die "$!" ; # Then the image will open with photoshop.
    defOpen 'C:\temp.doc' or die "$!" ; # then the doent will open with Word.

    I've made this done by writting a batch like code.. but I sure that's unsafe and unportable.

    Thanks for any hint,
    Bee

    Bee Guest

  2. #2

    Default Re: Open file with default application software on Windows ?

    Search for a program called 'shellexec'. (use google).

    Shellexec does exactly what you want, but its a windows executable, so
    instead of calling
    defopen "something";

    try

    system("shellexec something");

    you should be able to download shellexec or an equivalent from many places.

    As for portable? Its portable among the various platforms that run
    word-4-windows (duh)



    On Thu, 7 Oct 2004 18:21:21 +0800, Bee <org> wrote: 
    David Guest

  3. #3

    Default Re: Open file with default application software on Windows ?


    Wow !! As you mentioned, thaz EXACTLY what I want :-))

    Thousands Thanks !!!
    Bee

    ----- Original Message -----
    From: "David le Blanc" <com>
    To: "Bee" <org>
    Cc: <org>
    Sent: Thursday, October 07, 2004 7:11 PM
    Subject: Re: Open file with default application software on Windows ?

     
    places. [/ref]
    with it's default application just like I [/ref]
    with my code : [/ref]
    photoshop. [/ref]
    Word. [/ref]
    unsafe and unportable. 
    >
    > --
    > To unsubscribe, e-mail: org
    > For additional commands, e-mail: org
    > <http://learn.perl.org/> <http://learn.perl.org/first-response>
    >
    >
    >[/ref]


    Bee Guest

  4. #4

    Default RE: Open file with default application software on Windows ?

    Bee wrote: 

    won't

    system "start temp.doc"

    do the trick?
    Bob Guest

  5. #5

    Default Re: Open file with default application software on Windows ?


    Thanks thanks, a very nice lesson again !! Feel quite sorry that I even
    never heard about this command for using windows after so many
    years...

    Thousands thanks,
    Bee


    ----- Original Message -----
    From: "Bob Showalter" <com>
    To: "'Bee'" <org>; <org>
    Sent: Thursday, October 07, 2004 8:24 PM
    Subject: RE: Open file with default application software on Windows ?

     
    >
    > won't
    >
    > system "start temp.doc"
    >
    > do the trick?
    >
    > --
    > To unsubscribe, e-mail: org
    > For additional commands, e-mail: org
    > <http://learn.perl.org/> <http://learn.perl.org/first-response>
    >
    >
    >[/ref]

    Bee Guest

  6. #6

    Default Re: Open file with default application software on Windows ?

    From: "Bee" <org> 

    The system('start file.doc') only allows you to trigger the default
    action defined for the file type. If you want to use the other
    actions you might like
    use Win32::FileOp qw(ShellExecute);
    ShellExecute 'Print' => 'c:\temp.doc';

    Jenda
    ===== cz === http://Jenda.Krynicky.cz =====
    When it comes to wine, women and song, wizards are allowed
    to get drunk and croon as much as they like.
    -- Terry Pratchett in Sourcery

    Jenda Guest

  7. #7

    Default Re: Open file with default application software on Windows ?

    On Thu, 07 Oct 2004 16:10:29 +0200, Jenda Krynicky <cz> wrote: 
    >
    > The system('start file.doc') only allows you to trigger the default
    > action defined for the file type. If you want to use the other
    > actions you might like
    > use Win32::FileOp qw(ShellExecute);
    > ShellExecute 'Print' => 'c:\temp.doc';[/ref]

    Wow. Best answer. I assign you 50 guru points :-)

    Where do I send them?
     
    David Guest

  8. #8

    Default RE: Open file with default application software on Windows ?


     
    > open files  
    > sure that's  
    >
    > The system('start file.doc') only allows you to trigger the default
    > action defined for the file type. If you want to use the other
    > actions you might like
    > use Win32::FileOp qw(ShellExecute);
    > ShellExecute 'Print' => 'c:\temp.doc';[/ref]

    ShellExecute $operation => $file;

    How to find the list of available $operations ?

    The doc says:
    "$operation : specifies the action to perform. The set of available operations depends on the file type. Generally, the actions available from an object's shortcut menu are available verbs."

    "object's shortcut menu" ?
    Could you elaborate please :-) ?

    Thanks,

    Josť.


    **** DISCLAIMER ****

    "This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above.
    Any use of the information contained herein (including, but not limited to,total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited.
    If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer".

    Thank you for your cooperation.

    For further information about Proximus mobile phone services please see ourwebsite at http://www.proximus.be or refer to any Proximus agent.

    NYIMI Guest

  9. #9

    Default RE: Open file with default application software on Windows ?

    From: "NYIMI Jose \(BMB\)" <net> 
    >
    > ShellExecute $operation => $file;
    >
    > How to find the list of available $operations ?
    >
    > The doc says:
    > "$operation : specifies the action to perform. The set of available
    > operations depends on the file type. Generally, the actions available
    > from an object's shortcut menu are available verbs."
    >
    > "object's shortcut menu" ?
    > Could you elaborate please :-) ?[/ref]

    You can either find the list of actions if you manualy rightclick a
    file of that type in Windows Explorer (the topmost section of the
    menu except "Open With") or go to the registry (regedit.exe) go to
    HKEY_CLASSES_ROOT\.doc, look at the default value (the type of the
    file), then go to HKEY_CLASSES_ROOT\<the_type>\Shell and the subkeys
    are the different available actions. ShellExecute lets you use either
    the name of the subkeys or the title specified in the default value
    in that subkey.

    If you need to find the list of actions programaticaly you just use
    Win32::Registry ro Tie::Registry to do the same. Find the type from
    HKEY_CLASSES_ROOT\.ext, go to HKEY_CLASSES_ROOT\<the_type>\Shell and
    list the subkeys.

    HTH, Jenda
    P.S.: Please do not CC me on emails sent to the list. Both emails end up in the same folder anyway.

    ===== cz === http://Jenda.Krynicky.cz =====
    When it comes to wine, women and song, wizards are allowed
    to get drunk and croon as much as they like.
    -- Terry Pratchett in Sourcery

    Jenda Guest

  10. #10

    Default Re: Open file with default application software on Windows ?

    > > > From: Jenda Krynicky [mailto:cz] 
    > >
    > > ShellExecute $operation => $file;
    > >
    > > How to find the list of available $operations ?
    > >
    > > The doc says:
    > > "$operation : specifies the action to perform. The set of available
    > > operations depends on the file type. Generally, the actions available
    > > from an object's shortcut menu are available verbs."
    > >
    > > "object's shortcut menu" ?
    > > Could you elaborate please :-) ?[/ref]
    >
    > You can either find the list of actions if you manualy rightclick a
    > file of that type in Windows Explorer (the topmost section of the
    > menu except "Open With") or go to the registry (regedit.exe) go to
    > HKEY_CLASSES_ROOT\.doc, look at the default value (the type of the
    > file), then go to HKEY_CLASSES_ROOT\<the_type>\Shell and the subkeys
    > are the different available actions. ShellExecute lets you use either
    > the name of the subkeys or the title specified in the default value
    > in that subkey.
    >
    > If you need to find the list of actions programaticaly you just use
    > Win32::Registry ro Tie::Registry to do the same. Find the type from
    > HKEY_CLASSES_ROOT\.ext, go to HKEY_CLASSES_ROOT\<the_type>\Shell and
    > list the subkeys.
    >[/ref]

    A very nice hack, It leads me to imagine lot more possibilities, such as
    printing
    invoice when a sale get confirmed ... So glad to hear about this !!

    Many many thanks for the tips!!
    Bee


    Bee Guest

  11. #11

    Default RE: Open file with default application software on Windows ?


     [/ref]
    > the default 
    > >
    > > ShellExecute $operation => $file;
    > >
    > > How to find the list of available $operations ?
    > >
    > > The doc says:
    > > "$operation : specifies the action to perform. The set of available
    > > operations depends on the file type. Generally, the actions [/ref]
    > available  
    >
    > You can either find the list of actions if you manualy rightclick a
    > file of that type in Windows Explorer (the topmost section of the
    > menu except "Open With") or go to the registry (regedit.exe) go to
    > HKEY_CLASSES_ROOT\.doc, look at the default value (the type of the
    > file), then go to HKEY_CLASSES_ROOT\<the_type>\Shell and the subkeys
    > are the different available actions. ShellExecute lets you use either
    > the name of the subkeys or the title specified in the default value
    > in that subkey.
    >
    > If you need to find the list of actions programaticaly you just use
    > Win32::Registry ro Tie::Registry to do the same. Find the type from
    > HKEY_CLASSES_ROOT\.ext, go to HKEY_CLASSES_ROOT\<the_type>\Shell and
    > list the subkeys.
    >
    > HTH, Jenda
    > P.S.: Please do not CC me on emails sent to the list. Both
    > emails end up in the same folder anyway.
    > [/ref]

    Great !
    I think you should add such info in the module doenation.

    Thanks,

    Josť.


    **** DISCLAIMER ****

    "This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above.
    Any use of the information contained herein (including, but not limited to,total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited.
    If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer".

    Thank you for your cooperation.

    For further information about Proximus mobile phone services please see ourwebsite at http://www.proximus.be or refer to any Proximus agent.

    NYIMI Guest

Similar Threads

  1. Changing Acrobat Pro 6.0.1 File Open Default
    By Lester_Proctor@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 2
    Last Post: June 4th, 03:50 PM
  2. Changing Default File/Open settings
    By lrollo@paradise.net.nz in forum Adobe Acrobat Windows
    Replies: 0
    Last Post: May 17th, 09:57 PM
  3. Default Directory for File/Open on Acrobat Pro 6.0.1
    By hallan@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 5
    Last Post: April 19th, 04:15 PM
  4. File > Open default directory.
    By Anthony MMTS in forum Macromedia Fireworks
    Replies: 3
    Last Post: August 25th, 03:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139