Author Topic: More than one Acad session currently running?  (Read 3470 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
More than one Acad session currently running?
« on: August 27, 2005, 07:59:27 AM »
Hello,

I wrote some accounting program for our company; making it easy for drafters to put in  on the end of the day what they were working on.

It starts a dialog with the BeginQuit event, reads log data out a text file, writes data with the user input added to excel sheets. In the end the txt file is deleted because the info is already stored.

Everything works fine, but there is one possible source of error: Having two Sessions of Autocad open at the same time and running the accounting dialog when closing the first session.

I know there is no reason for having two sessions running the same time, but we work with a HVAC application from a third party written in C++ and this software sometimes does strange moves.

Is there a simple way to find out if there is a second acadApp. Object running out there ?

Thanks in Advance,

Bernd

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
More than one Acad session currently running?
« Reply #1 on: August 27, 2005, 08:29:54 AM »
Convert > this < code to VB; something like > this <.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
More than one Acad session currently running?
« Reply #2 on: August 27, 2005, 08:54:59 AM »
All you'd have to do is copy the code in Command1_Click Sub to a Public Function, called, let's see GetAcadAppCount and modify the logic in the do loop so that it tests the uProcess.szExeFile string for the inclusion of "acad.exe" (don't get tripped up by case or the additional info in the uProcess.szExeFile string) instead of pushing it to the listbox, talling and returning the number of instances found. I tried it and it worked fine under Windows XP, SP2; very easy stuff.

Might consider making it a generic function that takes one parameter, the name of the executable whose running instances you wish to tally.

I'd post my version but I'm honoring the author's wishes per his web site.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Amsterdammed

  • Guest
More than one Acad session currently running?
« Reply #3 on: August 27, 2005, 02:09:07 PM »
Thanks Mike

I was out in the yard working on my boat, so it took a while till i read your helpfull post.
Of course I didn’t read it well enough in the first place (or not understood it) and got confused by the info attached to the string, but it works now.

I also will honour the author’s wish on his website.

 Bernd :D

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
More than one Acad session currently running?
« Reply #4 on: August 27, 2005, 02:10:39 PM »
Good to hear it Bernd; thanks for checkin' back.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst