In this Article...
There are many ways to open AutoCAD drawings. You can use open from AutoCAD menu/command. You can double click a DWG file. Or you can drag and drop the drawing to AutoCAD shortcut/Window.
This time Huong Charles shares how you can open AutoCAD drawing file in read only state. Just using contextual menu in Windows Explorer!
© Prashant ZI – Fotolia.com
Creating the script
To make this possible, you need to create a script file. You need to run notepad (or other plain text editor). Copy the code below and save the file as “OpenReadOnly.vbs”. Use the double quotes to preserve the extension. Otherwise, Windows will save the file as OpenReadOnly.vbs.txt.
For Windows XP
Create a file containing the following code:
On Error Resume Next
dim cmd_arg
set cmd_arg=wscript.Arguments
Dim acadApp
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
End if
acadApp.visible=True
acadApp.WindowState = normal
acadApp.Documents.Open cmd_arg(0), True
Save this as OpenReadOnly.vbs anywhere, say your “My Documents” folder.
In Windows Explorer (also can do this in the “My Documents” window), go into Tools, Folder Options, File Types, scroll down to DWG.
Click Advanced.
Click New.
Under Action, put “Open Read-Only”
Under “Application…”, put wscript.exe “C:\Documents and Settings\hcharles\My Documents\OpenReadOnly.vbs” “%1” (with the quotes)
Click OK twice, then Close.
Now when you right click on a DWG file, choose Open Read-only.
Tested on local files in AutoCAD 2008 XP SP3 Platform.
For Windows 7
Using Notepad, create a file containing the following (same as was for Windows XP)
On Error Resume Next
dim cmd_arg
set cmd_arg=wscript.Arguments
Dim acadApp
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application")
End if
acadApp.visible=True
acadApp.WindowState = normal
acadApp.Documents.Open cmd_arg(0), True
Save this as OpenReadOnly.vbs in your “send to” folder (C:\Users\yourusername\AppData\Roaming\Microsoft\Windows\SendTo ).
To use, right click on the drawing in the directory, select “Send To” then “OpenReadOnly.vbs”
Additional tip for Windows 7
You can also save the file anywhere. Then select the file, right click> copy.
Go to SendTo folder then right click> paste shortcut.
If you choose to put shortcut in that folder, you can rename the shortcut and change the icon as necessary.
This is the final result looks like on Windows 7:
Thank you to Huong Charles for the nice tip!
If you want to be a guest author, please read our quality guidelines here.
This stopped working on my Windows 10 after my company did a reconfiguration. Any ideas? I have it saved in my SendTo folder but when I right-click on a drawing file, the old Read Only option does not present itself. It has severely affected my work flow!
This solution works great for single files. I’ve applied the solution to Windows 10 with no need for modification to the code.
However, what modifications would be required to select multiple files and then open all as Read-Only?
Regards,
Jerry
On Error Resume Next
dim cmd_arg
set cmd_arg=wscript.Arguments
Dim acadApp
Set acadApp = GetObject(, “AutoCAD.Application”)
If Err Then
Err.Clear
Set acadApp = CreateObject(“AutoCAD.Application”)
End if
acadApp.visible=True
acadApp.WindowState = normal
For Each item in cmd_arg
acadApp.Documents.Open item, True
Next
I can`t open my read-only file
Script answer:
C:\User\username\AppData\Roaming\Microsoft\Windous\OpenReadOnly.vbs
Line: 1
chair: 3
Error: Invalid character
code: 800A0408
Source: Microsoft VBSscript compilation error
How correct error character, compilation ? ante, thanks
I had the same problem. Then I removed the double quotes from the script file, and it worked just fine!
You spelled Windows wrong in your path
Thanks for the info Huong. I followed the steps for the Windows 7 and the option is there to open in read only when I right click on the file. However, nothing happens when I select it. I copy and pasted the code so there shouldn’t be anything wrong with it. I’m running AutoCAD 2012 LT. I’m also on a network. The dwg files I use are on our P: drive but my AutoCAD is saved to my C: drive. Any thoughts?
Did you ever figure out how to make this work?
Hi,
Can you please explain how to load this on Windows 8?
Thanks so much!
This solution is great and it is working but I have another problem.
I have two versions of ACAD installed. One full version and another ACAD LT.
How can I modify this script so that when I call it, it opens drawings only in ACAD LT.
Now it automatically opens all dwg. in full ACAD version and it is not suitable for me.
Thank you and best regards,
Igor
If you double click a DWG file, which one will open it? Is it AutoCAD? If yes, you can change the default program to open DWG file. You need to define it by modifying registry. Try this DWG Launcher fix on Design and Motion.
Edwin thanks for your help…
I’m having a similar problem to Igor, only I only have LT installed. Is there some way I can modify the code so that it launches in LT?
Steve
Holding Down the shift key and right clicking in Windows also gives you a read only option…
DWG doesn't seem to have that option in contextual menu, Paul. However, I do have that option for Word and Excel files. That could be from Office installation.
So if you have it on contextual menu, it must be from a software you installed on your computer.
Hey – you're right! Good catch Edwin :)