Author Topic: Running a Program From a .bat  (Read 431 times)

0 Members and 1 Guest are viewing this topic.

MGorecki

  • Mosquito
  • Posts: 2
Running a Program From a .bat
« on: April 18, 2017, 07:05:25 pm »
I have a program that creates a drawing.  It worked in Visual Studio 2010 with AutoCAD 2010.
I'm now using Visual Studio 2012 with AutoCAD 2015.
We have a web page that creates a batch file, a script, and a text file.
The text file contains the parameters for the program.
The script loads the dll, enters the command to run the program and gives two values that the program asks for.
The .bat file launches AutoCAD 2015 and runs the script.

If I launch AutoCAD myself and enter the command "scr", pick the script and run it, it will create the drawing without a problem.
If I double pick the .bat file (which will launch AutoCAD and run the script) my drawing is only a handful of lines and leaders that go off in infinity to the left and right and I get a JIT error.

Has anyone run into this problem before?
BTW I have changed the code to use .Net Framework 4.5 and I've used the AcCoreMgd, AcDbGmd, and the AcMgd from the 2015 ObjectArx.

Is there something I'm missing?

Thanks in advance,
Mark

Jeff H

  • Needs a day job
  • Posts: 5863
Re: Running a Program From a .bat
« Reply #1 on: April 20, 2017, 12:58:50 am »
Welcome to the Swamp!
Can you get it working using a very simple script or simplified version of script to narrow down where the problem is, could be command behavior changed in newer version.

MGorecki

  • Mosquito
  • Posts: 2
Re: Running a Program From a .bat
« Reply #2 on: April 21, 2017, 10:43:45 am »
Hi Jeff, thanks. 
The script file I have already looks like:
netload
"C:\VB_Programs\HeatSpreader\HeatSpreader.dll"
hs
"\\ASVFASP03\support\DST_files\qa_design\Drawing Search Tool\Heat Spreader\"
123456HS

The last two lines tell the program where to find the text file, and the text file name.
If I just run that, then it works fine.

If I run the .bat it gives me a crazy drawing and errors out.  The bat looks like:
"C:\Program Files\Autodesk\AutoCAD 2015\acad.exe" /b "\\ASVFASP03\support\DST_files\qa_design\Drawing Search Tool\Heat Spreader\123456HS.scr"

Best regards,
Mark

BIGAL

  • Newt
  • Posts: 100
  • 30 + years of using Autocad
Re: Running a Program From a .bat
« Reply #3 on: April 23, 2017, 07:49:35 pm »
There is documentation on startup switches google it. You have the /b switch but it does talk about scripts being in the search path.
« Last Edit: April 23, 2017, 07:57:25 pm by BIGAL »
A man who never made a mistake never made anything

djee

  • Newt
  • Posts: 48
Re: Running a Program From a .bat
« Reply #4 on: May 09, 2017, 09:03:08 pm »
Maybe you should have a look into Augusto Goncalves Document (Using .NET Programming to Create New Possibilities with the AutoCADŽ Core Console): http://aucache.autodesk.com/au2012/sessionsFiles/3338/3323/handout_3338_CP3338-Handout.pdf. The part on
Quote
AutoCAD Console with APIs
seems quite related to what you want to achieve...