Neal Carron

Senior Member
Joined
Jan 1, 2010
Messages
30
I'm trying to get a good Win XP routine to work in my new Win7 Pro 32-bit OS.

I need to open a document with an application in a non-conventional way.
I'm encountering two problems.

In Win XP you could specify one or more applications to open a file type (i.e., a file of certain extension).
It was this way: In Windows Explorer,
Main Menu: Tools, Folder Options..., File Types,
Select file extension of the file you wish to open
Edit it.
Make a New Action.
Specify the path to the application to use to open the file.
You can choose a default application, and set up optional applications.
Then, after selecting the file and right-clicking, the default application and all options display in the drop down menu.

But in Win7 it appears you can only specify the default application. I don't see how to add an alternate application to the drop-down menu (without going through the "open with..." selection every time).
That's the first problem.

The second problem is more detailed. In my case, to open the file I need to specify the application on a command line with an argument, which is an application script that is to execute automatically when the application starts. It is that script that actually opens the original file, not the application itself. In my case, the application is perl.

Specifically:
I have a data file DATA1.dat, an ordinary ascii file containing parallel columns of numerical data.
I want to import it into my graphics package Axum, Version 5, an old excellent program.

In Win XP I automated that task by writing an Axum script Ax1.axs (in Axum's language), and a perl script NJC.pl (in perl's language).

Then, to import DATA1.dat into Axum, upon selecting the data file in Windows Explorer, I need to execute perl to run NJC.pl. It captures file parameters and then runs the Axum script. The Axum script then imports the data file into Axum.

So the command that "opens" the original file is

C:\path_to_perl\perl.exe C:\path_NJC\NJC.pl "%1".

The command starts perl. The first argument is the perl script that is to run automatically when perl starts. The second argument, "%1", is the selected data file. NJC.pl incorporates it into the Axum script Ax1.axs, and then runs that script (which opens Axum and imports the data file).

This works wonderfully in WinXP.
But I don't see how to get it to work in Win7. There's no way to enter a command with an argument.

Any ideas?
Thanks.
 


Solution
To address the issues you are encountering in Windows 7 with setting up an alternative application and passing arguments to the application, especially in the context of running a Perl script that interacts with another program (Axum), here are some solutions:

Setting Up an Alternative Application in Windows 7:​

In Windows 7, the default way to handle file types is through the Default Programs feature, which doesn't offer the same level of customization as in older Windows versions. However, you can still achieve your goal of running a Perl script before opening the data file in Axum. Here's a workaround you can use:
  1. Create a batch file that runs the Perl script followed by the Axum script. For example, you can create a...
To address the issues you are encountering in Windows 7 with setting up an alternative application and passing arguments to the application, especially in the context of running a Perl script that interacts with another program (Axum), here are some solutions:

Setting Up an Alternative Application in Windows 7:​

In Windows 7, the default way to handle file types is through the Default Programs feature, which doesn't offer the same level of customization as in older Windows versions. However, you can still achieve your goal of running a Perl script before opening the data file in Axum. Here's a workaround you can use:
  1. Create a batch file that runs the Perl script followed by the Axum script. For example, you can create a batch file named RunAxum.bat with the following contents:
    Code:
    batch @echo off C:\path_to_perl\perl.exe C:\path_NJC\NJC.pl %1
  2. Associate the .bat file extension with this batch file (RunAxum.bat) in Windows 7.
  3. Now, when you right-click on a data file (DATA1.dat), you can choose the batch file (RunAxum.bat) as the default application to open the file. This way, the Perl script will execute first and then Axum will open the data file.

    Passing Arguments in Windows 7:​

    By using a batch file as described above, you can pass the selected data file (%1) as an argument to the Perl script. The batch file serves as an intermediary that runs the Perl script with the necessary arguments before opening the associated program. This approach should replicate the functionality you had in Windows XP, allowing you to run the Perl script before opening the data file in Axum. Remember to adjust the paths in the batch script to match your actual file locations. Feel free to try this method and let me know if you encounter any issues or need further assistance!
 


Solution
Back
Top