Author Topic: VBScript: How to determine which version of CAD ...  (Read 3943 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
VBScript: How to determine which version of CAD ...
« on: January 17, 2011, 07:23:36 PM »
Afternoon everyone,
I am writing a script to activate the currently running AutoCAD program on any given machine and then run a LiSP.
I am stuck on how to determine which version is currently running in order to make it active.
If I'm trying to do this:
Code: [Select]
Set WSO = WScript.CreateObject("WScript.Shell")
 ...
Function ActivateACAD()
  WSO.AppActivate "AutoCAD Map 3D 2011"   [color=green]' What if the user is running "AutoCAD Map 3D 2010"[/color]
 ...

Would I just use an IF statement?

Code: [Select]
IF NOT WSO.AppActivate "AutoCAD Map 3D 2010" Then
  WSO.AppActivate "AutoCAD Map 3D 2011"
End If

Thank you for the help.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: VBScript: How to determine which version of CAD ...
« Reply #1 on: January 18, 2011, 07:59:48 AM »
You could read the registry for the version number, maybe?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: VBScript: How to determine which version of CAD ...
« Reply #2 on: January 18, 2011, 08:00:16 AM »
Or maybe do a find file and read the returned path
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

fixo

  • Guest
Re: VBScript: How to determine which version of CAD ...
« Reply #3 on: January 24, 2011, 03:21:51 AM »
Try the similar way

Code: [Select]
'demo.vbs
Dim WSHShell
Dim AcApp
Set WSHShell   = WScript.CreateObject("WScript.Shell")
Dim appname
appname="AutoCAD.Application"
Set AcApp = WScript.CreateObject(appname)
AcApp.Visible=True
WSHShell.AppActiVate AcApp.Caption

~'J'~