<?xml version="1.0" encoding="windows-1252"?>
<node id="475357" title="Re^2: (Not Quite Perl) Running Scripts from Right-Click Context Menu in Windows" created="2005-07-15 16:46:44" updated="2005-08-15 14:30:48">
<type id="11">
note</type>
<author id="475310">
five-ohm</author>
<data>
<field name="doctext">
This is an old thread, but it came up when I searched for a possible solution for an issue I am having.&lt;P&gt;

What I do for AutoCAD dwg files (under windows xp) is go to Folder Options-&gt;File Types-&gt;DWG-&gt;Advanced-&gt;New&lt;P&gt;

Then in Action I put a description, like Print 11x17 and under Application used to perform action it would be:&lt;P&gt;

"c:\program files\autocad 2004\acad.exe" "%1" /nologo /b plot11x17.scr&lt;P&gt;&lt;readmore&gt;So then for running a script on a txt file on right-click, you would put "perl -w" code.pl "%1" or whatever.&lt;/readmore&gt;&lt;P&gt;

What it does may be irrelevant but it runs a script then closes. This means you can highlight many dwgs, right click and have 12 copies of autocad open, run a script, then close.&lt;P&gt;

This brings me to a question I have.&lt;readmore&gt; If I run more than 3 autocads at a time it will take much longer than if I did each file individually which has prompted me to attempt to put together this dal right here (note, I am very new at this so the code might look retarded):
&lt;code&gt;
#!perl -W
use strict;

die "Need Arguments." unless @ARGV;

my $CADPath = join "", "\"", "c:/program files/autocad 2004/acad.exe", "\" ";

my $ScriptType = "hp5000";

foreach my $file (@ARGV) {
 if (-e $file) {
 my $RunIT = join "", $CADPath, $file, " /nologo /b ", $ScriptType;
 my $status = system($RunIT);
 die "$RunIT exited funny: $?" unless $status == 0;
 }
}
&lt;/code&gt;
This does exactly what I need to do, which is make a kind of queue. But how an I arrange it so I can highlight 20 file of only the dwgs I want and have it achieve the same thing without having to type in all the file names on the command line or make a batch file.&lt;P&gt;

I thought about doing the folder thing, where it would process all the dwgs in a folder, but this is not what I want. There will be drawings in the folder I do not want to run.&lt;P&gt;

Thanks&lt;/readmore&gt;</field>
<field name="root_node">
277596</field>
<field name="parent_node">
397133</field>
</data>
</node>
