Results 1 to 6 of 6

Thread: Execute AutoCAD through a VB Script file (.vbs)?

  1. #1
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    0

    Question Execute AutoCAD through a VB Script file (.vbs)?

    Hi all,

    I wish to execute AutoCAD through a VB Script file (.vbs). Any idea the following code does not work?

    Code:
    dim shObj
    set shObj = createobject("wscript.shell")
    shobj.run "c:\program files\autocad 2005\acad.exe"
    set shObj = nothing
    Highly appreciate any help.

    Thanks,
    Abdul Huck

  2. #2
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: Execute AutoCAD through a VB Script file (.vbs)?

    Try this way

    Code:
      
    Set shObj=WScript.CreateObject("WScript.Shell")
    shObj.Run ("C:\PROGRA~1\AUTOCA~1\acad.exe")
    If you have multiple versions of AutoCAD in Program Files folder, you can use AutoCA~2 or AutoCA~3 depending upon the number of versions.

    HTH

  3. #3
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    0

    Default Re: Execute AutoCAD through a VB Script file (.vbs)?

    Quote Originally Posted by zoomharis
    Try this way
    Cool, it works. Thanks. I think there should be some function to convert long file names to short (dos compatible) file names. Any idea?

    Regards,
    Abdul Huck
    Last edited by abdulhuck; 2007-02-21 at 07:17 AM.

  4. #4
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    0

    Default Re: Execute AutoCAD through a VB Script file (.vbs)?

    Quote Originally Posted by abdulhuck
    I think there should be some function to convert long file names to short (dos compatible) file names. Any idea?
    Apart from the above question, one more. I linked this VBS file into an HTML document. But when I click, it opens in edit mode (in a text editor) instead of "Open with command prompt". How to run it by default instead of open in edit mode?

    Regards,

    Abdul Huck

  5. #5
    All AUGI, all the time zoomharis's Avatar
    Join Date
    2005-02
    Location
    Abu Dhabi (Native-India)
    Posts
    506
    Login to Give a bone
    0

    Default Re: Execute AutoCAD through a VB Script file (.vbs)?

    Quote Originally Posted by abdulhuck
    Apart from the above question, one more. I linked this VBS file into an HTML document. But when I click, it opens in edit mode (in a text editor) instead of "Open with command prompt". How to run it by default instead of open in edit mode?
    Abdul Huck
    Goto Folder Options --> File Types and select VBS file type. Click on 'Change' button in the 'Opens With' option under Details of VBS extension. If Microsoft Windows Based Script Host is not available in the list, then click on 'Other' button to locate 'WScript.exe' file in the System32 folder.

    HTH.

  6. #6
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    0

    Default Re: Execute AutoCAD through a VB Script file (.vbs)?

    Fine, thanks.

    Regards,
    Abdul Huck

Similar Threads

  1. Script to execute lisp on multiple drawings
    By jrd.chapman in forum AutoLISP
    Replies: 12
    Last Post: 2017-07-21, 10:04 AM
  2. PD319-1: How to Execute AutoCAD® P&ID Projects Successfully
    By Autodesk University in forum Plant Design
    Replies: 0
    Last Post: 2013-05-05, 02:24 AM
  3. Script file makes AutoCAD LT 2005 "hang"
    By AutoTAD in forum AutoCAD Customization
    Replies: 5
    Last Post: 2006-01-18, 02:16 PM
  4. AutoCAD LT 2005 - Unable to execute tool. Possible causes are:
    By bmiller.73395 in forum AutoCAD LT - General
    Replies: 1
    Last Post: 2005-05-07, 03:43 PM
  5. AutoCAD chokes on script file
    By michael.12445 in forum AutoCAD Customization
    Replies: 9
    Last Post: 2004-06-24, 01:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •