How to launch a .bat file process extension

Asked by Steve Ylvisaker

I am trying to add an effect to the effect menu. I want it to run a .bat process (in windows). When I select my menu option the windows command window opens but my process doesn't execute. Following is the .inx file:

<inkscape-extension>
 <_name>Preview and Compare to flr</_name>
 <id>MAPS.checkin</id>
 <effect>
  <object-type>all</object-type>
  <File-menu>Preview and Compare to flr</File-menu>
 </effect>
 <script>
  <command>c:\testSvg\bats\CompareResults.bat</command>
 </script>
</inkscape-extension>

I'm guessing that there are attributes to <command/> that I am missing?

Steve

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
Steve Ylvisaker
Solved:
Last query:
Last reply:
Revision history for this message
Oleg Koptev (koptev-oleg) said :
#1
Revision history for this message
su_v (suv-lp) said :
#2

if you are using 0.46, try
 <command reldir="c:\testSvg\bats">CompareResults.bat</command>

or put 'CompareResults.bat' into the 'share/extensions' (I don't know the exact path) directory in the installation dir of Inkscape:
   <command reldir="extensions">CompareResults.bat</command>

With 0.47pre you need to add an interpreter as described on the Wiki page Oleg mentions above.

Revision history for this message
Steve Ylvisaker (sylvisaker) said :
#3

Thanks for your help.

I am running 0.47 and tried both of the suggestions above. The first one caused Inkscape to abort. The second one resulted in the same behavior that I mentioned above: The windows command window opens but nothing is executed.

If I were to add the interpreter attribute, what would its value be for a .bat file execution. (or should I give up on this path and instead write the script in Perl?

Steve

Revision history for this message
su_v (suv-lp) said :
#4

1) Best supported would be Python ;-)

2) There are two or three examples using Perl, but I didn't get those to work on my mac OS X 10.5.8

3) Then there's 'bash' - available for win32 in several packages (MinGW, unxutils, Cygwin, ...), install it, create '*.sh' command files and use the interpreter='bash'.

4) try 'sh' or 'shell' as interpreter or whatever you could imagine Windows would execute as batch file interpreter (with ".exe" automatically appended <http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/src/extension/implementation/script.cpp?revision=22033&view=markup>line 132 ff.)

Revision history for this message
su_v (suv-lp) said :
#5

1) Best supported would be Python - in regard to examples, I meant...

~suv (who is Python ignoramus)

Revision history for this message
Steve Ylvisaker (sylvisaker) said :
#6

We are a perl shop so if there is any way that I can get a perl script to run it would be the best support option for us. I'll keep trying it.

Revision history for this message
su_v (suv-lp) said :
#7
Revision history for this message
Steve Ylvisaker (sylvisaker) said :
#8

I am withdrawing this question. I will be using another approach rather than .bat files.