Need to carry over application variable into RUBY script

I have an application that converts PDFs to individual EPS files. When
it does so, it creates a subdirectory with the same name as the original
filename and puts all of the resulting EPS files it creates into that
directory. Well, I have to do a lot of scripting and stuff on those EPS
files. To automate this, I need to know what the directory name is that
it put the files. The application provides a variable, “%2,” just for
this purpose. I’ve gotten this %2 variable to work for me in cmd.exe.
But, I’d like it to work in RUBY. I’m sure it can be done. But, came
someone tell me how I can transfer this %2 variable from my application
to a Dir.chdir target?

Example:
A 100 page PDF comes in named IRSp590. The application creates a
subdirectory named “IRSp590.” All of the files the application creates
are put into this directory. I just need to get into that directory,
wherever it is, and do stuff to the files.

Thanks.

On 4/17/06, Peter B. [email protected] wrote:

I have an application that converts PDFs to individual EPS files. When
it does so, it creates a subdirectory with the same name as the original
filename and puts all of the resulting EPS files it creates into that
directory. Well, I have to do a lot of scripting and stuff on those EPS
files. To automate this, I need to know what the directory name is that
it put the files. The application provides a variable, “%2,” just for
this purpose. I’ve gotten this %2 variable to work for me in cmd.exe.
But, I’d like it to work in RUBY. I’m sure it can be done. But, came
someone tell me how I can transfer this %2 variable from my application
to a Dir.chdir target?

%2 is the 2nd argument on the command-line, so you just have to look
for ARGV[2].

It’d be interesting to find out what %1 is :wink:

-austin

Austin Z. wrote:

On 4/17/06, Peter B. [email protected] wrote:

I have an application that converts PDFs to individual EPS files. When
it does so, it creates a subdirectory with the same name as the original
filename and puts all of the resulting EPS files it creates into that
directory. Well, I have to do a lot of scripting and stuff on those EPS
files. To automate this, I need to know what the directory name is that
it put the files. The application provides a variable, “%2,” just for
this purpose. I’ve gotten this %2 variable to work for me in cmd.exe.
But, I’d like it to work in RUBY. I’m sure it can be done. But, came
someone tell me how I can transfer this %2 variable from my application
to a Dir.chdir target?

%2 is the 2nd argument on the command-line, so you just have to look
for ARGV[2].

It’d be interesting to find out what %1 is :wink:

-austin

Thanks, Austin. So, do I do this?

Dir.chdir(ARGV[2])
or this
Dir.chdir(“ARGV[2]”)?

Austin Z. wrote:

On 4/17/06, Peter B. [email protected] wrote:

someone tell me how I can transfer this %2 variable from my application
Dir.chdir(“ARGV[2]”)?
Never the latter.

I’m presuming that what you actually have is a command-line entry box
in your Windows program:

[ post_process_script %2 ]

If that’s how you’re configuring it, then your Ruby code must be
looking for ARGV[1], not ARGV[2].

-austin

No, there’s no command line entry box. It’s just an understood variable
that the application can use in a post-processing script, which, usually
is, of course, a .cmd script. In a simple Windows script, for example,
you could do this:
cd %2
and you would go to the directory path of the file that the application
produced.

On 4/17/06, Peter B. [email protected] wrote:

someone tell me how I can transfer this %2 variable from my application
Dir.chdir(“ARGV[2]”)?
Never the latter.

I’m presuming that what you actually have is a command-line entry box
in your Windows program:

[ post_process_script %2 ]

If that’s how you’re configuring it, then your Ruby code must be
looking for ARGV[1], not ARGV[2].

-austin

On 4/17/06, Peter B. [email protected] wrote:

No, there’s no command line entry box. It’s just an understood variable
that the application can use in a post-processing script, which, usually
is, of course, a .cmd script. In a simple Windows script, for example,
you could do this:
cd %2
and you would go to the directory path of the file that the application
produced.

OK. Then you need ARGV[2].

-austin

Austin Z. wrote:

On 4/17/06, Peter B. [email protected] wrote:

No, there’s no command line entry box. It’s just an understood variable
that the application can use in a post-processing script, which, usually
is, of course, a .cmd script. In a simple Windows script, for example,
you could do this:
cd %2
and you would go to the directory path of the file that the application
produced.

OK. Then you need ARGV[2].

-austin

Thank you!